Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp605553rdb; Tue, 5 Dec 2023 14:34:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF19o28gkyrZUAX0YrGQi59MjyX/yXV6cMh1kyK3pseCGBYZXMqXwVWgEfDdhMIcMNX5yJD X-Received: by 2002:a05:6a21:3387:b0:18b:f90d:9d84 with SMTP id yy7-20020a056a21338700b0018bf90d9d84mr7696270pzb.54.1701815644358; Tue, 05 Dec 2023 14:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701815644; cv=none; d=google.com; s=arc-20160816; b=foFH3dkf7CexOTMK7X6GgXUbfO2rpkQ9smM4wFoW2bCrd0G58Qe8SDswrJHgVnTnf/ KXugX/trNcHgqini2cpIlaAzjIbcdRYcsbhNYmNKFPMobuWb+N4RwFlP93dyBTyYf/wJ DscqRqDScRDeLXD1jrAzNJjp6VcqmM32sWqWc9+lp0zRQpvbj3UGm7NhWCT3uepx4jqK 3ektsUoO9C4Ao2xboyzEFi30H2ZGsgA/I6JTrVnwDYZHlWYsR3f2vaGw/XuFHvu04++8 x4weXJT2EpcCGPc5XcoefSvwRamAeq0ITDelfbdqJhMh4ePeBlsLVtgv7j7CeL6bbCNE egkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PaxZkLLx0jxzIbcOPDTCZy8j45AuGDflCXboembxXDQ=; fh=EtBhDWsksdxL79y0G0cIPQ4bRU2Meq65RPRK2RwSUF4=; b=U0JULoUSAK90O+KAsBDa+To6f/ov0GFDnRPyJF2XY/3aC5UUW7YrqOaiyBMi3ZSkEy Fx6auhtNLdT3Q04eXwQp8UhUZIoVCWOk+XDQ6gQjgPO9/Bp5WH7hHXrPmerSXKTcmJHg yld3LnjO2u9RCCjieQHMGHlFqG1/pOBgbiW99Tiu9/kuat7zFwKT1QjUyq1O4SOhX20C COLBZaSXYmeM5qLJU3bNM6HCxUVRRFCz0cSPbMZzCAB0y0cGVp5p60Vm+p0f0ua+NUk7 D4acFHMv9iBoMLXOgoDFUVVNzVN3mTNsivJ9qwnGnU2AVD81zdU4YEsMFSDbHu8f0CxM YU6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="v/olVTT4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y192-20020a638ac9000000b005c65f10c216si1282311pgd.287.2023.12.05.14.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 14:34:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="v/olVTT4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id EDAAB8047D02; Tue, 5 Dec 2023 14:34:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346501AbjLEWdk (ORCPT + 99 others); Tue, 5 Dec 2023 17:33:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346259AbjLEWdj (ORCPT ); Tue, 5 Dec 2023 17:33:39 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67D24196; Tue, 5 Dec 2023 14:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=PaxZkLLx0jxzIbcOPDTCZy8j45AuGDflCXboembxXDQ=; b=v/olVTT4L++PZOFWqMtE88KMip 2EqgzAkRcEL4VV0Xh9PDEdLyq19Uc4IeTpFgOdwceLpfv0J7hJhUZf8hQYU4Cu2mHvMH38WXBef0+ h4F2/MkMhCCiXIX94WdZFIBX/rtwuyiWDtq7GJL7B7JuhaoM2pr8s+O6JGPqmY9OPd+RkTQK/IbSn luWLVLten9V9arZv5euLBno80sx9FJVnXohP8nmgl/n2sAWwc1+p6GHSp1Lbr2isSotmUDC9TnPr9 wxUF1Qx5x/yGum6b9RqP1BowU1SS+fli2TAMT6CJR1qkcKS4LPJijqSt+P4lrgHjwRIiQDfOA3JYB GExdSYMw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1rAdz1-008WZd-01; Tue, 05 Dec 2023 22:33:39 +0000 Date: Tue, 5 Dec 2023 14:33:38 -0800 From: Luis Chamberlain To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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: 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231204-const-sysctl-v2-13-7a5060b11447@weissschuh.net> Sender: Luis Chamberlain X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 05 Dec 2023 14:34:02 -0800 (PST) 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 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. Luis