<div dir="auto">Glibc needs /proc mounted so the answer is no.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El El mar, 9 de feb. de 2021 a la(s) 12:05, Antonius Frie <<a href="mailto:antonius.frie@ruhr-uni-bochum.de">antonius.frie@ruhr-uni-bochum.de</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
So this is kind of a follow-up to the thread in [1], and the <br>
corresponding PR in [2].<br>
<br>
In short, the PR made some changes to allow for cases where /proc was <br>
not available in the mount namespace of the service, and added a test <br>
[3] to make sure that this would work. This test was later removed and <br>
rewritten to block /sys instead [4], because it turned out that having <br>
/proc unavailable sometimes caused problems with close_all_fds(), which <br>
is called in exec_child() after namespaces have been set up.<br>
<br>
On current master, services that don't have /proc mounted don't work at <br>
all anymore, since find_executable_full() ends up opening the given path <br>
and calling access_fd() on the resulting fd, and access_fd uses <br>
/proc/self/fd/* to turn the fd back into a path it can call access() on. <br>
As far as I can tell, the reason for not using access on the path <br>
directly is that access_fd is more elegant since it avoids a potential <br>
race condition.<br>
<br>
In addition to this, setup_private_users() also needs access to <br>
/proc/$pid/{uid_map, gid_map, setgroups} to do its job.<br>
<br>
Given all this, I guess my question is whether it is still desirable to <br>
allow units to run without /proc, especially given that ProtectProc and <br>
ProcSubset exist now.* If not, it might be nice to just always mount <br>
/proc if it wouldn't otherwise be there (i.e. if RootImage/RootDirectory <br>
is used); currently, MountAPIVFS=yes is basically a required option <br>
because of this. (I guess you could mount proc manually, but then you <br>
can't use ProtectProc/ProcSubset.) I'm a bit unhappy about this, because <br>
MountAPIVFS also mounts /sys and /dev, and then you need separate <br>
options just to protect those again. Either way, maybe it would be good <br>
to explicitly state this requirement in the documentation?<br>
<br>
Anyway, I hope that this was okay to post here, I don't really know a <br>
lot about this and maybe there are good reasons for why things are the <br>
way they are. I'd be happy about feedback though.<br>
<br>
Cheers,<br>
Antonius<br>
<br>
* Using both ProtectProc=ptraceable and ProcSubset=pid really doesn't<br>
let a lot of things through, and I don't think those interfere with any <br>
of the functions described above. The only thing I'm unsure about is <br>
setup_private_users(), since that spawns off a child process which then<br>
goes and writes to /proc/$parent_pid/, but I guess children can ptrace<br>
their parents? At least it seemed to work when I just tested it.<br>
<br>
[1]: <br>
<a href="https://lists.freedesktop.org/archives/systemd-devel/2017-April/038634.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/systemd-devel/2017-April/038634.html</a><br>
[2]: <a href="https://github.com/systemd/systemd/pull/5985" rel="noreferrer" target="_blank">https://github.com/systemd/systemd/pull/5985</a><br>
[3]: <a href="https://github.com/systemd/systemd/pull/6017" rel="noreferrer" target="_blank">https://github.com/systemd/systemd/pull/6017</a><br>
[4]: <br>
<a href="https://github.com/systemd/systemd/commit/054d871d41039fcfc1a4a661c979941b9660c9e6" rel="noreferrer" target="_blank">https://github.com/systemd/systemd/commit/054d871d41039fcfc1a4a661c979941b9660c9e6</a><br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div></div>