From patchwork Thu Feb 3 17:46:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 50728 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 C4D963858410 for ; Thu, 3 Feb 2022 17:47:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4D963858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643910422; bh=eoJoC+qzDMxJicEV2mQ8wiUxLgsveRAn6VQcW1wjoCg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Y0cxDGqD9nHyiJ27rLttrdFAZGREh9HwujU5uTIb3+8SZJu5Vg3Elmd00yZcJzIgy 5VmBANC3Uzk2pdzkFUvZJUCkuX8KVF1l716o8r/+pYbUibOtGZOoAqfspHnz4X/cwi 7brSD4MPFjdVC/2T8cGo8r4PrFZc6eLuKOxyQppY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by sourceware.org (Postfix) with ESMTPS id D6A1A3858406 for ; Thu, 3 Feb 2022 17:46:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D6A1A3858406 Received: by mail-ua1-x932.google.com with SMTP id r8so6695210uaj.0 for ; Thu, 03 Feb 2022 09:46:39 -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=eoJoC+qzDMxJicEV2mQ8wiUxLgsveRAn6VQcW1wjoCg=; b=LnAXWoH21NshISXSyTkpGiDOw9lgGVCyG350i8yWQ5W0OD7cefPgNWB6rm7lD3iBEa ztYRl7dW/4TOPHAe/KX7iW+Ni4+BCCFO/9uMi5z3yG1D4dSbyRZhJ3NWuDbb0LRFNNj5 gkIwezaOuMn/kjQLgU5o6MdPNyVJkkkpOzNHJbP/VybuyeYcbnkb/0TQBHX9FlH/WzAF zuBOYPgwgkq2W/V6qao7KClKb5O4031Z0v23OySXms//3759hkB1gUKcHLto+5abUGpa PK9ALDrDR37S46RwYBj44fkQif/aFw2wh9IcIEBLLivkBXfy2iwghpGz86VL8mgyRNh0 q/TA== X-Gm-Message-State: AOAM531TjJdtVekciHIol3pw4UjULH3fWlSUIf08FqJbGdCud5MpF3gC JwViuigJI5ZKWXKrlcPzpMIYgr1hI/vxHw== X-Google-Smtp-Source: ABdhPJzbXx8ooR7reRJmTtehhuaewiNkk0bKqb1xPTkH4h/EqGEz+s69AkS5md25R0SMzzhYhuFOOA== X-Received: by 2002:a67:c10f:: with SMTP id d15mr14162304vsj.45.1643910398451; Thu, 03 Feb 2022 09:46:38 -0800 (PST) Received: from birita.. ([2804:431:c7ca:709a:22aa:9542:591f:6eb9]) by smtp.gmail.com with ESMTPSA id m25sm7294887uaq.3.2022.02.03.09.46.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 09:46:37 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 00/15] linux: Add new syscalls Date: Thu, 3 Feb 2022 14:46:19 -0300 Message-Id: <20220203174634.3474775-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.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, 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 new Linux syscalls: the pidfd extra syscalls and the new mount API. The pifd was initially added clone3 when issue 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 definition to be used along waitid. These newer syscalls now allows a 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 pifd to add a way to interact with target memory, former being a remove posix_madvise call and later allowing the caller to handle target the memory cleanup. The second set is the new mount API added Linux 5.2, which adds new 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 | 55 ++++++ sysdeps/unix/sysv/linux/tst-mount.c | 119 ++++++++++++ sysdeps/unix/sysv/linux/tst-pidfd-consts.py | 42 +++++ 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, 1278 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