Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1206175rwp; Thu, 13 Jul 2023 07:39:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlGOsn1lKV5qvKY7PRqJr3mFAMtHQqcCLtXxqGm6QyM8/IYcnr8nf+DenyeUDK80Pzovwe13 X-Received: by 2002:a17:90b:50b:b0:262:e801:740f with SMTP id r11-20020a17090b050b00b00262e801740fmr1087130pjz.38.1689259143078; Thu, 13 Jul 2023 07:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689259143; cv=none; d=google.com; s=arc-20160816; b=p4NfLA+QiZVKWGkxtuBZcSTVAuDM+pJ/5f076oIYM/cDuNRSB+TgVB51k0oD9KkqGr YGYzRr810dLlpmrq7l9mYzLCKIHR1F00sr542/Ay0kigoab8lbY6zrJzW3s0LFDKqErC HcNPobQCENtCWOGgTLtnJP4W6xwyeF/WKTwCVUNyRtDdZXExSUmBRtosVGHYaaI347cG CD+VHJRWeHc0GMbx/B9oaR378gIPoqx74RFSM++/1yVCS75F7qt6obyxWeeiAZdREuX9 qTYyjEPnlQiiAH+792Jr02EwX8f3Leb9pFRqqHYQA14MiC0CuGl8jeIktr2Ls3jmmjx6 VGQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xhhHhwn6da07jo2LaHjic4klLji04v84bJGgybaaPd4=; fh=hMkfdPT2djLLCunoR5racofbEaDHr6pm+ZAjzMKxMaw=; b=sYMSaDU/RYBV1+DcxSVakjllj2VVnXXe1N1qwSNFM5L/xDHT69O3NtHUHadKr3oDht cdh8MuJ77/wIC0+ksT80gPVXhpKIBtvWsBqHtbEMyV7E3DKmmHyHs4Z5hiD9NoZgfdyC Ju0znX5K+VFsy6daDEDXxzq3D+x/9NDIwQqrw+Gt/PzCSLtWmq0B0c/y3/xfgHgp4tLA eJ/fdcdmvPI55nFbzB3aCdTV1tCC5aJizxqDLcm7Nsj/wO7ONl2ZJZ6mNk46T1v/+UXb 0mdS0Xx94BBkk7dVUhxWofemdYIQ0JcswsN6Ma/1Z0UmidARz+3q25mlNVY4b34UUO5L pyDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=i4Nc2GOG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw9-20020a17090b4d0900b00263f4166a0asi5631665pjb.48.2023.07.13.07.38.50; Thu, 13 Jul 2023 07:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=i4Nc2GOG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234880AbjGMON0 (ORCPT + 99 others); Thu, 13 Jul 2023 10:13:26 -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: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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