[Bug libc/17405] New: Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] New: Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

            Bug ID: 17405
           Summary: Implement posix_spawn_file_actions_addchdir_np,
                    posix_spawn_file_actions_addfchdir_np
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com

Currently, changing the initial current directory of the child process created
by posix_spawn is only possible with a small helper wrapper which changes the
directory as desired, and then execve's the actual program.  It would be nice
if glibc could provide this functionality directly.

Changing the current directory affects pathname resolution, that's why I think
this should be added as file actions, and not as spawn attributes.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlos at redhat dot com

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
Before we add these to glibc we should consider the fork/exec scability
problem, that way we add these interfaces at the same time as the kernel adds a
new clone flag, and we define the semantics of these functions to be slightly
different than normal posix_spawn.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> ---
Carlos, what need do you see for new kernel features? I think userspace
posix_spawn is already perfectly possible without fork (i.e. using CLONE_VM to
avoid the cost of fork), even with file actions and spawnattr features.

I would also like to see support for setsid (needed for implementing terminal
emulators/multiplexers and things like sshd using posix_spawn rather than
fork+exec to run the program on the new pty) and possibly rlimits. The latter
was proposed for inclusion in POSIX but Eric Blake rightfully noted that an
implementation is needed first. I'd like to work out a list of things that
should be added to posix_spawn, get them in glibc (and in musl, where I'm
getting requests for them), and then propose them for standardization.

So far we have:

File actions: chdir/fchdir
Flags: setsid
Other: setrlimit (requires some sort of list of limits to set)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  4a938cb273e164a475dc123cc80ea6354d7248d4 (commit)
      from  7597b0c7f711a6918d5804e08508817c72916376 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4a938cb273e164a475dc123cc80ea6354d7248d4

commit 4a938cb273e164a475dc123cc80ea6354d7248d4
Author: Florian Weimer <[hidden email]>
Date:   Tue Nov 6 16:08:12 2018 +0100

    posix: New function posix_spawn_file_actions_addchdir_np [BZ #17405]

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   69 +++++++
 NEWS                                               |    5 +
 posix/Makefile                                     |    3 +-
 posix/Versions                                     |    3 +
 posix/spawn.h                                      |    7 +
 ..._faction_addopen.c => spawn_faction_addchdir.c} |   23 +--
 posix/spawn_faction_destroy.c                      |    3 +
 posix/spawn_int.h                                  |    7 +-
 posix/tst-spawn-chdir.c                            |  192 ++++++++++++++++++++
 sysdeps/mach/hurd/i386/libc.abilist                |    1 +
 sysdeps/posix/spawni.c                             |    5 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist       |    1 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist         |    1 +
 sysdeps/unix/sysv/linux/arm/libc.abilist           |    1 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist          |    1 +
 sysdeps/unix/sysv/linux/i386/libc.abilist          |    1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist          |    1 +
 sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist |    1 +
 sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist   |    1 +
 sysdeps/unix/sysv/linux/microblaze/libc.abilist    |    1 +
 .../unix/sysv/linux/mips/mips32/fpu/libc.abilist   |    1 +
 .../unix/sysv/linux/mips/mips32/nofpu/libc.abilist |    1 +
 .../unix/sysv/linux/mips/mips64/n32/libc.abilist   |    1 +
 .../unix/sysv/linux/mips/mips64/n64/libc.abilist   |    1 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist         |    1 +
 .../sysv/linux/powerpc/powerpc32/fpu/libc.abilist  |    1 +
 .../linux/powerpc/powerpc32/nofpu/libc.abilist     |    1 +
 .../sysv/linux/powerpc/powerpc64/libc-le.abilist   |    1 +
 .../unix/sysv/linux/powerpc/powerpc64/libc.abilist |    1 +
 sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist    |    1 +
 sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist  |    1 +
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist  |    1 +
 sysdeps/unix/sysv/linux/sh/libc.abilist            |    1 +
 sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist |    1 +
 sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist |    1 +
 sysdeps/unix/sysv/linux/spawni.c                   |    5 +
 sysdeps/unix/sysv/linux/x86_64/64/libc.abilist     |    1 +
 sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist    |    1 +
 38 files changed, 331 insertions(+), 18 deletions(-)
 copy posix/{spawn_faction_addopen.c => spawn_faction_addchdir.c} (69%)
 create mode 100644 posix/tst-spawn-chdir.c

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Florian, do you think we need posix_spawn_file_actions_addfchdir_np as well? If
not, I think we can close this issue.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Adhemerval Zanella from comment #4)
> Florian, do you think we need posix_spawn_file_actions_addfchdir_np as well?
> If not, I think we can close this issue.

I think we should add it for consistency, yes.  It would be possible to emulate
it with /proc, but I'd prefer to add both functions in the same glibc release.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/17405] Implement posix_spawn_file_actions_addchdir_np, posix_spawn_file_actions_addfchdir_np

albert.aribaud at 3adev dot fr
In reply to this post by albert.aribaud at 3adev dot fr
https://sourceware.org/bugzilla/show_bug.cgi?id=17405

--- Comment #6 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Florian Weimer from comment #5)
> (In reply to Adhemerval Zanella from comment #4)
> > Florian, do you think we need posix_spawn_file_actions_addfchdir_np as well?
> > If not, I think we can close this issue.
>
> I think we should add it for consistency, yes.  It would be possible to
> emulate it with /proc, but I'd prefer to add both functions in the same
> glibc release.

I agree, I think relying solely on _addchdir to emulate _addfchdir only adds
more complexity on the posix_spawn.

--
You are receiving this mail because:
You are on the CC list for the bug.