From patchwork Mon Feb 7 17:44:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 50868 Return-Path: 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 9BF78385841A for ; Mon, 7 Feb 2022 17:44:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BF78385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644255897; bh=ytFAlFwFntgEq5XsTCVBFHSpTKaErnMQUbq2JyTuqgA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Mfvc0byvCBhISgDcp/6YrmdW+olqFuSHshRJJHHLno+2W4KKYTB8UgGMbIW9NQS+5 gmso1aRWxXH6YCig3J30hHxPbIp7p3GgjQNuwRiKFs6ZKCEx/PYtCcctzo80XrEbyK 7tJ5CtIyswRLgMGlSHNbxbLgUmy48YWOJpc853DI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id B50993858C83 for ; Mon, 7 Feb 2022 17:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B50993858C83 Received: by mail-oi1-x232.google.com with SMTP id s24so10156970oic.6 for ; Mon, 07 Feb 2022 09:44:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ytFAlFwFntgEq5XsTCVBFHSpTKaErnMQUbq2JyTuqgA=; b=JZaDkTcGnOMFG72/S1a1rB3u0dW2QDSm9LhWav9BVU+odbYEFVhs3K1F47Qlz2v0Gk nRqVD8oFKOmmuoXwi1fWRuEBtMbj+jutcnU+oMPGTqO0s3hNxg31JxH4uxTqAB4T2r+1 ukn75LcOXxEXjRy5xE2gpL5lotvSI1HyRL7sL6Q1ggJ26/7ZgE1JNXzYf4DgiSS4wXkr 44Hm5ZfklXlyx1GibJNCaGnYTvZUJ9Cle2GOK7FosJ11mpCg0jIv/gNvsrIN9kEGltAq 2ZuQLVTQXFvc6hsMbhfXuR/rxfGJclVdVryMulz9SNPTSioV3X6fu6gviWIYM09CkB0Z LFpw== X-Gm-Message-State: AOAM532D1v+Nnh8vBTsoMcPmkZVhrxtHTARjeWHAInjvIP9Aq22xbZmN 6EO5KXPAn8qRwQyTf01iY0m6ly2vQh7Tzw== X-Google-Smtp-Source: ABdhPJyoxTWaE5IG0Q2jiUVeg6NNq+dGMsKiwgk7upV3KvNH3Kf6pb2j2f+tDGGl2hZlqCr026JScA== X-Received: by 2002:a05:6808:1645:: with SMTP id az5mr2070oib.313.1644255875868; Mon, 07 Feb 2022 09:44:35 -0800 (PST) Received: from birita.. ([2804:431:c7ca:733:4cdc:e08a:54c6:5108]) by smtp.gmail.com with ESMTPSA id l22sm4270334otj.44.2022.02.07.09.44.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 09:44:35 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2 00/15] linux: Add new syscalls Date: Mon, 7 Feb 2022 14:44:16 -0300 Message-Id: <20220207174431.360355-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.8 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, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This patchset adds two sets of Linux syscalls: the pidfd and the new mount API. The pidfd support was initially added with clone3 when used with CLONE_PIDFD to return a file file descriptor referring to the child process. This set adds the missing pidfd_open (added on Linux 5.3), pidfd_getfd (Linux 5.6), and pidfd_send_signal (Linux 5.1), along with P_PIDFD flag use along waitid. These newer syscalls allows race free process signaling by avoiding the PID reuse. Along with pidfd, two new syscalls are also added: process_madvise and process_mrelease. Both uses the pidfd to add a way to interact with target memory, former acts as posix_madvise for target process and later allows the caller to handle target memory cleanup at process exit. The second set is the new mount API added Linux 5.2, which adds six syscalls: fsopen, fsmount, move_mount, fsconfig, fspick, and open_tree. It also adds mount_setattr which was added on Linux 5.12. This is complete redesign of the mount API to allow more flexibility with mount points, specially when used along namespaces. Adhemerval Zanella (15): linux: Add pidfd_open linux: Add pidfd_getfd linux: Add pidfd_send_signal linux: Add P_PIDFD linux: Add tst-pidfd.c linux: Add process_madvise linux: Add process_mrelease linux: Add fsopen linux: Add fsmount linux: Add move_mount linux: Add fsconfig linux: Add fspick linux: Add open_tree linux: Add tst-mount to check for Linux new mount API linux: Add mount_setattr NEWS | 14 +- bits/mman_ext.h | 21 +++ misc/sys/mman.h | 3 + posix/Makefile | 2 +- posix/sys/wait.h | 7 +- sysdeps/generic/libc.abilist | 1 + sysdeps/mach/hurd/bits/types/idtype_t.h | 12 ++ sysdeps/unix/sysv/linux/Makefile | 27 ++- sysdeps/unix/sysv/linux/Versions | 14 ++ sysdeps/unix/sysv/linux/aarch64/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/alpha/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/arc/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/arm/be/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/arm/le/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/bits/mman_ext.h | 35 ++++ sysdeps/unix/sysv/linux/bits/types/idtype_t.h | 14 ++ sysdeps/unix/sysv/linux/csky/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/hppa/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/i386/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/ia64/libc.abilist | 12 ++ .../sysv/linux/m68k/coldfire/libc.abilist | 12 ++ .../unix/sysv/linux/m68k/m680x0/libc.abilist | 12 ++ .../sysv/linux/microblaze/be/libc.abilist | 12 ++ .../sysv/linux/microblaze/le/libc.abilist | 12 ++ .../sysv/linux/mips/mips32/fpu/libc.abilist | 12 ++ .../sysv/linux/mips/mips32/nofpu/libc.abilist | 12 ++ .../sysv/linux/mips/mips64/n32/libc.abilist | 12 ++ .../sysv/linux/mips/mips64/n64/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/nios2/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/or1k/libc.abilist | 12 ++ .../linux/powerpc/powerpc32/fpu/libc.abilist | 12 ++ .../powerpc/powerpc32/nofpu/libc.abilist | 12 ++ .../linux/powerpc/powerpc64/be/libc.abilist | 12 ++ .../linux/powerpc/powerpc64/le/libc.abilist | 12 ++ .../unix/sysv/linux/riscv/rv32/libc.abilist | 12 ++ .../unix/sysv/linux/riscv/rv64/libc.abilist | 12 ++ .../unix/sysv/linux/s390/s390-32/libc.abilist | 12 ++ .../unix/sysv/linux/s390/s390-64/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/sh/be/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/sh/le/libc.abilist | 12 ++ .../sysv/linux/sparc/sparc32/libc.abilist | 12 ++ .../sysv/linux/sparc/sparc64/libc.abilist | 12 ++ sysdeps/unix/sysv/linux/sys/mount.h | 115 ++++++++++++ sysdeps/unix/sysv/linux/sys/pidfd.h | 49 +++++ sysdeps/unix/sysv/linux/syscalls.list | 12 ++ sysdeps/unix/sysv/linux/tst-mount-consts.py | 61 +++++++ sysdeps/unix/sysv/linux/tst-mount.c | 119 ++++++++++++ sysdeps/unix/sysv/linux/tst-pidfd-consts.py | 49 +++++ sysdeps/unix/sysv/linux/tst-pidfd.c | 170 ++++++++++++++++++ sysdeps/unix/sysv/linux/tst-process_madvise.c | 107 +++++++++++ .../unix/sysv/linux/tst-process_mrelease.c | 72 ++++++++ .../unix/sysv/linux/x86_64/64/libc.abilist | 12 ++ .../unix/sysv/linux/x86_64/x32/libc.abilist | 12 ++ 53 files changed, 1291 insertions(+), 9 deletions(-) create mode 100644 bits/mman_ext.h create mode 100644 sysdeps/mach/hurd/bits/types/idtype_t.h create mode 100644 sysdeps/unix/sysv/linux/bits/mman_ext.h create mode 100644 sysdeps/unix/sysv/linux/bits/types/idtype_t.h create mode 100644 sysdeps/unix/sysv/linux/sys/pidfd.h create mode 100755 sysdeps/unix/sysv/linux/tst-mount-consts.py create mode 100644 sysdeps/unix/sysv/linux/tst-mount.c create mode 100644 sysdeps/unix/sysv/linux/tst-pidfd-consts.py create mode 100644 sysdeps/unix/sysv/linux/tst-pidfd.c create mode 100644 sysdeps/unix/sysv/linux/tst-process_madvise.c create mode 100644 sysdeps/unix/sysv/linux/tst-process_mrelease.c