From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68678 invoked by alias); 26 Feb 2016 13:56:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 68660 invoked by uid 89); 26 Feb 2016 13:56:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=sane, 274, GLIBC, exe X-HELO: mail-yw0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=xLaTTjKjv2Lf47fciqyNksr/p00+IbrKl9tla3b+WWs=; b=YeqYGNlV3h1VHMYN7/DJnfBh8JhEi2Sur7ckkVx1sdqOYGedCt8MIt3+Sl/4uInIUr HN3H2zFrAe5PcuTUCC/4MmX/SkvIqMjd1Qt0j2FcEa7ApVK2nb27tlMH/yrxL2TAPhSt ZYnnR95+mC/ii2X6ouhfinAcUQ2/U6Xd2PFuAD4trrgGMQKNfZkjVg2D1SN91gR5Y9NF 5aPNARykNeJdKYzq0QqyjrwLzfW/QANyk46n9KFznurA2HC9GfdG0baWIGcs1vf0TkqZ otrEfCOEAXgmZxs4cR7KmAXssj9+W5Cn+r8ncE1Y7AWpdc/pZLU5Ac2fxZ1QL6qfsZ0M fkfw== X-Gm-Message-State: AD7BkJIoOay5Uyg65tGNc1O3+xE7U3BoTXB0xSIFxJBtKR3ghDvyJHC2f2S0zFLMhdY4tFS3 X-Received: by 10.129.132.198 with SMTP id u189mr809185ywf.261.1456495009554; Fri, 26 Feb 2016 05:56:49 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 0/3] posix: Execute file function fixes Date: Fri, 26 Feb 2016 13:57:00 -0000 Message-Id: <1456495001-5298-1-git-send-email-adhemerval.zanella@linaro.org> X-SW-Source: 2016-02/txt/msg00832.txt.bz2 This is an update from my previous patchset with fixes based on previous comments. The differences from previous version are: * Add a limit check for total number of arguments to avoid signed overflow handling. Current limit of argument for execl{e,p}, execvpe and posix_spawn{p} is INT_MAX. * Add some comments clarifing the problems with dynamic memory allocations for exec family functions. -- 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 | 69 ++-- posix/execle.c | 70 ++-- posix/execlp.c | 67 ++-- posix/execvpe.c | 244 +++++------- 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 | 157 ++++++++ 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 | 445 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/tile/clone.S | 1 + sysdeps/unix/sysv/linux/x86_64/clone.S | 1 + 41 files changed, 1133 insertions(+), 274 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