Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp19277lqh; Mon, 6 May 2024 09:56:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJN3hX87YDKes1dlsxHUBTo7Lige+9eCn2He4j45matmSur1WZsPUL4gmBw/nb1WMlk26HdHrfsErg8e2qISrhaG17y28BY02RSt4vuw== X-Google-Smtp-Source: AGHT+IFGWz0HqneYfavckA7wZnKFTWbrL1+paXBDAZRUpk+VXEJXDcQjYUnxi/6WpKKWaLFLLZy1 X-Received: by 2002:a05:6808:bc7:b0:3c9:6bd8:d500 with SMTP id o7-20020a0568080bc700b003c96bd8d500mr4984735oik.50.1715014598499; Mon, 06 May 2024 09:56:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715014598; cv=pass; d=google.com; s=arc-20160816; b=iOZQV9iwZ7VllrskM7wBZKZsIo0vilb2k2fTMyKYWt5gft6qF+SMIeahF24tN/Dpp8 Og3oHcAiqfEdBh8nTUxGCq80O6sxjyLCZaFsyR1k8HNeQa4iUNedxpsH5vxbftpOKAek 3sSHJWVeATr3eUA+z825gOsw2cclfGes9R59AXXpTRbNVluQU2zhBSOFQpudx7UQajZW 4FZYXrC18C5dFXvawXz9r0lqiPLjXRgCTxsoz+9SBF+Sg3abysE3WXvq5kc26Zdzy3Sa CMWtThZ9toucdIXN+zi5KUX1WbZUZdHLZNLfT63rvTZ6aFi2zfdctz4jytftATojnG/o wr/w== 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=EsLlpJdb+ipe4wojLuPN37Zys5w8rmjcLAZMf9ipyIs=; fh=h2xHIZSGiUwuZyladnT9pE6uX086qy42ByZk41PjzSs=; b=j7S4qL2KpTH0u/5Wvd2hZh3Qil1aEioM+lgGkxrqbXHxZgU4wLBeRdLY8MLrncyvhG 0plTeVfwcqDhhWvtaVhrPbSU9Y9RsqtLhZpGI3qxUh3xZWVwtw8oycWN8WkEdaFTzNwl uz3p8/hEblbzcsn6n2mXlPAD7Xzjvqr4Xpg5eXbdILbf7bWCsDMbTQkAt3c7oris0214 FFtrPBk6O9EcOhL/ocDRSUEJ7RS7aOwrGnZQtkWhNw7QWkj6dyrcym9EWVXPRhNRuJMO jRzYnJimtswK509GSFSPST/ifjN8oP4r6pwpkbv8JhxieDPFcaTNoW2bldLSXjrzQ2Ld y+5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=Lgb5I+d0; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-170201-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170201-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bp31-20020a05622a1b9f00b0043a07ff4e99si10030070qtb.157.2024.05.06.09.56.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170201-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=Lgb5I+d0; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-170201-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170201-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 38F071C21282 for ; Mon, 6 May 2024 16:56:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11358158D8C; Mon, 6 May 2024 16:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="Lgb5I+d0" Received: from smtp-190e.mail.infomaniak.ch (smtp-190e.mail.infomaniak.ch [185.125.25.14]) (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 57574157499; Mon, 6 May 2024 16:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014535; cv=none; b=oWaFzLfDjMFWh4y/rLyFWtefOnZW5LEm5z9gvOzgozEaash/uApsMNi9FBtbpumGd53FU3U6DGvPzaoam+YyiXpS+2ZUJkmcKhQPrvxFHRkVRLYa+SJPALTzf1cfScxDVZ6oehqKyRuu7M4kG/21w1J3SiawKeEKeosTiTZwNRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014535; c=relaxed/simple; bh=JPA1fOZ/TX0peHJB7KO41oFcLeZ7LaXWPj+Nzss7qbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A6VYn45nLDBlmjc8s2gKfnGNhwCoyPFF9ZAt+Q5g7oSYjgCv6HZjZPutnys0vx7M03P4xg+l+O7OYyp3DjHRUcQ1HQ60p0ZcOzFIeDvsMKOEB0fPZpe0pPu9uirUgZlqLJCNVyrZ7SX2FDs+REc5PxM6hobamJQb1dcB/TMnilY= 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=Lgb5I+d0; arc=none smtp.client-ip=185.125.25.14 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 4VY6wY5rqXz1Fk; Mon, 6 May 2024 18:55:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1715014525; bh=JPA1fOZ/TX0peHJB7KO41oFcLeZ7LaXWPj+Nzss7qbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lgb5I+d0VxsIAbFEmVXHDVGGkFweKwCSHMITrUzR2VCSUhUbUVVlK3ipGN4KXJpoj XlDeOotxMMhB7sEV80vDlVVCmuy51vcKDVpwfKsgY6H4H7e2pmrepQZfK7gi5j1Kpd aVLlmq3roA+RwrwxiT4o7QUveKAFEVn2MgXjs2M4= Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VY6wX7241z4kq; Mon, 6 May 2024 18:55:24 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Greg Kroah-Hartman , Jakub Kicinski , Kees Cook , Linus Torvalds , Mark Brown , Sasha Levin , Sean Christopherson , Shengyu Li , Shuah Khan , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Bagas Sanjaya , Brendan Higgins , David Gow , "David S . Miller" , Florian Fainelli , =?UTF-8?q?G=C3=BCnther=20Noack?= , Jon Hunter , Ron Economos , Ronald Warsow , Stephen Rothwell , Will Drewry , kernel test robot , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v6 02/10] selftests/landlock: Fix FS tests when run on a private mount point Date: Mon, 6 May 2024 18:55:10 +0200 Message-ID: <20240506165518.474504-3-mic@digikod.net> In-Reply-To: <20240506165518.474504-1-mic@digikod.net> References: <20240506165518.474504-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/20240506165518.474504-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