Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp611895rdb; Tue, 5 Dec 2023 14:51:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeYKYspqx6SfLaDEMeDWj4kLMuKOIvIcqWHwbeA8if9/P89UOASubF8G++jr0Zi5+yUjms X-Received: by 2002:a17:903:2442:b0:1d0:6ffd:9df4 with SMTP id l2-20020a170903244200b001d06ffd9df4mr7577452pls.70.1701816666074; Tue, 05 Dec 2023 14:51:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701816666; cv=none; d=google.com; s=arc-20160816; b=Kv+iwCwmx1RbB4o547xiZucgoTQ90AfHlKJCkbabM8SaOKm74HY84Q/EmlYFIYypH4 v+19uHZtqM3uJPgebDasf6xsc9q8Fxwfmgi1Jy2Q2nnOyLcikwaX1sofwHUOCGYig7lb FJ/4YMW+yslhElAVvYlwk+RCodwj/Sdo9b3s1IreBwKo6/bcZnj7yAAOjCcSkN3hfCwO G3UgzTWxv7Ab5bO4dxtafxr+j2sgI7M/FXzsnia5cRLaXGEYx8zr/tk/NpVgTICTkrFj gY3abzkh7/cowo4lVD5xcu1LD3r40qU3pn3xQWDguvPTJbUZ9eGwEXcLJiaYX0neLuxf coCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=8oOYDVF0a06xhChagz+OQUTSt0lKKWcbOnknwZNj5do=; fh=MPunnn7khqOkt3fg9uc675QcYdcfNn3sB5Xyf6+lqC0=; b=kznjDuJnL3TGqAYKxz42nQ4JKiOjNRzIxK2lR7hnXflZovlzSwNUWnyBCvNQ5yLE2G isoQ0cTszANqSU2Pa8jB6x0LQV+LGc0C+dBWHdQr0IXOZnvFnSm0Md3wOKbDqoDKrJmQ ZRNtNnsgwatMyp9sbaCMCJTD2gNxtClkKtHud8DR+7NRbbu1u6f1sfK66yZgj+KhVakw VJkWmyvG2D/R1zXsJyy0EuVsZZ8oSDvrbPy9IFEYGbVihwnJCYpf3DjuXqRTSujT1hlM /X8QN6HxVmqI57jFFM+Pcd2SpJohLQoNyCfPeRtCfLYUq/krVwmof10vciOkZA/OPPSx N33g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qzUuzTyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b12-20020a170902d50c00b001d0c9868aadsi1308524plg.227.2023.12.05.14.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 14:51:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qzUuzTyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 96582802090B; Tue, 5 Dec 2023 14:51:03 -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 S1346449AbjLEWuL (ORCPT + 99 others); Tue, 5 Dec 2023 17:50:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346254AbjLEWuJ (ORCPT ); Tue, 5 Dec 2023 17:50:09 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F76A5 for ; Tue, 5 Dec 2023 14:50:16 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1AF0C433C7; Tue, 5 Dec 2023 22:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701816615; bh=5x+DUlQVMX4rI7C/lbZIjEUnEMm9TF3RtDPL84aa0IY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qzUuzTyXqMMGkKhJrn0avRKUlTtuVRfv/LG3aS+yYIyilDbFJlKiPBV4QT/OhAyvB REmuJ97m0Ki7HhmIxYX3L0D26m+YeruHvP8BYlXfZ/dLY8ucBjEP9+vKTPwP2J16xT KJpUroGmXr/ssEPipGeyjd5M1TGe8ld645GkOxgYCpbF+igL01H3sKvrGZ1aUpweC0 AiGMUlNIrvmDafNTG/4O/n/dCNabro47BUi6/sMduEXxnnqyGfbIK98p9vzNHWBSiE 4p+AHuLGe3tttS3KUX7Uhu+5fAh1zA6Af0RHboehlcZ6Ei3k14EB1vKs92lYRSGUX+ vHBVzdrjsfZ8w== Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40b2ddab817so64358935e9.3; Tue, 05 Dec 2023 14:50:15 -0800 (PST) X-Gm-Message-State: AOJu0YyrjV7ARNHYi6uLmFHCb+25xQIkJBRIdgTKuUF3uH0lwyuGqtEO jNTQYL7/YdDrM+YyW4T225zRVA9f1OANIaZIJJs= X-Received: by 2002:a05:600c:3093:b0:40b:5e59:da99 with SMTP id g19-20020a05600c309300b0040b5e59da99mr21446wmn.172.1701816614079; Tue, 05 Dec 2023 14:50:14 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <4a93cdb4-031c-4f77-8697-ce7fb42afa4a@t-8ch.de> From: Luis Chamberlain Date: Tue, 5 Dec 2023 14:50:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 13/18] sysctl: move sysctl type to ctl_table_header To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: Kees Cook , "Gustavo A. R. Silva" , Iurii Zaikin , Greg Kroah-Hartman , Joel Granados , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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]); Tue, 05 Dec 2023 14:51:03 -0800 (PST) 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, str= uct 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. It is worse in that it is not obvious: + if (table =3D=3D sysctl_mount_point) + sysctl_set_perm_empty_ctl_header(head); > Which kind of unsafety do you envision here? 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. Luis