Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1370453lqa; Mon, 29 Apr 2024 06:52:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6MsOVUWfb0aOvMgb0zxYCktrqaObt3mtRQCO03djCsOEuAX9kavAQ56OvV9hBSL0JaeSJaHCsk4VFEiZi83Jusw6NSG+Df8BlDd7RZw== X-Google-Smtp-Source: AGHT+IE8Ntrp7pCTaHjw6PEVTEcZjpLJRMBdF8L+ZDaQYDvBCg4BJoW1cpPKf9gTN421QP3jArZE X-Received: by 2002:a05:6870:3845:b0:234:2553:7bbf with SMTP id z5-20020a056870384500b0023425537bbfmr10068565oal.43.1714398778914; Mon, 29 Apr 2024 06:52:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714398778; cv=pass; d=google.com; s=arc-20160816; b=OcMeCzZJvUDcLg3XE1iFBzLlvahZQ1ZS2ERKsb3bFJrGIvUOWf/AXj+JyxF4DtXtSJ FVKWZTGYiAJ8JYbanRErSULdLMUD7pZkyMAZALc0N9e0ootNSMJ4rqRkFM9VEjYPRjOS mh0AUd0Bts+tNpeIF0JYdJQ/1zvx4mth/DKUq5ueAFaQtCHIGeUjsH1u68stct1k9SFY HrmNqToAg4nrRVCfGCcTYJ+aFyzchxKOzwj/7evVqMGsd8agPzv37QwDqId5Re4JOIze y2azB+ltOOQzD+/1bwZRBiPIbd7x+tSK4aK0rA1hCgZ+X3U4J32vobYDGbj/SB0b//cN R6YA== 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=fxKlg/iA5h3Am5sQv1ft8xfF0xrEfKre7R75HOynExA=; fh=g9UCkqlorEMA7uOOhHTqzi37EO3wzdGiXjygRVd3D9o=; b=d3gcz/9ew30SmtVmjQzpc1d+cNbGoQieatMU8VEJgbonVeNBaJxSneCTrdby9QT4n7 lFjpHgTrqIUrAkMhwfRJFOC7nJQEQoDQH47oCxmGohumSML62LqWx8odRUUF2J2kjpjE 682ifHSEj2QorrR03yFqQtV1FJEgfGBLsEroQci1TN5i32nv0fqruYnq4nhOn4ItECLZ C6FYifIuttyw+PO4BfNEvPzbUiThTFLQI7u2Tk4qN7exsgFAix1Qf7sDH5PYIKTNM0Z1 gmB3zPWI9TI/6YKHC9pgqQJjoUX4k7yNJrIwzRM79hPPSttjIAtdpaB8t/qS8yDQ3TMx vf/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="vd/U/wPA"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162347-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m19-20020a638c13000000b005feabd8ca71si14172332pgd.554.2024.04.29.06.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="vd/U/wPA"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162347-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E9E21B29844 for ; Mon, 29 Apr 2024 13:15:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9049C54917; Mon, 29 Apr 2024 13:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="vd/U/wPA" Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [185.125.25.8]) (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 4CDC853E08 for ; Mon, 29 Apr 2024 13:15:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396548; cv=none; b=YyZJXspcV2H/qMRnXT9+vFf5ZacRLcC9doPBLTV29dWAirutsEOh7KFhpmyk2ZbeLeAvEKeX3IZiL1FPr7GXJ494sGgg7GKEzO7KtJ0Rk3K/FjCXtsaYlXz+00WDfZId2peNSVp42OG8n8Z2UGIXz4n7NuegH7/LhklwqI3uwbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396548; c=relaxed/simple; bh=+mGGfv+rNyQbPZbgK4ev9Hsh3jIoZFvo3k1FnAnnDJ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=KI0zzRyG1YvJhGpnKrW4lzuwFf36j1cB5dcyrryDicVLQ6GPS3xf0xgGJ0EMQzM4e/mzZbin2MAQ8i4Py5tyLkl7FX/8nzZMNoMTq5bwACp0uMNtBL9Ygnq2SMb48IOTkuBTRfuLUawR7YnYaMh/ckz6MtP9ahYDQtWUTOO+HkY= 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=vd/U/wPA; arc=none smtp.client-ip=185.125.25.8 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-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VSkFF53VWzLTD; Mon, 29 Apr 2024 15:09:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714396177; bh=+mGGfv+rNyQbPZbgK4ev9Hsh3jIoZFvo3k1FnAnnDJ8=; h=From:To:Cc:Subject:Date:From; b=vd/U/wPAQJbV8RNav7swjB+xojeIfqXA8MfCiEX9qgLcgqFEfB0gogoIoMLGFtrOt ezZVXEpQ4Js1Ktt1iU0YGGT6TknNJTv7TD8qJMp4wuqDmLnqrKdhYInwrWK49L9Ygb TPwxWGPpcnCFN5AIsVusx2TKST1TyEkFvI+xBYOo= Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VSkFD3SZczdD1; Mon, 29 Apr 2024 15:09:36 +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 v2 0/5] Fix Kselftest's vfork() side effects Date: Mon, 29 Apr 2024 15:09:22 +0200 Message-ID: <20240429130931.2394118-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 second series split the latest patch into 5 patches. 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 version: v1: https://lore.kernel.org/r/20240426172252.1862930-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