From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id 8269E3858D33 for ; Tue, 28 Feb 2023 16:34:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8269E3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-536bbef1c5eso288363477b3.9 for ; Tue, 28 Feb 2023 08:34:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=V09xOEbddoxYvMd9YuvTXnl1Ct5jKAhc37z8aJlBICg=; b=TYmy2qnRqKsjJfh9BlVsp+nDHvp+3QascTmrCcA2zc65mRRq3Q2iRg/PMD1VtS4LKp bhE0IMpYJ+rXMAfiwhbMYQoqb1eJx1KeCecw8crIlILvnkFJ3AW4Yw3G/+1/I7QfcSXo pytyJnD9I4OXKlyoJwcnRCfZLm7O++NA5NDvV3IhDjHG5d+Gn11KH6F22Rd7UX3wWgSE 1hyrJzDVrXIRBMcknnH3Kb7MvKtqVN4r+HzmAHzmTC/pNlwGGHtTn10KwuLT7EN5orF0 Ly7EdCkkYDt6jliwmAgWp3IQaprR41D7mPmH7Bc/oxXqDduB/e1dbAjoeoRKExhIN5W2 BoMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V09xOEbddoxYvMd9YuvTXnl1Ct5jKAhc37z8aJlBICg=; b=bdNuE33T/At6aw5Wr7HHF8Bh4TJK5u134ZoF2fztVp2nUmdaPGkwBDKihmNXnWKpEP 8DQG3AFQCuMXBKvIzgD2rZc8JtmdphVaemDxFRlTtRJZU7Pv+4TEuRb4B9pLCPpd+vhe iJdNKzldLTLDrqtxWCX1BaycMJ5RMR2b0l8mByOfoXN2xi6IXTR8FKC9L9vViMFwKOho lVTiQJcJ6HJICUx0j6O2yvbM5Prz0aRa4yMC34m5yDYQM3yOh5yhWob8sYGiYylfy6bk 8RoL+cjQikaoKEQ58gMOi7Yn8PFBibQwTeHvxj4Ivu3CyAtmEski16QLyMsJ/cC2Lm7v MvZw== X-Gm-Message-State: AO0yUKXAv2zvhrZStxNV6GeZYvc27r0gblKTAgDqvk2xBXoX/8CeLvrC KCfSYiYEhjfOY4uTJoalJte7axe0W64zcATWpvg= X-Google-Smtp-Source: AK7set9yQLSJktu+MxW9x/XHUJhySQaxjB32aqb0NDFDjdFAnZeMEPZZZ3R2HXyILEX6WZ+sBAYzXgdGNcTZs/mwl8o= X-Received: by 2002:a81:ae24:0:b0:52e:b48f:7349 with SMTP id m36-20020a81ae24000000b0052eb48f7349mr706809ywh.6.1677602075833; Tue, 28 Feb 2023 08:34:35 -0800 (PST) MIME-Version: 1.0 References: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> In-Reply-To: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> From: "H.J. Lu" Date: Tue, 28 Feb 2023 08:34:00 -0800 Message-ID: Subject: Re: [PATCH v4 0/6] Optimize posix_spawn signal setup with clone3 To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, "Carlos O'Donell" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3015.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On Thu, Jan 12, 2023 at 5:59 AM Adhemerval Zanella via Libc-alpha 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? -- H.J.