Skip to contentSkip to conversation

RFC: permit link(2) to work across --bind mounts ?

DISCUSSION [email protected] 2 participants 2 messages Dec 20, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines

Why does link(2) not support hard-linking across bind mount points of the same underlying filesystem ?

Whenever we get mount -r --bind working properly (which I use to place copies of necessary shared libraries inside chroot jails while allowing page cache sharing), this feature would break security.

mkdir /usr/lib/libs.jail
for i in $LIST_OF_LIBRARIES; do

	ln /usr/lib/$i /usr/lib/libs.jail/$i

done
mount -r /usr/lib/libs.jail /jail/lib
chown prisoner /usr/log/jail
mount /usr/log/jail /jail/usr/log
chrootuid /jail prisoner /bin/untrusted &

Although protections should be enough, but I'd rather avoid having the prisoner link /jail/lib/libfoo.so (write returns EROFS) to /jail/usr/log where it's potentially writeable.

#1 lore raw
Quoted 6 lines · [email protected] wrote:
Quoted 2 lines

Why does link(2) not support hard-linking across bind mount points of the same underlying filesystem ?

Whenever we get mount -r --bind working properly (which I use to place copies of necessary shared libraries inside chroot jails while allowing page cache sharing), this feature would break security.

..

No, that would still function exactly as it does today. The alternate behaviour that is desired for non-chroot purposes would be per-bind-mount, and would require a mount flag to activate.

Cheers