Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 29 Sep 2020 14:38:30 -0600
From: Ariadne Conill <>
Subject: [RFC] Add posix_spawnattr_chroot_np()


Package managers frequently have a feature where you can use the package 
manager to build a new filesystem image in a sub-directory (usually 
exposed as the --root option in the package manager).  However, to 
achieve this, we have to be able to chroot into the sub-directory to run 
maintainer scripts.

Right now, package managers usually do fork() + chroot() + execve() to 
implement this.  I find it desirable to migrate apk from this fork() + 
chroot() + execve() pattern toward using posix_spawn() as that allows 
for the underlying libc to take care of spawning the maintainer scripts 
for us (and I assume posix_spawn() will always use the most efficient 
method available for doing so).

Accordingly, I propose adding the following interface:

int posix_spawnattr_chroot_np(posix_spawnattr_t *attr, const char *chroot);

This will, of course, set a chroot attribute in posix_spawnattr_t.

Like the other interfaces, it will return 0 or an appropriate error number.

Doing so would allow us to migrate maintainer script handling in package 
managers to use posix_spawn, at least in apk this is the only missing 
functionality we require.

I plan on introducing this to musl shortly if there is consensus that 
the proposed interface is acceptable.  I can also contribute a glibc 
implementation and FreeBSD libc implementation if that would be helpful.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.