Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp126375lqg; Fri, 26 Apr 2024 10:28:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrKjXdyt1wTE2WNxHiHIZhOSitN+HuV7etI+DABBT/ZcWxo9nUzxQQczel3w2VapLoghqa1B8a04MwnYY59f9mT6MgYr5Y2YvWO3cing== X-Google-Smtp-Source: AGHT+IE1cvC0tR0jm9z9C1bp695xjq94tbFYNkwueKgUp1v9a+WBN30nQDdlL/HBAs0bIkGCQM8y X-Received: by 2002:a05:6358:5694:b0:18a:b820:40e2 with SMTP id o20-20020a056358569400b0018ab82040e2mr192039rwf.13.1714152535096; Fri, 26 Apr 2024 10:28:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714152535; cv=pass; d=google.com; s=arc-20160816; b=CXaKxzw3fJ0sCRUwstGJLPG+6bTGfSFhk8WdshJd2IzKYWttX74Y51NJRM1IREPSos 2Yz0V/Uq3aGm8odOXV9LePeXZAD+2bZLcTEaQS0N5j3p3g/3cCXY4GYHZUW9NZ337obz QBFyjFq9Ufsq5Cm5/7jeYPgSHUPp24FE5Mw8Jhx4iItPIScxHLKhoUzMkQICjsCh20h6 oK106ToTxAo3Scp9Nv3gBiY3FG5Xw/PFhH1I0FSpK3/vGFYoyOEtyZUUmnr0yysBeCr/ 6c66/fqo9yechkxlXPxWJfMqBwo2ICwcBS/V1GYZGzjTsaL2JbYZbaPWg4/OOMptWzNn K8Jg== 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=AmGun+tMYT547if+yUT7k5hmlNgmA7z/Bkr8Q2AHI6Y=; fh=g9UCkqlorEMA7uOOhHTqzi37EO3wzdGiXjygRVd3D9o=; b=nPLEUihc4OYNOSvtfmhdUou6uexvmNO5XmLd+/R7160IT6hUWXPAhyvHdqbGb9Kwo4 myjJiexXaPB3X1N5OHrIRBBCwre8ByF7/eM3TklLtL35rixw39QyHMVFOBNCuKNbJNQ7 5pvKyKcwTknoDsICA2EISpMfaVGkl113RnPa18Gdcmt3wHIB6fIY8czvHQMmjLpOAVfX 9ZHonY5TyFO71fYVEj+a6Xddhc3hErXlJ5Uah7Hx9AQfC1DSCvgyixI/R1OLUNCDhb8t NL6Kdz7tRUJITVvb30mRJPk/EqN0HZZTRUOjsQE3ZGmthfXPDJu+S3x3vG7MinBCpz8t slFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="b5brXSr/"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-160482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160482-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 l9-20020a05622a050900b00439726879b9si15778471qtx.37.2024.04.26.10.28.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 10:28:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160482-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="b5brXSr/"; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-160482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160482-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 CC31C1C20311 for ; Fri, 26 Apr 2024 17:28:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2601C16DEA3; Fri, 26 Apr 2024 17:23:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="b5brXSr/" Received: from smtp-190c.mail.infomaniak.ch (smtp-190c.mail.infomaniak.ch [185.125.25.12]) (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 CD40915B579 for ; Fri, 26 Apr 2024 17:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152198; cv=none; b=CUx7FHcWM8L6flsXSxpMLrl+wuK4E5aOJrglNZgo55O+jAv1FeTaJotwF8updVYEhtwvBnPc2fciSbhqWvkesE/faesifn3vQPjIhAjxuJK3r1JYm9tF8KFm/ldgOjm4lfi1I2hnF8tq/1JS5yBdzzi23zFlYO5eLKkDARsqZBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714152198; c=relaxed/simple; bh=6kRuOtJ4a93MXDCwtzvP1VdtvY2kl4/ucaoZA2ZyQwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lc0MLLyTNe4h8NeDCFZ8MC+4ZWHPhzc9KIhEF8oDLLltZJlBFYDidZ0nUBb7MbzvStDDOYNBqhE1h+ZCBCAM4IFI+z6zQ5DYWFfXI3V4M3NaF3j3WkG5KblZhqssQbfQuNVCK7g9jGJMP3r70RieTCjNBx42yUrIRfUlHHApBS8= 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=b5brXSr/; arc=none smtp.client-ip=185.125.25.12 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-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VR01625gfzVFG; Fri, 26 Apr 2024 19:23:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714152186; bh=6kRuOtJ4a93MXDCwtzvP1VdtvY2kl4/ucaoZA2ZyQwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5brXSr/ayXj1jxkxMnO/ban2apbqGPXZGnhyjDGWltc9xixX/hbl2lO891HwPkLS ccZSTRqsUl4IDTS8VMnIpn9sdePz/T7iJ0V2bwHMBEsfimRZLrZ492bWldGsXOa5gw k18BGvGa1prg06wt4moxAesuZk7X4nne4B3LlAbA= Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4VR0155F9lz4b8; Fri, 26 Apr 2024 19:23:05 +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 v1 2/5] selftests/landlock: Fix FS tests when run on a private mount point Date: Fri, 26 Apr 2024 19:22:49 +0200 Message-ID: <20240426172252.1862930-3-mic@digikod.net> In-Reply-To: <20240426172252.1862930-1-mic@digikod.net> References: <20240426172252.1862930-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 on different Linux distributions, with different mount point configurations. Cc: Günther Noack Fixes: 41cca0542d7c ("selftests/harness: Fix TEST_F()'s vfork handling") Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240426172252.1862930-3-mic@digikod.net --- 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.44.0