Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1575840lqa; Mon, 29 Apr 2024 12:21:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFmrNK8IJrujUihD75mk9HwPakUHahxHfdCm7PCweWDmuNEfqbzwleM7922g4jljwZrZAqv0yrE2Q/s9BHerKeLld/xb2mhKNupS4JMg== X-Google-Smtp-Source: AGHT+IFXzuRqDy72sKZCkHpzXzT8Q5AauiF65HVt3det6jpqdUTfcVunycQPSCdqvZ+zeQRFhrve X-Received: by 2002:a17:903:2447:b0:1e4:17e4:3a1f with SMTP id l7-20020a170903244700b001e417e43a1fmr9941234pls.4.1714418502903; Mon, 29 Apr 2024 12:21:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714418502; cv=pass; d=google.com; s=arc-20160816; b=h+/yfAo64vQ3DJ/vZkTo6Uq51P+AO30Lo9QCzg2bfELxotyT4+tkDvvnPIALXt47t8 wkC8i9PA/ZG+22N2K6EtMbqMdSE7E9S3ylnyIDW+O/gp9nugac17z1wYDsWmljcTyDn6 8ki61uOY/DOgI82jFPlfJJgivI9P1YI6fPiloemBjknn2inWd8revSGspUpNuLm9X5eG +s7/ZaKu9ZnXi1Ni25lxV0tUtzSgLYtwX3kQW+/1kTYSbw2Cvm20cYGvHvgsB/KIz2Lw 8d1/vT03jIPWbJqmLjOMzHDl3T3IZnacgRK/vZo9UExJxTcbj69pSa9KZva5weOZFXpj siVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=r/QNVptq9v6/y2Jij7yjMhQq3atpg6wgAeLuIhmPC+M=; fh=g9UCkqlorEMA7uOOhHTqzi37EO3wzdGiXjygRVd3D9o=; b=wZTXzyZ4W7Wik/PvMdyYIijpPEovCMypsNm3GRvkBM/S6Nt5TOxNLMydWnlYvqf/0E DzPrescHSG6554jLXeWxP/3HGHEk1WSX/CuHuf0Hvz2Jc9l/y9wlrdUkxDkqOxzfYJ0X 3vtDovjSiZx612DKDxpxiiboUP9uMNf8Dh/KHlFQc5THBK8QI3N8a1XPFDUlzOAKChXc F2YiRliPJ4n244nzVTV1bOhPdW2rTqKcccnBuIg8bNNPrIN6e7X95y/mx9e4EkFqIYMf XvjTMNOVh054uCDQ5G7cvqIwsV2t7GQALrtvL68wpulB9AFGS4/jbgwVIwPwqHHvyuag MdGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=tKme2tLk; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162900-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i18-20020a170902cf1200b001eb66b69306si4435061plg.627.2024.04.29.12.21.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=tKme2tLk; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162900-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 27DBF2845F9 for ; Mon, 29 Apr 2024 19:19:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FF6F13BC07; Mon, 29 Apr 2024 19:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="tKme2tLk" Received: from smtp-42a9.mail.infomaniak.ch (smtp-42a9.mail.infomaniak.ch [84.16.66.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB92E12B73 for ; Mon, 29 Apr 2024 19:19:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418362; cv=none; b=SM8kku4F0oFQZGatmNE9qUeCLYrSDCv/Loxj8sU0POfFZsDlyPMC65PDq3XxSqtzG77pW3tu04DRbijHAvFGkihwKj7FCMQYjXsBYXFU1GeBj/Vges1do5atzReTvUTstMJhubf5z8/jE8slL8gZHUFoTDzbnLqm/DPEluVW+mk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418362; c=relaxed/simple; bh=/ygJnKJztnh5fVa7V7vlybwYZlMO/jDR2U0l0QOsKKE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SNOMaY5Ue5Rr11uG4+LoIVcBUzKcy6rZpGN/zbRZ/f1yTjimTlETrKtLmI/mlJeSq+n0EMqsqx71a0fJG63kpkGIZzsBPrlzxdWLDNXljUmIGBXxuk3TquWhqRdJFcwC2BGuJoenmou/TtmWRbo6ZgcvAMf4nS/mT65hrE3xqu4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=tKme2tLk; arc=none smtp.client-ip=84.16.66.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VStRj5CxHz5Qs; Mon, 29 Apr 2024 21:19:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714418353; bh=/ygJnKJztnh5fVa7V7vlybwYZlMO/jDR2U0l0QOsKKE=; h=From:To:Cc:Subject:Date:From; b=tKme2tLk2K+CR9K68vcxDPlsBhOggZDesHjGvGtpPIjVMY7E+1M1S56o0sSRcBmyf cyTtYHzP0SgYoN4KgU0WA5aH+f8dvBSXRqLpltJtEHpcHdoGmRzV7aKxIlLjnX2myx sUdy9lW0tbqNkBdDCAqQnMlQMuThLvaES/VhDAD0= Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4VStRj21f7zXdX; Mon, 29 Apr 2024 21:19:13 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Jakub Kicinski , Kees Cook , Mark Brown , Shengyu Li , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , "David S . Miller" , =?UTF-8?q?G=C3=BCnther=20Noack?= , Will Drewry , kernel test robot , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 0/9] Fix Kselftest's vfork() side effects Date: Mon, 29 Apr 2024 21:19:02 +0200 Message-ID: <20240429191911.2552580-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha Hi, As reported by Kernel Test Robot [1], some pidfd tests fail. This is due to the use of vfork() which introduced some side effects. Similarly, while making it more generic, a previous commit made some Landlock file system tests flaky, and subject to the host's file system mount configuration. This series fixes all these side effects by replacing vfork() with clone3() and CLONE_VFORK, which is cleaner (no arbitrary shared memory) and makes the Kselftest framework more robust. I tried different approaches and I found this one to be the cleaner and less invasive for current test cases. This third series replace improve the clone3_vfork() helper and add Reviewed-by tags. I successfully ran the following tests (using TEST_F and fork/clone/clone3) with this series: - landlock:fs_test - landlock:net_test - landlock:ptrace_test - move_mount_set_group:move_mount_set_group_test - net/af_unix:scm_pidfd - perf_events:remove_on_exec - pidfd:pidfd_getfd_test - pidfd:pidfd_setns_test - seccomp:seccomp_bpf - user_events:abi_test [1] https://lore.kernel.org/oe-lkp/202403291015.1fcfa957-oliver.sang@intel.com Previous versions: v1: https://lore.kernel.org/r/20240426172252.1862930-1-mic@digikod.net v2: https://lore.kernel.org/r/20240429130931.2394118-1-mic@digikod.net Regards, Mickaël Salaün (9): selftests/pidfd: Fix config for pidfd_setns_test selftests/landlock: Fix FS tests when run on a private mount point selftests/harness: Fix fixture teardown selftests/harness: Fix interleaved scheduling leading to race conditions selftests/landlock: Do not allocate memory in fixture data selftests/harness: Constify fixture variants selftests/pidfd: Fix wrong expectation selftests/harness: Share _metadata between forked processes selftests/harness: Fix vfork() side effects tools/testing/selftests/kselftest_harness.h | 113 +++++++++++++----- tools/testing/selftests/landlock/fs_test.c | 83 ++++++++----- tools/testing/selftests/pidfd/config | 2 + .../selftests/pidfd/pidfd_setns_test.c | 2 +- 4 files changed, 135 insertions(+), 65 deletions(-) base-commit: e67572cd2204894179d89bd7b984072f19313b03 -- 2.44.0