Closed fishrockz closed 4 months ago
I found that the proc UID/GID mapping seems to be broken even if you don't map your UID to another.
✦ ❯ cargo run -- run --ro-bind /etc/passwd -- ls -lnh
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/hakoniwa run --ro-bind /etc/passwd -- ls -lnh`
total 340K
dr-xr-xr-x. 3 65534 65534 68K May 1 21:53 bin
drwxr-xr-x. 2 1000 1000 120 Jun 15 22:11 dev
drwxr-xr-x. 2 1000 1000 60 Jun 15 22:11 etc
dr-xr-xr-x. 84 65534 65534 36K Apr 27 17:49 lib
dr-xr-xr-x. 202 65534 65534 220K May 1 21:53 lib64
dr-xr-xr-x. 716 65534 65534 0 Jun 15 22:11 proc
drwxr-xr-x. 15 65534 65534 4.0K Apr 27 17:45 usr
I found that the proc UID/GID mapping seems to be broken even if you don't map your UID to another.
✦ ❯ cargo run -- run --ro-bind /etc/passwd -- ls -lnh Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s Running `target/debug/hakoniwa run --ro-bind /etc/passwd -- ls -lnh` total 340K dr-xr-xr-x. 3 65534 65534 68K May 1 21:53 bin drwxr-xr-x. 2 1000 1000 120 Jun 15 22:11 dev drwxr-xr-x. 2 1000 1000 60 Jun 15 22:11 etc dr-xr-xr-x. 84 65534 65534 36K Apr 27 17:49 lib dr-xr-xr-x. 202 65534 65534 220K May 1 21:53 lib64 dr-xr-xr-x. 716 65534 65534 0 Jun 15 22:11 proc drwxr-xr-x. 15 65534 65534 4.0K Apr 27 17:45 usr
current user (e.g. uid 1000, gid 1000) is mapped into container by default.
i do not think we can map /proc in the same way as /dev without root, plz see https://github.com/containers/podman/discussions/16558
Yes having spoke to some others about this, i now realise that this is how it should work.
I think the uid/gid mapping for proc might be broken or i might be using it wrong.
I looked at the example
And expanded it to how the file system is mapped through.
I would have expected /proc/ to also be mapped in the same way as /dev/
For my use case i use a existing mount point but with the users permissions, ie files/directories at
mountpoint
are owned by the user running this code.then i get
Note: I deliberately set the ctime/mtime/atime to the UNIX epoc to try to make thing running in the sandbox to be as consistent as possible. (this is a fuse file system so is easy to do this)