public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] posix: Execute file function fixes
@ 2016-02-19 18:05 Adhemerval Zanella
  2016-02-19 18:05 ` [PATCH 2/3] posix: execvpe cleanup Adhemerval Zanella
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Adhemerval Zanella @ 2016-02-19 18:05 UTC (permalink / raw)
  To: libc-alpha

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-02-20 18:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-19 18:05 [PATCH v2 0/3] posix: Execute file function fixes Adhemerval Zanella
2016-02-19 18:05 ` [PATCH 2/3] posix: execvpe cleanup Adhemerval Zanella
2016-02-20  8:32   ` Mike Frysinger
2016-02-19 18:05 ` [PATCH 1/3] posix: Remove dynamic memory allocation from execl{e,p} Adhemerval Zanella
2016-02-20  8:26   ` Mike Frysinger
2016-02-19 18:06 ` [PATCH 3/3] posix: New Linux posix_spawn{p} implementation Adhemerval Zanella
2016-02-19 18:33 ` [PATCH v2 0/3] posix: Execute file function fixes Paul Eggert
2016-02-19 19:14   ` Adhemerval Zanella
2016-02-19 19:58     ` Paul Eggert
2016-02-19 20:19       ` Adhemerval Zanella
2016-02-19 23:13         ` Paul Eggert
2016-02-20 10:37           ` Adhemerval Zanella
2016-02-20 18:25             ` Paul Eggert
2016-02-19 23:12   ` Joseph Myers
2016-02-19 23:26     ` Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).