From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id A6BCF3858D33 for ; Tue, 28 Feb 2023 17:11:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6BCF3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22c.google.com with SMTP id t22so8579228oiw.12 for ; Tue, 28 Feb 2023 09:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677604313; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=X++9J0vYQtAWPWmfcwOV04OqbgVf2CSyWuR3XlIzDTw=; b=pJPihKlxOXWVKsD3nkVlmgGcazR0y/hLvXK8rCAeT4cXSkt0fliqjtpMCCMs3ECjo1 KJ0lrUpk5gmcqHRlGOOl2hmzs3MZOSO3ryEXLN0Tgelq7HaGsa4UPXm3OiWwg87oe0Md cu7zGyWOA4F9S14nS33EUpNr3BQscCRQ1JoZHx4OL2Jbn0Qv8tLVvU/vU2vSnLLonfI/ bbUoJnEzzwieuMIbqZWcJ0MOvL7gbZyKTNQkTgWfOtXc95yAWwvzgX7mUP0OhF4xZpTo PPOphaosiXQbNeuFnEmjX2htm+2/HU3FPjcPQoXd61q8agzHGdpfICvbjzqvxpSYYZkJ VVDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677604313; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X++9J0vYQtAWPWmfcwOV04OqbgVf2CSyWuR3XlIzDTw=; b=4XauvCsvO+S72JP3ls2/Qw/IeGpRPogak6FKHp6xeVokSG7/wuthopH1nAl4GikbYH HOo86k05h7wUt8Kn24J4Y+TY9Yp31WatbhXDKqEP36SY15J/yBcDFXjQ/CwIgWZXsx9w pbXJhfXIs11uuiIHnbxLdQKofXVH9JjjzkvP2Wqvja+b4zc229fzg2L2kXR1Wd3pzlQE KNURS4HGH8NUgPiJ3o1gQwVmwXMrc1ivuWHocZpJl9iDsTrqARzjQI/Rzp31T16RPI77 mLcV456QJjnru0UqGWBJMXfjEDAQbdKu5VhFg8OPVHg9hpy7dLaOHZXklEVaXmDsRuz/ VpKg== X-Gm-Message-State: AO0yUKVNgP6/Lzbz5le/uIf+YCg6pptxE6xA5V2T1Q8kEOIpIH21wQmN CChSDIF/+DfNIQ9R8g20fw3skQ== X-Google-Smtp-Source: AK7set9Adq8JdehNefQuJgCwZ8VBT1My0PgDqzl2vNZH4mdhkUtGJIh9//n9tayZIBwfISLAlSBNCw== X-Received: by 2002:aca:2818:0:b0:384:3e58:6728 with SMTP id 24-20020aca2818000000b003843e586728mr1775209oix.50.1677604312828; Tue, 28 Feb 2023 09:11:52 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c3:d849:1526:5720:5f77:6ab6? ([2804:1b3:a7c3:d849:1526:5720:5f77:6ab6]) by smtp.gmail.com with ESMTPSA id q36-20020a056808202400b0037d8148cf04sm4530782oiw.46.2023.02.28.09.11.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Feb 2023 09:11:52 -0800 (PST) Message-ID: <6ddd0eb4-2175-fe0c-f2de-47a191715292@linaro.org> Date: Tue, 28 Feb 2023 14:11:49 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4 0/6] Optimize posix_spawn signal setup with clone3 Content-Language: en-US To: "H.J. Lu" Cc: libc-alpha@sourceware.org, Carlos O'Donell References: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,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 28/02/23 13:34, H.J. Lu wrote: > 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? > 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?