Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp608542rdb; Tue, 5 Dec 2023 14:41:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4vzlktHIcuOLEjIy2waclx/IrcViFDQgbNH4/cXNAKUimYecft+RC2vy+4oqqj68i0pLZ X-Received: by 2002:a05:6a20:e586:b0:18b:8dfa:8895 with SMTP id ng6-20020a056a20e58600b0018b8dfa8895mr4900915pzb.17.1701816107454; Tue, 05 Dec 2023 14:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701816107; cv=none; d=google.com; s=arc-20160816; b=touXni8hzNCwIVwlsfQL/cfrtgfxC+qa2f4PZBYQEoqlo0tyfwgMzO6JnbaCvo6xH0 yWiIZEfP5Ee0nKxwKhVu5sfkv1MaOOfIWNkxJN4pAhxHgcvLqI8cUcz2HKvlH5BK0HAZ Kw2dZREoZpbY4ItEhAwwBnOa1CJLxU9oMoBOnXUAl6nDx0TeimSQqKXuy9YHLpLkS5Lu 1ZQeAYraMMM0rXY4AvRwibjM747eF82JYcrxOK6oMEJi16xGaG/3ZmLD1KB+MVJVDqzP H1O+8Tu42/p2gsJoW6utLPoNlKsTOK8OEfARIlpc48jYHpoYb250HYgnaUTLwcsho5wA 6s5A== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BYwJjGntyLGAPriHIKwkV6NVUGG/VunPT0vBWHo7gZc=; fh=nvVjx0nBM7WKTJ9OzgHwve3TUxSZWGXMMa1XhIk1UsU=; b=dkEbdqTokMhzlWm8WRKesqaMQlhpL8IbZ4GCcuIQE0IOStMwygWksYpU5lNCSNkxak 6g6mUZGQbAQ19IPY/k5tzkJUsiG1NquZogicLoE3jm6+AazEMKUWlUARPTLr66XTf+3p yTXsjc97Ch5OHfooUNOFEBvaO4sNgzcEBXDFn9hHJH/3yrFXr9uPNCX1JpLTQ+2Gsuia X/m8NirtHu4wnHvJ344eGeY5vXW181thnGtNLI4NkTy/8hVoxP6PnBVt8qa19hAhCAv6 bLK0cTJQFSJj6z9Su+xTePawIBZE1IGrA6UbCZvVqtzSyRneFWQLYGPfpH+CXNWv4lH6 doxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="i/PNNhz0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w18-20020a17090a8a1200b00286f945f4f0si669395pjn.131.2023.12.05.14.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 14:41:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="i/PNNhz0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 48E6980B8160; Tue, 5 Dec 2023 14:41:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346511AbjLEWl3 (ORCPT + 99 others); Tue, 5 Dec 2023 17:41:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346259AbjLEWl2 (ORCPT ); Tue, 5 Dec 2023 17:41:28 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EE77194; Tue, 5 Dec 2023 14:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1701816092; bh=RADxu9DladnQuPEEYoqwAwtdXSXRn/xTNYBYSRG5xo4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i/PNNhz098jJeinwKz9W78Z/IkTsMAJx5V+pSEhr4QKMjximz0mHEI++EZLdFLO4J vDluKmBkcgJaQR9esCp68WX7p23oBKby429p1/qDixTqPQ5ZCEtoy0jyLA5Qpdngtt rRVvBy2a7wrG3xl6a2k3X3JLJxw0hCZ7TyFYl7js= Date: Tue, 5 Dec 2023 23:41:32 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Luis Chamberlain 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 Subject: Re: [PATCH v2 13/18] sysctl: move sysctl type to ctl_table_header Message-ID: <4a93cdb4-031c-4f77-8697-ce7fb42afa4a@t-8ch.de> References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> <20231204-const-sysctl-v2-13-7a5060b11447@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 05 Dec 2023 14:41:45 -0800 (PST) On 2023-12-05 14:33:38-0800, Luis Chamberlain wrote: > On Mon, Dec 04, 2023 at 08:52:26AM +0100, Thomas Weißschuh wrote: > > @@ -231,7 +231,8 @@ static int insert_header(struct ctl_dir *dir, struct 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 == 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. > This just made me cringe, and curious if some other changes > could be done to make this obviously clear during patch review > that this is safe. Which kind of unsafety do you envision here?