Re: Relax the prohibition of usage fchdir(2) to quit a chroot

Matt Thomas <[email protected]>
Newsgroups gmane.os.netbsd.devel.security
Message-ID <[email protected]>
On Sep 20, 2014, at 5:02 PM, Kamil Rytarowski <[email protected]> wrote:

> Hello,
> 
> There is a security feature in sys_fchdir [1] with the following comment: 
>        /*  
>         * Disallow changing to a directory not under the process's
>         * current root directory (if there is one). 
>         */

Yes, that's intentional.  Even if you get sent a fd to directory outside of the chroot,
it won't you do any good.  The rule is inviolate.

> This feature actually kills functionality of i.e. misc/rpm with the '--root' feature.

So it's broken by design. :)

> Linux by default doesn't make this restriction, it's enabled i.e. with grecurity [2].
> I need to use this feature, without tools like fakechroot.. so am I free to propose a patch swapping this feature on and off in runtime with sysctl?

In my humble personal opinions, hell no.  

> My proposition is:
> security.chroot.allow_fchdir_out_of_chroot (sorry I'm bad at brief names).

How security.chroot.just_kidding?

> Maybe try to implement other chroot restrictions and make them swappable in runtime as well?

Again, my opinion, absolutely not.  It's not broken, and doesn't need to broken.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.