Message ID | 20230112135853.3786675-1-adhemerval.zanella@linaro.org |
---|---|
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E687338543BA for <patchwork@sourceware.org>; Thu, 12 Jan 2023 13:59:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E687338543BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673531961; bh=mDTEYyGMImO6XNr8xyfL3W09LQbTolIkt29snyHBIcs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=yyhC+7//zRFzvWGBOcA/0MxoWrFKzZwtyCOKtSUVVyslHOQQndG9VjVMu8OJMKWp6 s/3avmep7U3VD2VdHjP59yZA1Ueh4yAb6ZDDhAL2P5BWtBH4919MM7IlOBpSvTHgrk 5Cd5k5hgiSK6mPuEnkI8RXmnv8VK8Z0THL3wBpjE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by sourceware.org (Postfix) with ESMTPS id 4BF893858C66 for <libc-alpha@sourceware.org>; Thu, 12 Jan 2023 13:58:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4BF893858C66 Received: by mail-oo1-xc34.google.com with SMTP id d2-20020a4ab202000000b004ae3035538bso4821721ooo.12 for <libc-alpha@sourceware.org>; Thu, 12 Jan 2023 05:58:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mDTEYyGMImO6XNr8xyfL3W09LQbTolIkt29snyHBIcs=; b=jrUdgg0Lo85hki/yl/gY8IbDXZmDH20GFbdMWkkQsVKZXLCVqyHskwM1RCaA+OIUxo ixGwSjitvhV7ksJeqXcYT2foah7xfJzVu2+K+Zq/cQEaUr2k7PXiq6oz7345R79BGVPe u2/DklEiFwX4DflaaK6bFjgIX2HUfw44e0+HS18Zc0biSq50EW1+CQVInbmfodd7+vbr 7MK6cheVat8QXYN/pzfZdYEiJH3mKfQ9Lk9WGURhyuMNhFjq0ZyAZOkS0UQtZKVXIMgi kPsXDvMSDr6oRfX08wadml7YutgWTTNvBBnisNRA8HGMiAGcx2tB+2WoWlcualpQkM6O Iy7g== X-Gm-Message-State: AFqh2kp0QdxNafmDi2b84oSX2ZOZKQSfCT4mfdn8wtv0i7X9U74y9h2a esJO4+jITPRao7rBxSPFMX25kNNISKN5mfbsoWI= X-Google-Smtp-Source: AMrXdXt+g30F9g7xq3U0LJzT7Yvlcg0WyAbtKLpK17ehhceh+IY1D7pfep2vn/kqqZVp0xYpfFzwXQ== X-Received: by 2002:a4a:ce8b:0:b0:4f2:85eb:a with SMTP id f11-20020a4ace8b000000b004f285eb000amr439050oos.4.1673531937914; Thu, 12 Jan 2023 05:58:57 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a93a:bf1c:dea8:4fd2:4310]) by smtp.gmail.com with ESMTPSA id m26-20020a4abc9a000000b004a0aac2d28fsm8335402oop.35.2023.01.12.05.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 05:58:57 -0800 (PST) To: libc-alpha@sourceware.org, Carlos O'Donell <carlos@redhat.com> Subject: [PATCH v4 0/6] Optimize posix_spawn signal setup with clone3 Date: Thu, 12 Jan 2023 10:58:47 -0300 Message-Id: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Adhemerval Zanella <adhemerval.zanella@linaro.org> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Optimize posix_spawn signal setup with clone3
|
|
Message
Adhemerval Zanella Netto
Jan. 12, 2023, 1:58 p.m. UTC
Currently posix_spawn has to issue at least NSIG sigaction syscalls to obtain current signal disposition and more if they there are not either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags introduced with Linux 5.5 resets all signal handlers of the child not set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this preparation phase. The exception is the signals defined by posix_spawnattr_setsigdefault when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In this case posix_spawn helper process needs to issue a sigction to set the signal disposition to SIG_DFL. The patchset also adds clone3 implementation for aarch64. The clone3 for x86_64 is change to not align the stack, since this is not async-signal safe (although current calls does mask/unmask signals). * Changes from v3: - Changes commit message and comments wording. - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. * Changes from v2: - Improve clone3 internal documentation. * Changes from v1: - Extend clone3 documentation. - Remove x86_64 stack alignment on clone3 child. - Fixed powerpc64 missing initial stack frame. - Fixed missing save/restore r7 for arm. Adhemerval Zanella (6): linux: Do not reset signal handler in posix_spawn if it is already SIG_DFL linux: Extend internal clone3 documentation Linux: Do not align the stack for __clone3 linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn aarch64: Add the clone3 wrapper Linux: optimize clone3 internal usage include/clone_internal.h | 37 +++- posix/Makefile | 3 +- posix/tst-spawn7.c | 179 ++++++++++++++++++ sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- sysdeps/unix/sysv/linux/clone3.h | 15 +- sysdeps/unix/sysv/linux/kernel-features.h | 9 + sysdeps/unix/sysv/linux/spawni.c | 33 +++- .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - 12 files changed, 384 insertions(+), 118 deletions(-) create mode 100644 posix/tst-spawn7.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c
Comments
Carlos, do we still want this for 2.37? On 12/01/23 10:58, Adhemerval Zanella wrote: > Currently posix_spawn has to issue at least NSIG sigaction syscalls > to obtain current signal disposition and more if they there are not > either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags > introduced with Linux 5.5 resets all signal handlers of the child not > set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this > preparation phase. > > The exception is the signals defined by posix_spawnattr_setsigdefault > when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In > this case posix_spawn helper process needs to issue a sigction to > set the signal disposition to SIG_DFL. > > The patchset also adds clone3 implementation for aarch64. The clone3 > for x86_64 is change to not align the stack, since this is not > async-signal safe (although current calls does mask/unmask signals). > > * Changes from v3: > - Changes commit message and comments wording. > - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. > > * Changes from v2: > - Improve clone3 internal documentation. > > * Changes from v1: > - Extend clone3 documentation. > - Remove x86_64 stack alignment on clone3 child. > - Fixed powerpc64 missing initial stack frame. > - Fixed missing save/restore r7 for arm. > > Adhemerval Zanella (6): > linux: Do not reset signal handler in posix_spawn if it is already > SIG_DFL > linux: Extend internal clone3 documentation > Linux: Do not align the stack for __clone3 > linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn > aarch64: Add the clone3 wrapper > Linux: optimize clone3 internal usage > > include/clone_internal.h | 37 +++- > posix/Makefile | 3 +- > posix/tst-spawn7.c | 179 ++++++++++++++++++ > sysdeps/unix/sysv/linux/Makefile | 3 +- > sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ > sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + > sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- > sysdeps/unix/sysv/linux/clone3.h | 15 +- > sysdeps/unix/sysv/linux/kernel-features.h | 9 + > sysdeps/unix/sysv/linux/spawni.c | 33 +++- > .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- > sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - > 12 files changed, 384 insertions(+), 118 deletions(-) > create mode 100644 posix/tst-spawn7.c > create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S > delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c >
On 1/18/23 12:53, Adhemerval Zanella Netto wrote: > Carlos, do we still want this for 2.37? I think we should just push this to 2.38. Start by committing everything we have for x86_64 and aarch64. Then repost the other arches for review. > On 12/01/23 10:58, Adhemerval Zanella wrote: >> Currently posix_spawn has to issue at least NSIG sigaction syscalls >> to obtain current signal disposition and more if they there are not >> either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags >> introduced with Linux 5.5 resets all signal handlers of the child not >> set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this >> preparation phase. >> >> The exception is the signals defined by posix_spawnattr_setsigdefault >> when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In >> this case posix_spawn helper process needs to issue a sigction to >> set the signal disposition to SIG_DFL. >> >> The patchset also adds clone3 implementation for aarch64. The clone3 >> for x86_64 is change to not align the stack, since this is not >> async-signal safe (although current calls does mask/unmask signals). >> >> * Changes from v3: >> - Changes commit message and comments wording. >> - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. >> >> * Changes from v2: >> - Improve clone3 internal documentation. >> >> * Changes from v1: >> - Extend clone3 documentation. >> - Remove x86_64 stack alignment on clone3 child. >> - Fixed powerpc64 missing initial stack frame. >> - Fixed missing save/restore r7 for arm. >> >> Adhemerval Zanella (6): >> linux: Do not reset signal handler in posix_spawn if it is already >> SIG_DFL >> linux: Extend internal clone3 documentation >> Linux: Do not align the stack for __clone3 >> linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn >> aarch64: Add the clone3 wrapper >> Linux: optimize clone3 internal usage >> >> include/clone_internal.h | 37 +++- >> posix/Makefile | 3 +- >> posix/tst-spawn7.c | 179 ++++++++++++++++++ >> sysdeps/unix/sysv/linux/Makefile | 3 +- >> sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ >> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + >> sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- >> sysdeps/unix/sysv/linux/clone3.h | 15 +- >> sysdeps/unix/sysv/linux/kernel-features.h | 9 + >> sysdeps/unix/sysv/linux/spawni.c | 33 +++- >> .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- >> sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - >> 12 files changed, 384 insertions(+), 118 deletions(-) >> create mode 100644 posix/tst-spawn7.c >> create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S >> delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c >> >
Just to confirm that it is for 2.38, since you replied as 2.28 on the patches :}. On 18/01/23 19:24, Carlos O'Donell wrote: > On 1/18/23 12:53, Adhemerval Zanella Netto wrote: >> Carlos, do we still want this for 2.37? > > I think we should just push this to 2.38. > > Start by committing everything we have for x86_64 and aarch64. > > Then repost the other arches for review. > >> On 12/01/23 10:58, Adhemerval Zanella wrote: >>> Currently posix_spawn has to issue at least NSIG sigaction syscalls >>> to obtain current signal disposition and more if they there are not >>> either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags >>> introduced with Linux 5.5 resets all signal handlers of the child not >>> set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this >>> preparation phase. >>> >>> The exception is the signals defined by posix_spawnattr_setsigdefault >>> when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In >>> this case posix_spawn helper process needs to issue a sigction to >>> set the signal disposition to SIG_DFL. >>> >>> The patchset also adds clone3 implementation for aarch64. The clone3 >>> for x86_64 is change to not align the stack, since this is not >>> async-signal safe (although current calls does mask/unmask signals). >>> >>> * Changes from v3: >>> - Changes commit message and comments wording. >>> - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. >>> >>> * Changes from v2: >>> - Improve clone3 internal documentation. >>> >>> * Changes from v1: >>> - Extend clone3 documentation. >>> - Remove x86_64 stack alignment on clone3 child. >>> - Fixed powerpc64 missing initial stack frame. >>> - Fixed missing save/restore r7 for arm. >>> >>> Adhemerval Zanella (6): >>> linux: Do not reset signal handler in posix_spawn if it is already >>> SIG_DFL >>> linux: Extend internal clone3 documentation >>> Linux: Do not align the stack for __clone3 >>> linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn >>> aarch64: Add the clone3 wrapper >>> Linux: optimize clone3 internal usage >>> >>> include/clone_internal.h | 37 +++- >>> posix/Makefile | 3 +- >>> posix/tst-spawn7.c | 179 ++++++++++++++++++ >>> sysdeps/unix/sysv/linux/Makefile | 3 +- >>> sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ >>> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + >>> sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- >>> sysdeps/unix/sysv/linux/clone3.h | 15 +- >>> sysdeps/unix/sysv/linux/kernel-features.h | 9 + >>> sysdeps/unix/sysv/linux/spawni.c | 33 +++- >>> .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- >>> sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - >>> 12 files changed, 384 insertions(+), 118 deletions(-) >>> create mode 100644 posix/tst-spawn7.c >>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S >>> delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c >>> >> >
On 1/19/23 09:39, Adhemerval Zanella Netto wrote: > Just to confirm that it is for 2.38, since you replied as 2.28 on the patches :}. Yes, 2.38, not 2.28 :-) Thank you, and sorry. > On 18/01/23 19:24, Carlos O'Donell wrote: >> On 1/18/23 12:53, Adhemerval Zanella Netto wrote: >>> Carlos, do we still want this for 2.37? >> >> I think we should just push this to 2.38. >> >> Start by committing everything we have for x86_64 and aarch64. >> >> Then repost the other arches for review. >> >>> On 12/01/23 10:58, Adhemerval Zanella wrote: >>>> Currently posix_spawn has to issue at least NSIG sigaction syscalls >>>> to obtain current signal disposition and more if they there are not >>>> either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags >>>> introduced with Linux 5.5 resets all signal handlers of the child not >>>> set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this >>>> preparation phase. >>>> >>>> The exception is the signals defined by posix_spawnattr_setsigdefault >>>> when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In >>>> this case posix_spawn helper process needs to issue a sigction to >>>> set the signal disposition to SIG_DFL. >>>> >>>> The patchset also adds clone3 implementation for aarch64. The clone3 >>>> for x86_64 is change to not align the stack, since this is not >>>> async-signal safe (although current calls does mask/unmask signals). >>>> >>>> * Changes from v3: >>>> - Changes commit message and comments wording. >>>> - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. >>>> >>>> * Changes from v2: >>>> - Improve clone3 internal documentation. >>>> >>>> * Changes from v1: >>>> - Extend clone3 documentation. >>>> - Remove x86_64 stack alignment on clone3 child. >>>> - Fixed powerpc64 missing initial stack frame. >>>> - Fixed missing save/restore r7 for arm. >>>> >>>> Adhemerval Zanella (6): >>>> linux: Do not reset signal handler in posix_spawn if it is already >>>> SIG_DFL >>>> linux: Extend internal clone3 documentation >>>> Linux: Do not align the stack for __clone3 >>>> linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn >>>> aarch64: Add the clone3 wrapper >>>> Linux: optimize clone3 internal usage >>>> >>>> include/clone_internal.h | 37 +++- >>>> posix/Makefile | 3 +- >>>> posix/tst-spawn7.c | 179 ++++++++++++++++++ >>>> sysdeps/unix/sysv/linux/Makefile | 3 +- >>>> sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ >>>> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + >>>> sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- >>>> sysdeps/unix/sysv/linux/clone3.h | 15 +- >>>> sysdeps/unix/sysv/linux/kernel-features.h | 9 + >>>> sysdeps/unix/sysv/linux/spawni.c | 33 +++- >>>> .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- >>>> sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - >>>> 12 files changed, 384 insertions(+), 118 deletions(-) >>>> create mode 100644 posix/tst-spawn7.c >>>> create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S >>>> delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c >>>> >>> >> >
On Thu, Jan 12, 2023 at 5:59 AM Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> wrote: > > Currently posix_spawn has to issue at least NSIG sigaction syscalls > to obtain current signal disposition and more if they there are not > either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags > introduced with Linux 5.5 resets all signal handlers of the child not > set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this > preparation phase. > > The exception is the signals defined by posix_spawnattr_setsigdefault > when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In > this case posix_spawn helper process needs to issue a sigction to > set the signal disposition to SIG_DFL. > > The patchset also adds clone3 implementation for aarch64. The clone3 > for x86_64 is change to not align the stack, since this is not > async-signal safe (although current calls does mask/unmask signals). > > * Changes from v3: > - Changes commit message and comments wording. > - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. > > * Changes from v2: > - Improve clone3 internal documentation. > > * Changes from v1: > - Extend clone3 documentation. > - Remove x86_64 stack alignment on clone3 child. > - Fixed powerpc64 missing initial stack frame. > - Fixed missing save/restore r7 for arm. > > Adhemerval Zanella (6): > linux: Do not reset signal handler in posix_spawn if it is already > SIG_DFL > linux: Extend internal clone3 documentation > Linux: Do not align the stack for __clone3 > linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn > aarch64: Add the clone3 wrapper > Linux: optimize clone3 internal usage > > include/clone_internal.h | 37 +++- > posix/Makefile | 3 +- > posix/tst-spawn7.c | 179 ++++++++++++++++++ > sysdeps/unix/sysv/linux/Makefile | 3 +- > sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ > sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + > sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- > sysdeps/unix/sysv/linux/clone3.h | 15 +- > sysdeps/unix/sysv/linux/kernel-features.h | 9 + > sysdeps/unix/sysv/linux/spawni.c | 33 +++- > .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- > sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - > 12 files changed, 384 insertions(+), 118 deletions(-) > create mode 100644 posix/tst-spawn7.c > create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S > delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c > > -- > 2.34.1 > On x86-64, I am getting error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL tst-spawn7.c:91: numeric comparison failure left: 1 (0x1); from: WEXITSTATUS (status) right: 0 (0x0); from: 0 error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL tst-spawn7.c:91: numeric comparison failure left: 1 (0x1); from: WEXITSTATUS (status) right: 0 (0x0); from: 0 error: tst-spawn7.c:71: not true: sa.sa_handler == SIG_DFL tst-spawn7.c:91: numeric comparison failure left: 1 (0x1); from: WEXITSTATUS (status) right: 0 (0x0); from: 0 error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL tst-spawn7.c:91: numeric comparison failure left: 1 (0x1); from: WEXITSTATUS (status) right: 0 (0x0); from: 0 error: 4 test failures FAIL: posix/tst-spawn7 with $ make check -j12 But it passes when I run it by hand. Is this expected?
On 28/02/23 13:34, H.J. Lu wrote: > On Thu, Jan 12, 2023 at 5:59 AM Adhemerval Zanella via Libc-alpha > <libc-alpha@sourceware.org> wrote: >> >> Currently posix_spawn has to issue at least NSIG sigaction syscalls >> to obtain current signal disposition and more if they there are not >> either SIG_IGN or SIG_DFL. The new clone3 CLONE_CLEAR_SIGHAND flags >> introduced with Linux 5.5 resets all signal handlers of the child not >> set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this >> preparation phase. >> >> The exception is the signals defined by posix_spawnattr_setsigdefault >> when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN). In >> this case posix_spawn helper process needs to issue a sigction to >> set the signal disposition to SIG_DFL. >> >> The patchset also adds clone3 implementation for aarch64. The clone3 >> for x86_64 is change to not align the stack, since this is not >> async-signal safe (although current calls does mask/unmask signals). >> >> * Changes from v3: >> - Changes commit message and comments wording. >> - Removed powerpc, s390x, riscv, arm, and mips clone3 optimizations. >> >> * Changes from v2: >> - Improve clone3 internal documentation. >> >> * Changes from v1: >> - Extend clone3 documentation. >> - Remove x86_64 stack alignment on clone3 child. >> - Fixed powerpc64 missing initial stack frame. >> - Fixed missing save/restore r7 for arm. >> >> Adhemerval Zanella (6): >> linux: Do not reset signal handler in posix_spawn if it is already >> SIG_DFL >> linux: Extend internal clone3 documentation >> Linux: Do not align the stack for __clone3 >> linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn >> aarch64: Add the clone3 wrapper >> Linux: optimize clone3 internal usage >> >> include/clone_internal.h | 37 +++- >> posix/Makefile | 3 +- >> posix/tst-spawn7.c | 179 ++++++++++++++++++ >> sysdeps/unix/sysv/linux/Makefile | 3 +- >> sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 +++++++++ >> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + >> sysdeps/unix/sysv/linux/clone-internal.c | 59 ++++-- >> sysdeps/unix/sysv/linux/clone3.h | 15 +- >> sysdeps/unix/sysv/linux/kernel-features.h | 9 + >> sysdeps/unix/sysv/linux/spawni.c | 33 +++- >> .../sysv/linux/tst-misalign-clone-internal.c | 74 -------- >> sysdeps/unix/sysv/linux/x86_64/clone3.S | 3 - >> 12 files changed, 384 insertions(+), 118 deletions(-) >> create mode 100644 posix/tst-spawn7.c >> create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S >> delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c >> >> -- >> 2.34.1 >> > > On x86-64, I am getting > > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:71: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: 4 test failures > FAIL: posix/tst-spawn7 > > with > > $ make check -j12 > > But it passes when I run it by hand. Is this expected? > I am not sure, I constantly check with make -jN (24 usually). Can you instrument the test to print the signal that has failed the check?
* H. J. Lu via Libc-alpha: > On x86-64, I am getting > > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:71: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > tst-spawn7.c:91: numeric comparison failure > left: 1 (0x1); from: WEXITSTATUS (status) > right: 0 (0x0); from: 0 > error: 4 test failures > FAIL: posix/tst-spawn7 > > with > > $ make check -j12 > > But it passes when I run it by hand. Is this expected? I see it as well, but it's not consistent for me, either. Could it be a make bug, leaking unusual handler dispositions in some cases? The test should probably check that the disposition are as expected at the start, and not incorrect to begin with. Thanks, Florian
On 28/02/23 15:09, Florian Weimer wrote: > * H. J. Lu via Libc-alpha: > >> On x86-64, I am getting >> >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL >> tst-spawn7.c:91: numeric comparison failure >> left: 1 (0x1); from: WEXITSTATUS (status) >> right: 0 (0x0); from: 0 >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL >> tst-spawn7.c:91: numeric comparison failure >> left: 1 (0x1); from: WEXITSTATUS (status) >> right: 0 (0x0); from: 0 >> error: tst-spawn7.c:71: not true: sa.sa_handler == SIG_DFL >> tst-spawn7.c:91: numeric comparison failure >> left: 1 (0x1); from: WEXITSTATUS (status) >> right: 0 (0x0); from: 0 >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL >> tst-spawn7.c:91: numeric comparison failure >> left: 1 (0x1); from: WEXITSTATUS (status) >> right: 0 (0x0); from: 0 >> error: 4 test failures >> FAIL: posix/tst-spawn7 >> >> with >> >> $ make check -j12 >> >> But it passes when I run it by hand. Is this expected? > > I see it as well, but it's not consistent for me, either. Could it be a > make bug, leaking unusual handler dispositions in some cases? The test > should probably check that the disposition are as expected at the start, > and not incorrect to begin with. Right, it makes sense. I will add some improvement to have a consistent signal handling disposition prior spawn the tests processes.
On Tue, Feb 28, 2023 at 10:16 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 28/02/23 15:09, Florian Weimer wrote: > > * H. J. Lu via Libc-alpha: > > > >> On x86-64, I am getting > >> > >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > >> tst-spawn7.c:91: numeric comparison failure > >> left: 1 (0x1); from: WEXITSTATUS (status) > >> right: 0 (0x0); from: 0 > >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > >> tst-spawn7.c:91: numeric comparison failure > >> left: 1 (0x1); from: WEXITSTATUS (status) > >> right: 0 (0x0); from: 0 > >> error: tst-spawn7.c:71: not true: sa.sa_handler == SIG_DFL > >> tst-spawn7.c:91: numeric comparison failure > >> left: 1 (0x1); from: WEXITSTATUS (status) > >> right: 0 (0x0); from: 0 > >> error: tst-spawn7.c:55: not true: sa.sa_handler == SIG_DFL > >> tst-spawn7.c:91: numeric comparison failure > >> left: 1 (0x1); from: WEXITSTATUS (status) > >> right: 0 (0x0); from: 0 > >> error: 4 test failures > >> FAIL: posix/tst-spawn7 > >> > >> with > >> > >> $ make check -j12 > >> > >> But it passes when I run it by hand. Is this expected? > > > > I see it as well, but it's not consistent for me, either. Could it be a > > make bug, leaking unusual handler dispositions in some cases? The test > > should probably check that the disposition are as expected at the start, > > and not incorrect to begin with. > > Right, it makes sense. I will add some improvement to have a consistent signal > handling disposition prior spawn the tests processes. In all cases, sa.sa_handler was SIG_IGN while SIG_DFL was expected.
On Feb 28 2023, Florian Weimer via Libc-alpha wrote: > Could it be a make bug, leaking unusual handler dispositions in some > cases? Don't use make 4.4, it's broken.
On Tue, Feb 28, 2023 at 1:19 PM Andreas Schwab <schwab@linux-m68k.org> wrote: > > On Feb 28 2023, Florian Weimer via Libc-alpha wrote: > > > Could it be a make bug, leaking unusual handler dispositions in some > > cases? > > Don't use make 4.4, it's broken. > I am using make 4.3 on Fedora 37.