mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
fix(nativeguest): keep parent lookups inside the guest root (#3094)
* fix(nativeguest): keep the parent of the guest root inside the rootfs
* fix(nativeguest): keep every .. walk inside the guest root and its mounts
Absolute paths that climb above /, relative paths from the working
directory or any descriptor, and paths that climb out of a mount were
resolved by the kernel from the rootfs folder or the mount's real place,
so /.., chdir("..") from / and fstatat(fd, "../..") listed the app's
files folder. The walk is now resolved in the guest's view first.
* fix(nativeguest): .. from a linked mount ancestor follows the real directory
---------
Co-authored-by: maxjivi05 <6025299+maxjivi05@users.noreply.github.com>
This commit is contained in:
1 parent
ba3f840b8d
commit
f539660650
3 files changed
+114
-24
No files matched your search
@@ -363,8 +363,11 @@ static ssize_t handle_proc_exe_at(int dirfd, const char *pathname, char *buf, si
|
||||
static const char *rewrite_path(const char *path, char *buffer, size_t bufsize) {
|
||||
if (!path) return NULL;
|
||||
// Relative paths must NEVER be rewritten to rootfs root
|
||||
if (path[0] != '/') return path;
|
||||
init_ddnatv_hook();
|
||||
if (path[0] != '/') {
|
||||
const char *walked = map_at(AT_FDCWD, path, buffer, bufsize);
|
||||
return walked ? walked : path;
|
||||
}
|
||||
return rewrite_path_in_root(path, buffer, bufsize);
|
||||
}
|
||||
|
||||
@@ -374,7 +377,7 @@ static const char *rewrite_path(const char *path, char *buffer, size_t bufsize)
|
||||
// followed in the guest's view first. The rootfs's own links were made relative already.
|
||||
static const char *rewrite_path_follow(const char *path, char *buffer, size_t bufsize) {
|
||||
if (!path) return NULL;
|
||||
if (path[0] != '/') return path;
|
||||
if (path[0] != '/') return rewrite_path(path, buffer, bufsize);
|
||||
init_ddnatv_hook();
|
||||
int moved = 0;
|
||||
for (int i = 0; i < g_nbinds; i++) {
|
||||
|
||||
Reference in new issue
Block a user