From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC52DC00528 for ; Thu, 13 Jul 2023 14:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234886AbjGMON1 (ORCPT ); Thu, 13 Jul 2023 10:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbjGMONX (ORCPT ); Thu, 13 Jul 2023 10:13:23 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C892D47; Thu, 13 Jul 2023 07:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1689257564; bh=qZgsVhnTtsEJGDdMA3cJGw+neVfrXoMO8XmxTUb5MDc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i4Nc2GOG0+wNZt3ZVaDZ57KSOpB7PHoTDDjspb65sFMBRb2wvJqs+k22H3sClMuO/ iguarEuNyCwmbYFHBf6QNHbz/Hndw0vr4hlP6yMJldtsRgxmMn4//xj357jeGCMG8T ErDIYGIiOV52nOMc1GCGWP6TJHrRqld8QR/zQTB4= Date: Thu, 13 Jul 2023 16:12:43 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Aleksa Sarai Cc: Christian Brauner , Willy Tarreau , Shuah Khan , Andrew Morton , Dave Chinner , xu xin , Al Viro , Stefan Roesch , Zhihao Cheng , "Liam R. Howlett" , Janis Danisevskis , Kees Cook , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] procfs: block chmod on /proc/thread-self/comm Message-ID: <01abc05f-07ac-484d-90af-73b3e6ca7c83@t-8ch.de> References: <20230713-unerschrocken-kutschieren-9be3c8958b5d@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-07-14 00:00:51+1000, Aleksa Sarai wrote: > On 2023-07-13, Christian Brauner wrote: > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > > > index 486334981e60..08f0969208eb 100644 > > > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > > > @@ -580,6 +580,10 @@ int run_syscall(int min, int max) > > > > CASE_TEST(chmod_net); EXPECT_SYSZR(proc, chmod("/proc/self/net", 0555)); break; > > > > CASE_TEST(chmod_self); EXPECT_SYSER(proc, chmod("/proc/self", 0555), -1, EPERM); break; > > > > CASE_TEST(chown_self); EXPECT_SYSER(proc, chown("/proc/self", 0, 0), -1, EPERM); break; > > > > + CASE_TEST(chmod_self_comm); EXPECT_SYSER(proc, chmod("/proc/self/comm", 0777), -1, EPERM); break; > > > > + CASE_TEST(chmod_tid_comm); EXPECT_SYSER(proc, chmod("/proc/thread-self/comm", 0777), -1, EPERM); break; > > > > + CASE_TEST(chmod_self_environ);EXPECT_SYSER(proc, chmod("/proc/self/environ", 0777), -1, EPERM); break; > > > > + CASE_TEST(chmod_tid_environ); EXPECT_SYSER(proc, chmod("/proc/thread-self/environ", 0777), -1, EPERM); break; > > > > > > > > I'm not a big fan of this, it abuses the nolibc testsuite to test core > > > kernel functionality. > > > > Yes, this should be dropped. > > We need a minimal patch to fix this. This just makes backporting harder > > and any test doesn't need to be backported. > > Alright, I'll drop it in v2 (though I'm not sure why there are tests for > /proc/self and /proc/self/net then). To test the functionality of the implementations of chown() and chmod() in nolibc. procfs is used used as a test fixture to provide diverse file and directories that are (nearly) always available. The system under test is nolibc, not the kernel itself. Thomas