Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1602117rdb; Thu, 7 Dec 2023 04:06:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJIBP63+jNcPry2oNxiKsV2A9aw/shOaTBXELLN46CVFvq5HLjPYx38pvSwcDUcHwywjKG X-Received: by 2002:a05:6a20:e597:b0:18f:97c:8a3b with SMTP id ng23-20020a056a20e59700b0018f097c8a3bmr2226521pzb.102.1701950782896; Thu, 07 Dec 2023 04:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701950782; cv=none; d=google.com; s=arc-20160816; b=h1uSYRCJbBVTYfg4kOUluf2+MVOtt2ZTahdrg68ebFfKR+hA3KNvxJAYMkkJG8/MmD 2k7YzAnlaYcpbrClXOUku+RPvcRDW/lVbfi/zX9/rNY4DfIMXWg2CkxoxVcH29Vz/4ZV gg+HabA4miBaQs1z/9lJVBHE9U0vFQeOaEtxxu/SBFujkPB6SdaVQgQye76+w7WK0Vay 4ex0TWSIAk3m38Os+uYZ/LnN27FG8fYwTFAYhku6x9xmutD9V5WkW5UZ11HuSlTBfxrD xodXo9L9VOwjM8WyVTBUnvMjjlEJcsZmzXlih3YGDVCWF08egCgghhu5JiwkWfTh9fWF gKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=YztNyyLT9T8PeUHhm36EHNMC9OwgWapW+CJQNiPG0XA=; fh=e7IXwEi08zRI3kmprBRMAIBC0BDAGObX/F55gKMKnXg=; b=eBwmBk5VeMVg4rET+VioQrlBAmlUxuBPBDDmPl3xlSovndg5RqDeffqzgwHv6z3J1D PuDiulHc4V/2gsAj953uZi76oaBVjBCiQ505mmFnY4/995lUsLAKz8DL57KElHUOBZRd IKnZZ7CBj/CL6mC0mfWeBr4QQwZzcWRuSq9yib9AEZKFtR5aX8Pn3INk4Z/EFmwTfslK a/m1vgc5JAtYjA54fwaJ46cdJHPo4zwYLOL5LBjepQcwH/bS/qnySerIxhOEuJCjTlM9 p2xYkpvg3hSKkmsR4BLE0h0gsxFLPflQ0S6CnpsDagAM5LbyWgMR1Et9KKtZeGu2XkyQ K/1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="dnsN/Wrj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f7-20020a635547000000b005c1b303c414si1082367pgm.625.2023.12.07.04.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 04:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="dnsN/Wrj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id B0680802CF87; Thu, 7 Dec 2023 04:06:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232498AbjLGMGB (ORCPT + 99 others); Thu, 7 Dec 2023 07:06:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbjLGMF7 (ORCPT ); Thu, 7 Dec 2023 07:05:59 -0500 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48F3C13D; Thu, 7 Dec 2023 04:06:02 -0800 (PST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231207120600euoutp021afe78d5a88592cff751fe50e48c2acf~eizMME8tP1758317583euoutp02P; Thu, 7 Dec 2023 12:06:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231207120600euoutp021afe78d5a88592cff751fe50e48c2acf~eizMME8tP1758317583euoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701950760; bh=YztNyyLT9T8PeUHhm36EHNMC9OwgWapW+CJQNiPG0XA=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=dnsN/Wrj9y5g3QjtHKpnLFpa5Kpmnnpj6J2EoTIb2gs1UALBtvN3jhG82GcWWrFyw e7ZdkytaTXqMM6YxSdRn+xFym5dkZ2MKLkGcyVwJby0slU0pyIpaPcD3y/e2ngi9wl FnPMg4VsIGNg3J17wZPdCqjRJRyNFhXwEvmOIvtI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231207120600eucas1p10a7e2faac34b2d63bfa1e43024b941a7~eizL-Y5j_3104031040eucas1p1R; Thu, 7 Dec 2023 12:06:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A1.EF.09552.825B1756; Thu, 7 Dec 2023 12:06:00 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231207120559eucas1p221e7f8bcbd98f1083d17421761d60ad3~eizLlfbL21395513955eucas1p2z; Thu, 7 Dec 2023 12:05:59 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231207120559eusmtrp285b9ce79a9130a04491c0bc7a4e466f1~eizLk3k1d1641516415eusmtrp2y; Thu, 7 Dec 2023 12:05:59 +0000 (GMT) X-AuditID: cbfec7f5-853ff70000002550-6f-6571b52877f9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7F.1D.09274.725B1756; Thu, 7 Dec 2023 12:05:59 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231207120559eusmtip265ab489396f9b6d59930ab1ec282e370~eizLV32cQ0342503425eusmtip2R; Thu, 7 Dec 2023 12:05:59 +0000 (GMT) Received: from localhost (106.210.248.38) by CAMSVWEXC02.scsc.local (106.1.227.72) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Dec 2023 12:05:58 +0000 Date: Thu, 7 Dec 2023 13:05:57 +0100 From: Joel Granados To: Luis Chamberlain CC: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Kees Cook , "Gustavo A. R. Silva" , Iurii Zaikin , Greg Kroah-Hartman , , , Subject: Re: [PATCH v2 13/18] sysctl: move sysctl type to ctl_table_header Message-ID: <20231207120557.2om7knogbsu3cgrf@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="db4qfr2oz7c2s6rl" Content-Disposition: inline In-Reply-To: X-Originating-IP: [106.210.248.38] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (106.1.227.71) To CAMSVWEXC02.scsc.local (106.1.227.72) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJKsWRmVeSWpSXmKPExsWy7djPc7oaWwtTDX7fE7BoXryezeLXxWms Fme6cy327D3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biVd7b+nbqA09m1jmqPZzn/iC7c41W91tLtGseaY3Y+l6ok zPMSol8tWK8wLbp02QclluKMREMt5qLiRADhR7n6igMAAA== X-CMS-MailID: 20231207120559eucas1p221e7f8bcbd98f1083d17421761d60ad3 X-Msg-Generator: CA X-RootMTR: 20231205225020eucas1p2873217afd908334ba2669aad02b95cbb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231205225020eucas1p2873217afd908334ba2669aad02b95cbb References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> <20231204-const-sysctl-v2-13-7a5060b11447@weissschuh.net> <4a93cdb4-031c-4f77-8697-ce7fb42afa4a@t-8ch.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 07 Dec 2023 04:06:19 -0800 (PST) --db4qfr2oz7c2s6rl Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 05, 2023 at 02:50:01PM -0800, Luis Chamberlain wrote: > On Tue, Dec 5, 2023 at 2:41=E2=80=AFPM Thomas Wei=C3=9Fschuh wrote: > > > > On 2023-12-05 14:33:38-0800, Luis Chamberlain wrote: > > > On Mon, Dec 04, 2023 at 08:52:26AM +0100, Thomas Wei=C3=9Fschuh wrote: > > > > @@ -231,7 +231,8 @@ static int insert_header(struct ctl_dir *dir, s= truct ctl_table_header *header) > > > > return -EROFS; > > > > > > > > /* Am I creating a permanently empty directory? */ > > > > - if (sysctl_is_perm_empty_ctl_header(header)) { > > > > + if (header->ctl_table =3D=3D sysctl_mount_point || > > > > + sysctl_is_perm_empty_ctl_header(header)) { > > > > if (!RB_EMPTY_ROOT(&dir->root)) > > > > return -EINVAL; > > > > sysctl_set_perm_empty_ctl_header(dir_h); > > > > > > While you're at it. > > > > This hunk is completely gone in v3/the code that you merged. >=20 > It is worse in that it is not obvious: >=20 > + if (table =3D=3D sysctl_mount_point) > + sysctl_set_perm_empty_ctl_header(head); Notice that the test is done on the header and the set is done on the dir_h. I mention this because here you wrote: "sysctl_set_perm_empty_ctl_header(head)" instead of "sysctl_set_perm_empty_ctl_header(dir_h)" dir_h and head are different. Was this your concern? or did I miss your point? >=20 > > Which kind of unsafety do you envision here? >=20 > Making the code obvious during patch review hy this is needed / > special, and if we special case this, why not remove enum, and make it > specific to only that one table. The catch is that it is not > immediately obvious that we actually call > sysctl_set_perm_empty_ctl_header() in other places, and it begs the > question if this can be cleaned up somehow. >=20 > Luis --=20 Joel Granados --db4qfr2oz7c2s6rl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmVxtSQACgkQupfNUreW QU+dkgv+IVdWMcibpYRbbXQoIvmp+lnMk4qkm9BsJi0/8ejv4NT5T9fFzk8Y4dYA 5hWIk9KWoG4qSBgQKOhaOv79mDsScZr4rv0PsEAYbK/ZKppmAKW3Pm2Ex6OBNyv2 BneQ8Coci9h1sWUQkoiX7+NgCQczzi6TgRpRtucbFoN+BIkYklcrwyZszBkiX6jW dt50vOI1NGKqpu6GSZ2F22d+V58BBS7QmOmK1LRlTmPut/t5dJOfN/5d9JNNxIyJ O8aSQ0iDXCH4E6qiZV5qC+aJBldu8T0gynVXDg/IoPInwr8d10kD5JEjxbgXo/Ey s/aFB0qBToVQqK8xAG7T6p99QB1uIyQfBC/d9YRDhGTYiAXxYrfyc0cIFmQJ9AES s9hh8ZVw0OLcg6lRycWfYv8eiqGYVKf5XOMsxHW+d1k5X9/L+Oxn9KCVc7bU2kez hgqI3A3mvjW9ppDOq7CFsTH82CVZAHxNGXWBEETxCOu3q6OAGJXReXAqQEzna61A Q1NQcRWM =ca10 -----END PGP SIGNATURE----- --db4qfr2oz7c2s6rl--