Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1458479lqa; Mon, 29 Apr 2024 09:01:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuu8jLEeC9AB6vd6xA5s7duxl3cfkgfU1VcdLGFa8ffnGAFpx+FVzzIxc9L7hyd8YFlK99n3BMQ3TQ/7eN+8AWR9Kv65pYYf8BxDPvEQ== X-Google-Smtp-Source: AGHT+IH5IsPL8b2vsn39G/2WNShCJ/TVnNIwYaR9omYai8qKFxJAdtCGyrd8nIcJ1nCtbo2iffMh X-Received: by 2002:a17:902:ecc4:b0:1e5:9da5:a799 with SMTP id a4-20020a170902ecc400b001e59da5a799mr14150256plh.6.1714406472528; Mon, 29 Apr 2024 09:01:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714406472; cv=pass; d=google.com; s=arc-20160816; b=aUwc+Ij7uncDnFUNBMYWAp9qKjqjrMdUOCKntxFK1GTOWUXX5PxwqnskdTu8Xa3i42 hUtI8GGQiKzOVvXc09y4awh4fjBY+9K8iyw/mj6uNXhGcwMmIt7oTSudSwIRX2u/KJnq V6JHJT7Jzp5Osg22+v3Pcbj+P5Gvo+7lLVujDTIKunCHKv/nZ8LqPnDJlrzHrwNaJr84 66ZGmrx8no9NhcqCZ6/GFFJT+2qE0ftBfyTE798m1POklTYt5zvJCDAC6hsWog2ICAe8 TZczc6KWrQ5dgn8j/VNoQEEzx95z++BTGNwMbTelNVnmF9W9a2F9cOl0P61LTZO13itT +hIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LXesceeVx7eAybXSMHvtACUpIAJaYRLCSDSMv3aiI6Y=; fh=cbcvDM9d6BzTTo8d0+S6BgvEwEAokpKseNe5b3HMtvQ=; b=aO9oqgEqL7nPXP345ZgpdJlnNNaThKC/g6ISpEkDZodHVA9c3LljSxyJAk8mHQSeLp MDSA07dFxPqqg8u2UxTWEMGgvbMMhx6QKtkHA3th2weFZGIB4h+IlBx3U3lU+kmBZIQF ZFq0zFdrra0xQuTU4JmZhJTX1M7Hf+f3VMtTKt7St9OWUJGafaj/roNFQv+K4zIWKoHf G0mb+IBILWIDrrqSfFzUUBsMWAJyObeOv+y/FvyQJDZju/GT05VjgDz72uM/jR6h2YYP vI30Dgeu0N196S6szLvaJy/WIucDEK2rxks4fpiZnMZfTNmOHz+zR/OCWggsHuyEeDHT S+Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ii8sjjsx; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162634-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j5-20020a17090276c500b001eb30bf744bsi4984493plt.429.2024.04.29.09.01.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 09:01:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162634-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=@chromium.org header.s=google header.b=ii8sjjsx; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-162634-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 562D4284A8C for ; Mon, 29 Apr 2024 15:59:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBD948615C; Mon, 29 Apr 2024 15:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ii8sjjsx" Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A08E18614D for ; Mon, 29 Apr 2024 15:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714406282; cv=none; b=Ig7M5O7TSBot+DbHkOakzRE1XF7ObCx/qSEkiUXTunlU7PQRqq01FlWpnWUrKSpzvn9VYS99HvWhS4Cb/QnJTEwSWREgqAr2HTEWOm1tp/mU26TVTlELa/owIO7MwSjtHD/xc+dTqUTALGKFs3TYsDvINmz4rW7uuYynCg/1bUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714406282; c=relaxed/simple; bh=elJxk/k9sqYtC/MCZ2vFryQvPeupAL5xKULnIW6JfRU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C88dzaQRUlO5Ha2+Z9ySLesC44d02YKFqcUiUaqXWfi6fnIjXUIOEgBNi1boNNkVzX61zpuDozPcNqrsCiH0rRflzSKN1CBiXyPh8/7zDgecZ8Cm/3jI6EHiy28H4mnD1al1ABS+Dkh4AG6O3OLOGxJjXIWDnyhJuQTK5I34iho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ii8sjjsx; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5c229dabbb6so2977131a12.0 for ; Mon, 29 Apr 2024 08:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714406280; x=1715011080; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=LXesceeVx7eAybXSMHvtACUpIAJaYRLCSDSMv3aiI6Y=; b=ii8sjjsxUUoI7UJi0f+z1jQ/aZRF88qHkGEXQDr+zAffx5BYMijcwiwyB4dFA0o9wm 6jjVzaDFx9TOAQ+f33y8SRxnklbiFS9I6WS3Ia0t0CUD50obUEwy7AsguDN3iTo446so TJ1y09rTSRdkD/nIXBLNDyJ2XAji/yACrcxFg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714406280; x=1715011080; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LXesceeVx7eAybXSMHvtACUpIAJaYRLCSDSMv3aiI6Y=; b=CfNmI4GDz4/JIh2O9cfrSd0vjgGUaDWFvUusGMS7G+y1BLB91HrZUHQ/t9oZ3cIGOn pzGIfRVY/3IwcDpZzb6/ec8xiatDl1p4d0pf45aQ2uUdDcwCKTYIq/VS+FObHZK5d2Sb v7vtoX6QDSI4AmRHBHh6JsbumrAeiR5qATWpNxcsKKaf4n4Si2iWVbFuYX8rXX0XFj1O NzEljwl7nPOYgHPB0bBjPs+KLEv2cuGTQ5PbU6e61ZqeGGgOik4bu1r9rsLlT1bdA7/l M6zoRdH7yv2/AnV1DJzWvtN/73HPH9bZhBNP2DwCH/MEzoqavig/emAgWOiOOSZKZyGU i+zQ== X-Forwarded-Encrypted: i=1; AJvYcCWo8N/QwERzb2ib7NPA7nhq66RQqx2/CogMNsckAv0lVaDABN2X4xqRvoeDs6REjIbjbrU7kUOjgGR+JhgU8MPn4mwhsxAHabOb86hi X-Gm-Message-State: AOJu0Yy337wsHCWldJUIrQEL85R60gmK+kzNclyJmoamniVYRfMt3jDW nixUkTgQwAP2hAOXHlldo0GGsopZ8cxNYryVe8Du+7KLbAWOL0YTwiD0bPqQeQ== X-Received: by 2002:a05:6300:808d:b0:1a7:6262:1dd1 with SMTP id ap13-20020a056300808d00b001a762621dd1mr9709716pzc.51.1714406279974; Mon, 29 Apr 2024 08:57:59 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id m19-20020aa78a13000000b006e697bd5285sm19380439pfa.203.2024.04.29.08.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:57:59 -0700 (PDT) Date: Mon, 29 Apr 2024 08:57:58 -0700 From: Kees Cook To: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Cc: Christian Brauner , Jakub Kicinski , Mark Brown , Shengyu Li , Shuah Khan , "David S . Miller" , =?iso-8859-1?Q?G=FCnther?= Noack , Will Drewry , kernel test robot , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 9/9] selftests/harness: Fix vfork() side effects Message-ID: <202404290857.4BEAF6D55@keescook> References: <20240429130931.2394118-1-mic@digikod.net> <20240429130931.2394118-10-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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240429130931.2394118-10-mic@digikod.net> On Mon, Apr 29, 2024 at 03:09:31PM +0200, Micka?l Sala?n wrote: > Setting the time namespace with CLONE_NEWTIME returns -EUSERS if the > calling thread shares memory with another thread (because of the shared > vDSO), which is the case when it is created with vfork(). > > Fix pidfd_setns_test by replacing test harness's vfork() call with a > clone3() call with CLONE_VFORK, and an explicit sharing of the > _metadata and self objects. > > Replace _metadata->teardown_parent with a new FIXTURE_TEARDOWN_PARENT() > helper that can replace FIXTURE_TEARDOWN(). This is a cleaner approach > and it enables to selectively share the fixture data between the child > process running tests and the parent process running the fixture > teardown. This also avoids updating several tests to not rely on the > self object's copy-on-write property (e.g. storing the returned value of > a fork() call). > > Cc: Christian Brauner > Cc: David S. Miller > Cc: G?nther Noack > Cc: Jakub Kicinski > Cc: Kees Cook > Cc: Mark Brown > Cc: Shuah Khan > Cc: Will Drewry > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202403291015.1fcfa957-oliver.sang@intel.com > Fixes: 0710a1a73fb4 ("selftests/harness: Merge TEST_F_FORK() into TEST_F()") > Signed-off-by: Micka?l Sala?n Thanks for splitting these up! I found it much more digestible. :) Reviewed-by: Kees Cook -- Kees Cook