Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1413144lqm; Thu, 2 May 2024 14:10:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+7FdCzyH1lHYEk0SaArlMPj7j0ZyAgp8h52rhz/GaXsf/Yf+dd3thKSjT2hj9rkOOOFBeErtIce+yDcG+CpDvkx/9TSkmPJFLMHXOEA== X-Google-Smtp-Source: AGHT+IF4FlrzbzHxLk3UpSWlOM6KBV3AGEulaFZxiVKMuRlvG+vXCcKK1cZH20H+s7X3jNrQTUDL X-Received: by 2002:a17:906:fa0c:b0:a59:7540:3d68 with SMTP id lo12-20020a170906fa0c00b00a5975403d68mr359857ejb.23.1714684217726; Thu, 02 May 2024 14:10:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714684217; cv=pass; d=google.com; s=arc-20160816; b=xuS6KmobUpFmbNw9GCDA6H0/mDj59PDumIISTHqh6G6FjuqnAulROTy+fWJPOj+uLL Tl9omRkbCOOZlA/wb3o30AZwVHAmzv1cu+QBvTUJbACkf4bIhs6+OSn6FYOPeTmQ/WQp 6MsF2wCkTTX2x19jUr+Dmzo3oarJ0jw8eFH6evDB78BZ22rsfUggojwGKTj2I0F5VULS I8wQKixf+WJam9bUSuPJ5C6mDvbrF/ERbAs5Iq/mCn1ThKd/KPxV31TL5MvQnmtASLdH C2KDriwFVG6WUCIasUHLRFGtm7ZwvfltGiMOKjoFuLeIWgVp/knyHZJJwO303prhKXEN Gbdg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ULuIPoLTaCiiQDgrgwiUNErNKxiwC2PSDtrsw7y14Ko=; fh=DyJwEPHty4QZ77xuwgmyonrTSVvlIRI2bkR/2kTqG9Q=; b=oyQj4YhsH2mrzwOeEJ8SiN6vqugMZr5qj5KasS2RBpDHpVR4tyuJZui7I3on9hkbDg C3l6ZxPTi/mwqHxhG5IoTX4X52NKI1fqa1isqnpOtWX5leGa5QGYeLFS5Mk9rkWIq+b9 rhIYi+d0d5HETMpvWR2au3GB5f23nxM196nKg1/yR5py7QPEA1YQch9it303ZiJulidz d5l5Gy53Ppas49UPhasIdKnAqLVSrJzZctJG9/i2vyAIS/NePGz3QdeP/1izw76WsRuK OWMAEPQpXI2qW3iKKD1wb5avenRsQuo0kTM6YXsIF2GhKMEzgdytmMnw2W6KzEDMThpF Ai+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=SDPWZaAp; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-166914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166914-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f13-20020a170906ef0d00b00a4a347e0896si874983ejs.1024.2024.05.02.14.10.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=SDPWZaAp; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-166914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166914-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 766EB1F22AD5 for ; Thu, 2 May 2024 21:10:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF22B181314; Thu, 2 May 2024 21:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="SDPWZaAp" Received: from smtp-42ae.mail.infomaniak.ch (smtp-42ae.mail.infomaniak.ch [84.16.66.174]) (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 C6341180A81 for ; Thu, 2 May 2024 21:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714684188; cv=none; b=CIXjlPiYxn3W6Y9JUHtTh/9E6r3y3++cS9NTpl6fAHFNNeUqOgsKNcxD7WNtW8OC/ovZr3RWh1lqbycmjGSoFfOPHRj9FyXVbcs1is5KxtpHUYOFgyqnEPRwpPJW8X+os4H9kLCcIi8OpFW3fn2wXkrOncdH2/Y36H3qb64hft0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714684188; c=relaxed/simple; bh=f/p1tOYqxe+c3NIjeiRTNzU4W1mMlKeloFw4NDWiog8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CWAqcGKOHtDJT43jcIGdxYoeiR51e+6lnOv7VXJVKeCS321S83MWJWG1RnBjag4vZVNcX5BRPEJFnOZ9Yqc0t+VotQHuN8N+cq4lmMtnZVMlnD3a28O7bU8Wqt7sJf6s2sdXL2K5YgCtn0LYihfBKpuZv35/KAEwkYaX8barN54= 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=SDPWZaAp; arc=none smtp.client-ip=84.16.66.174 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 4VVmlj5Qd9zKC9; Thu, 2 May 2024 23:09:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714684177; bh=f/p1tOYqxe+c3NIjeiRTNzU4W1mMlKeloFw4NDWiog8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDPWZaApk+TnghGGtnoL1SCVBkxYtTcyjZoa+3Lub7Ksb3aoZsVd84y/xUQDtlDYT VUsSTffM6hlnlO5Sg34eTga9pENM0ccsXB6jURu0T1jRMh1olGvkDxfBlgTm6i+F/c LpTpE2b6dpbzq45jQbyvfk+Jye528zAQf4U6oOpU= Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VVmlj1XQ7zYJX; Thu, 2 May 2024 23:09:37 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Jakub Kicinski , Kees Cook , Mark Brown , Sean Christopherson , 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 , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan Subject: [PATCH v4 02/10] selftests/landlock: Fix FS tests when run on a private mount point Date: Thu, 2 May 2024 23:09:18 +0200 Message-ID: <20240502210926.145539-3-mic@digikod.net> In-Reply-To: <20240502210926.145539-1-mic@digikod.net> References: <20240502210926.145539-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 According to the test environment, the mount point of the test's working directory may be shared or not, which changes the visibility of the nested "tmp" mount point for the test's parent process calling umount("tmp"). This was spotted while running tests in containers [1], where mount points are private. Cc: Günther Noack Cc: Shuah Khan Link: https://github.com/landlock-lsm/landlock-test-tools/pull/4 [1] Fixes: 41cca0542d7c ("selftests/harness: Fix TEST_F()'s vfork handling") Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240502210926.145539-3-mic@digikod.net --- Changes since v1: * Update commit description. --- tools/testing/selftests/landlock/fs_test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index 9a6036fbf289..46b9effd53e4 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -293,7 +293,15 @@ static void prepare_layout(struct __test_metadata *const _metadata) static void cleanup_layout(struct __test_metadata *const _metadata) { set_cap(_metadata, CAP_SYS_ADMIN); - EXPECT_EQ(0, umount(TMP_DIR)); + if (umount(TMP_DIR)) { + /* + * According to the test environment, the mount point of the + * current directory may be shared or not, which changes the + * visibility of the nested TMP_DIR mount point for the test's + * parent process doing this cleanup. + */ + ASSERT_EQ(EINVAL, errno); + } clear_cap(_metadata, CAP_SYS_ADMIN); EXPECT_EQ(0, remove_path(TMP_DIR)); } -- 2.45.0