This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 0/3] posix: Execute file function fixes


This is an update from my previous patchset with fixes based on previous
comments.  The differences from previous version are:

* Regarding stack allocation safeness for exec function family I saw no
  safe solution.  The GCC options '-fstack-check' is hinted as unsafe by
  Florian and I am not sure how reliable it is on all the affected
  platforms.  Also I tend to agree with Rich Felker in the sense libc
  has no obligation in make sure the stack allocation is suffice to
  fix runtime constraints.  No option is added on this patchset to
  handle this.

* Also no platform specific asm code with some ABI hacks is added to
  avoid the afore-mentioned issue.  It only adds code complexity, adds
  mantainability, and also adds different platform runtimes behavior and
  constraints.

* No CLONE_SETTLS is required for posix_spawn{p} and a comment was added
  stating that although parent and child shared the same TLS namespace
  there is no concurrent access due the CLONE_VFORK usage.

* Fix an alpha build due its usage of clone2 syscall instead of clone.

--

This patchset add some cleanup and fixes for the exec{l,le,lp,vpe}
general function implementation and fixes long standing bugs for
posix_spawn{p} on Linux.  It is basically my previous 2 patchset
for execvpe and posix_spawn{p} along with the execl{e,p} fixes.

For exe{l,le,lp,vpe} function main difference is using stack allocation
instead of dynamic one for argument handling.  The main difference from
previous patch iteration is it does not add any memory stack allocation
constraints due:

1. Current GLIBC logic to limit stack allocation through __MAX_ALLOCA_CUTOFF
   is arbitrary and does no impose any limit (it does not consider current
   stack size neither stack size limit).

2. Memory allocation constraints associated with the functions make
   stack allocation the only sane option.  All exec function family are
   defined to be async-safe, where they can be called either through a
   signal handler or in vfork child, and they can not really on dynamic
   memory allocation (either through malloc or directly by mmap).

The posix_spawn{p} is a new implementation for Linux which aims to
fix some long-standing bug regarding signal handling.  It also
tries to avoid dynamic memory allocation by either relying on the
exec{l,vpe} functions with a dynamic mmap memory region allocate
to use along with direct created child (using clone syscall).

Adhemerval Zanella (3):
  posix: Remove dynamic memory allocation from execl{e,p}
  posix: execvpe cleanup
  posix: New Linux posix_spawn{p} implementation

 ChangeLog                                         |  54 +++
 include/sched.h                                   |   2 +
 include/unistd.h                                  |   1 +
 posix/Makefile                                    |   7 +-
 posix/execl.c                                     |  65 +---
 posix/execle.c                                    |  66 +---
 posix/execlp.c                                    |  64 +---
 posix/execvpe.c                                   | 238 +++++-------
 posix/tst-execvp1.c                               |   6 +-
 posix/tst-execvp2.c                               |   5 +-
 posix/tst-execvp3.c                               |   5 +-
 posix/tst-execvp4.c                               |   6 +-
 posix/tst-execvpe1.c                              |  20 +
 posix/tst-execvpe2.c                              |  20 +
 posix/tst-execvpe3.c                              |  20 +
 posix/tst-execvpe4.c                              |  20 +
 posix/tst-execvpe5.c                              | 130 +++++++
 posix/tst-execvpe6.c                              |  82 ++++
 posix/tst-spawn2.c                                |  73 ++++
 sysdeps/posix/dup.c                               |   2 +-
 sysdeps/unix/sysv/linux/aarch64/clone.S           |   1 +
 sysdeps/unix/sysv/linux/alpha/clone.S             |   1 +
 sysdeps/unix/sysv/linux/arm/clone.S               |   1 +
 sysdeps/unix/sysv/linux/hppa/clone.S              |   1 +
 sysdeps/unix/sysv/linux/i386/clone.S              |   1 +
 sysdeps/unix/sysv/linux/ia64/clone2.S             |   2 +
 sysdeps/unix/sysv/linux/m68k/clone.S              |   1 +
 sysdeps/unix/sysv/linux/microblaze/clone.S        |   1 +
 sysdeps/unix/sysv/linux/mips/clone.S              |   1 +
 sysdeps/unix/sysv/linux/nios2/clone.S             |   1 +
 sysdeps/unix/sysv/linux/nptl-signals.h            |  10 +
 sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S |   1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S |   1 +
 sysdeps/unix/sysv/linux/s390/s390-32/clone.S      |   2 +
 sysdeps/unix/sysv/linux/s390/s390-64/clone.S      |   2 +
 sysdeps/unix/sysv/linux/sh/clone.S                |   1 +
 sysdeps/unix/sysv/linux/sparc/sparc32/clone.S     |   1 +
 sysdeps/unix/sysv/linux/sparc/sparc64/clone.S     |   1 +
 sysdeps/unix/sysv/linux/spawni.c                  | 433 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/tile/clone.S              |   1 +
 sysdeps/unix/sysv/linux/x86_64/clone.S            |   1 +
 41 files changed, 1065 insertions(+), 286 deletions(-)
 create mode 100644 posix/tst-execvpe1.c
 create mode 100644 posix/tst-execvpe2.c
 create mode 100644 posix/tst-execvpe3.c
 create mode 100644 posix/tst-execvpe4.c
 create mode 100644 posix/tst-execvpe5.c
 create mode 100644 posix/tst-execvpe6.c
 create mode 100644 posix/tst-spawn2.c
 create mode 100644 sysdeps/unix/sysv/linux/spawni.c

-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]