Message ID | 20210706145839.1658623-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 92136388F020 for <patchwork@sourceware.org>; Tue, 6 Jul 2021 15:10:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92136388F020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625584256; bh=4R0N/hHFBNGY14Bz5EVltkPRFZ+l94KUou/SMiEt7EQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AdoqRCdj9Y+dzNhxKiA01LdbHIaVlgk7uJKenzBAkly1gBa4sEVjRmf6/L3urSD/M ZB2Z3aPvrQCrPm66alNtezYFE2rDzS5hH+/nRLUHXx0tqC4shXwm5HUZxoXh7dEC0q HjgwdAseByjmJe+WlPqjz1T0SsQODE2nlTiZupHc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id E4D85388F010 for <libc-alpha@sourceware.org>; Tue, 6 Jul 2021 14:58:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4D85388F010 Received: by mail-pg1-x52a.google.com with SMTP id h4so21632870pgp.5 for <libc-alpha@sourceware.org>; Tue, 06 Jul 2021 07:58:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=4R0N/hHFBNGY14Bz5EVltkPRFZ+l94KUou/SMiEt7EQ=; b=fwwrMHosZbBSBT+AtwbFyw2PAH2xFI3/QYdacf4GqHudDu/S1fEuaffAuSy1mGQKtW B9jFf7xfHan364gUPsgFVywFQ5R7UX6AwIQ1kTSb54zkn3MVTq42ft12zFlsHSk+0y3J ZiW5g3dmH1QSF5PDO3ElMR05eVFRk6zpiVNjl5e8WjYL4k7/TX7Fvj+fTmpCC7Nofj1r xzJDf5xKKdmg9vPAY9fr8mPUcrpPPD0J8biEobG6f/jOzwqFdfaWCZJcntHi/o9xvV7B 2B28stHRlQi/C85jPpyX9WMfJuRKbTEWr3MSa0WqxZEJs/LROMXGfA3Pir9kTMEExraI miIA== X-Gm-Message-State: AOAM531yBHZErrn3V5Jt47HbR159KSWN+OAABPhjIcrYKtLtdtC5BsKY vCh+Z2i+L3G7qxLCOvLypv1TWsDIajSWvw== X-Google-Smtp-Source: ABdhPJzsyWgc34/jfwfQQcruxmkT+2+YGgtksr3wjqUO6obaYEtQRxd2Vg2x5Z7Byx5x8SFGVZLPcA== X-Received: by 2002:a62:8802:0:b029:323:605d:8f3a with SMTP id l2-20020a6288020000b0290323605d8f3amr3543142pfd.20.1625583524732; Tue, 06 Jul 2021 07:58:44 -0700 (PDT) Received: from birita.. ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id n23sm19018488pgv.76.2021.07.06.07.58.43 for <libc-alpha@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 07:58:44 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v7 0/4] Add close_range, closefrom, and posix_spawn_file_actions_closefrom_np Date: Tue, 6 Jul 2021 11:58:35 -0300 Message-Id: <20210706145839.1658623-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 |
Add close_range, closefrom, and posix_spawn_file_actions_closefrom_np
|
|
Message
Adhemerval Zanella
July 6, 2021, 2:58 p.m. UTC
Linux v5.9 added a new close_range syscall, which allows the caller to issue the kernel to close or set close-on-exec on a range of file descriptors. This patchset export the syscall along with two GNU extensions: closefrom, with similar semantics from other systems ((Solaris, OpenBSD, NetBSD, FreeBSD); and posix_spawn_file_actions_closefrom_np, which allows use close_range semantic on posix_spawn(). The first patch is libsupport one for the tests. The second patch adds the Linux specific close_range syscall. The third adds the GNU extension closefrom(), which use close_range() if available. The firth adds the posix_spawn extension. Adhemerval Zanella (4): support: Add support_stack_alloc linux: Add close_range io: Add closefrom [BZ #10353] posix: Add posix_spawn_file_actions_addclosefrom_np NEWS | 12 + include/bits/unistd_ext.h | 6 + include/unistd.h | 1 + io/Makefile | 4 +- io/Versions | 3 + io/closefrom.c | 34 ++ io/tst-closefrom.c | 152 +++++++++ manual/llio.texi | 59 ++++ posix/Makefile | 4 +- posix/Versions | 1 + posix/spawn.h | 8 + posix/spawn_faction_addclosefrom.c | 57 ++++ posix/spawn_faction_destroy.c | 1 + posix/spawn_int.h | 6 + posix/tst-spawn5.c | 284 ++++++++++++++++ posix/unistd.h | 6 + support/Makefile | 1 + support/support.h | 19 ++ support/support_stack_alloc.c | 79 +++++ support/xsigstack.c | 43 +-- sysdeps/generic/spawn_int_def.h | 24 ++ sysdeps/mach/hurd/i386/libc.abilist | 2 + sysdeps/mach/hurd/spawni.c | 4 + sysdeps/posix/spawni.c | 4 + sysdeps/unix/sysv/linux/Makefile | 6 +- sysdeps/unix/sysv/linux/Versions | 1 + sysdeps/unix/sysv/linux/aarch64/libc.abilist | 3 + sysdeps/unix/sysv/linux/alpha/libc.abilist | 3 + sysdeps/unix/sysv/linux/arc/libc.abilist | 3 + sysdeps/unix/sysv/linux/arm/be/libc.abilist | 3 + sysdeps/unix/sysv/linux/arm/le/libc.abilist | 3 + sysdeps/unix/sysv/linux/bits/unistd_ext.h | 22 ++ sysdeps/unix/sysv/linux/closefrom.c | 36 +++ sysdeps/unix/sysv/linux/closefrom_fallback.c | 99 ++++++ sysdeps/unix/sysv/linux/csky/libc.abilist | 3 + sysdeps/unix/sysv/linux/hppa/libc.abilist | 3 + sysdeps/unix/sysv/linux/i386/libc.abilist | 3 + sysdeps/unix/sysv/linux/ia64/libc.abilist | 3 + .../sysv/linux/m68k/coldfire/libc.abilist | 3 + .../unix/sysv/linux/m68k/m680x0/libc.abilist | 3 + .../sysv/linux/microblaze/be/libc.abilist | 3 + .../sysv/linux/microblaze/le/libc.abilist | 3 + .../sysv/linux/mips/mips32/fpu/libc.abilist | 3 + .../sysv/linux/mips/mips32/nofpu/libc.abilist | 3 + .../sysv/linux/mips/mips64/n32/libc.abilist | 3 + .../sysv/linux/mips/mips64/n64/libc.abilist | 3 + sysdeps/unix/sysv/linux/nios2/libc.abilist | 3 + .../linux/powerpc/powerpc32/fpu/libc.abilist | 3 + .../powerpc/powerpc32/nofpu/libc.abilist | 3 + .../linux/powerpc/powerpc64/be/libc.abilist | 3 + .../linux/powerpc/powerpc64/le/libc.abilist | 3 + .../unix/sysv/linux/riscv/rv32/libc.abilist | 3 + .../unix/sysv/linux/riscv/rv64/libc.abilist | 3 + .../unix/sysv/linux/s390/s390-32/libc.abilist | 3 + .../unix/sysv/linux/s390/s390-64/libc.abilist | 3 + sysdeps/unix/sysv/linux/sh/be/libc.abilist | 3 + sysdeps/unix/sysv/linux/sh/le/libc.abilist | 3 + .../sysv/linux/sparc/sparc32/libc.abilist | 3 + .../sysv/linux/sparc/sparc64/libc.abilist | 3 + sysdeps/unix/sysv/linux/spawn_int_def.h | 25 ++ sysdeps/unix/sysv/linux/spawni.c | 34 +- sysdeps/unix/sysv/linux/syscalls.list | 1 + sysdeps/unix/sysv/linux/tst-close_range.c | 303 ++++++++++++++++++ .../unix/sysv/linux/x86_64/64/libc.abilist | 3 + .../unix/sysv/linux/x86_64/x32/libc.abilist | 3 + 65 files changed, 1380 insertions(+), 57 deletions(-) create mode 100644 include/bits/unistd_ext.h create mode 100644 io/closefrom.c create mode 100644 io/tst-closefrom.c create mode 100644 posix/spawn_faction_addclosefrom.c create mode 100644 posix/tst-spawn5.c create mode 100644 support/support_stack_alloc.c create mode 100644 sysdeps/generic/spawn_int_def.h create mode 100644 sysdeps/unix/sysv/linux/closefrom.c create mode 100644 sysdeps/unix/sysv/linux/closefrom_fallback.c create mode 100644 sysdeps/unix/sysv/linux/spawn_int_def.h create mode 100644 sysdeps/unix/sysv/linux/tst-close_range.c
Comments
My 32-bit trybot detected a regresion on i686[*] https://www.delorie.com/trybots/32bit/2424.html NONE -> FAIL : misc/tst-close_range Is this expected? [*] well, x86_64 with -m32
On 06/07/2021 16:28, DJ Delorie wrote: > > My 32-bit trybot detected a regresion on i686[*] > > https://www.delorie.com/trybots/32bit/2424.html > NONE -> FAIL : misc/tst-close_range > > Is this expected? > > [*] well, x86_64 with -m32 > Not really, I will take a took. Do we have the .out output somewhere?
On 06/07/2021 16:33, Adhemerval Zanella wrote: > > > On 06/07/2021 16:28, DJ Delorie wrote: >> >> My 32-bit trybot detected a regresion on i686[*] >> >> https://www.delorie.com/trybots/32bit/2424.html >> NONE -> FAIL : misc/tst-close_range >> >> Is this expected? >> >> [*] well, x86_64 with -m32 >> > > Not really, I will take a took. Do we have the .out output somewhere? > How the trybot handles UNSUPPORTED (exit status 77)? On kernel older than 5.9 the test will fail with: i686-linux-gnu$ make test t=misc/tst-close_range [...] UNSUPPORTED: misc/tst-close_range original exit status 77 error: ../sysdeps/unix/sysv/linux/tst-close_range.c:60: close_range not supported [...] Maybe is it the case? I have tested on both x86_64 and i686 with on both kernel 5.11 and 4.15 and on 4.15 the test does show UNSUPPORTED.
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> Not really, I will take a took. Do we have the .out output somewhere?
Yet another thing to try to scrape out of the test container before
throwing it away...
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > How the trybot handles UNSUPPORTED (exit status 77)? On kernel older than > 5.9 the test will fail with: It only reports tests that differ from the baseline (pre-patch) and report "FAIL". In theory, UNSUPPORTED should be unreported. The trybot runs 5.8.15-301.fc33.x86_64
On 06/07/2021 16:47, DJ Delorie wrote: > Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: >> How the trybot handles UNSUPPORTED (exit status 77)? On kernel older than >> 5.9 the test will fail with: > > It only reports tests that differ from the baseline (pre-patch) and > report "FAIL". In theory, UNSUPPORTED should be unreported. > > The trybot runs 5.8.15-301.fc33.x86_64 I ran the testcase on the exactly same kernel: [azanella@localhost i686-linux-gnu]$ uname -a Linux localhost.localdomain 5.8.15-301.fc33.x86_64 #1 SMP Thu Oct 15 16:58:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux [azanella@localhost i686-linux-gnu]$ ./testrun.sh misc/tst-close_range error: ../sysdeps/unix/sysv/linux/tst-close_range.c:60: close_range not supported [azanella@localhost i686-linux-gnu]$ echo $? 77 This is expected output for a kernel older than 5.9. Maybe something wrong on how the trybot handles newer UNSUPPORTED?
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > I ran the testcase on the exactly same kernel: > > [azanella@localhost i686-linux-gnu]$ uname -a > Linux localhost.localdomain 5.8.15-301.fc33.x86_64 #1 SMP Thu Oct 15 16:58:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux > [azanella@localhost i686-linux-gnu]$ ./testrun.sh misc/tst-close_range > error: ../sysdeps/unix/sysv/linux/tst-close_range.c:60: close_range not supported > [azanella@localhost i686-linux-gnu]$ echo $? > 77 > > This is expected output for a kernel older than 5.9. Maybe something > wrong on how the trybot handles newer UNSUPPORTED? Dunno, this is all new stuff ;-) I'm doing a non-container build of that tree to see what happens. The container has the fedora-latest image but runs on whatever kernel is running on the host. The trybot just looks at the *.sum files.
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > This is expected output for a kernel older than 5.9. Maybe something > wrong on how the trybot handles newer UNSUPPORTED? A non-container build returns UNSUPPORTED. A repeat container build returns FAIL. misc/tst-close_range.out is: https://www.delorie.com/trybots/32bit/2424.tst-close_range.out
On 06/07/2021 18:33, DJ Delorie wrote: > Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: >> This is expected output for a kernel older than 5.9. Maybe something >> wrong on how the trybot handles newer UNSUPPORTED? > > A non-container build returns UNSUPPORTED. A repeat container build > returns FAIL. > > misc/tst-close_range.out is: > https://www.delorie.com/trybots/32bit/2424.tst-close_range.out > This really seems the old issue when runtime syscall filter returns EPERM instead of ENOSYS for non supported or filtered syscall (specially because you are running on a 5.8 kernel).
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > This really seems the old issue when runtime syscall filter returns EPERM > instead of ENOSYS for non supported or filtered syscall (specially because > you are running on a 5.8 kernel). Yup, that sounds like a container-specific bug! Thanks for looking into this. From my point of view, "it's not the trybot" is enough of a resolution for me ;-)