Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2547968rdb; Sun, 3 Dec 2023 23:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVeHMhyGSf2rLIEV6bXksrMBJck7WG8DNNRml6O1Sd86MahGZ+FHBC42XK1sc5iQOGRaER X-Received: by 2002:a17:902:ce89:b0:1d0:a663:20fe with SMTP id f9-20020a170902ce8900b001d0a66320femr664970plg.80.1701676405630; Sun, 03 Dec 2023 23:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676405; cv=none; d=google.com; s=arc-20160816; b=k3oOjIC39g6l8Ze1r15x/d4K9q/EmM8m/lNqbzRYAEmOlFdZw2xFmzOnmgb7Dm/m4k KcU82MbQNUSm/hE7qOkENz78KhAfVOHI4ngwHWmh7GX1qGmoiM/qeYcugLr1P5x2YFEz /0ne/AhKjEY2QavYnbSX5WljDzsa7DAUB5Hz5g7A0yw35dYOF0dzrDCkr355eHQvDBEt 9eV5I/ixUQc4PhbmCB5hX30BEXBYB9pEoYH+TOqLvKXTRHZT7HWd4okDz3yJDmIgmZWI 6kqlFgFq7rBiLczoROo4+y9WoQO1v3L/Jt3eRgqwnuNd77VcaOOIzvnj0mj2mAr/4BrB EiSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vKrd8Z5noeWBTEUIN0mlKlnS76tZAreUoKyQ+4FywUI=; fh=1v5zqbO9sIGUc9bsdyhYE0zxdK1knZz2xnJYWUWMFKo=; b=L9L1NoOlPmKgWQ37EOfg8oW9uaOV6GFc36op8/7qiIZoHrYIFQT1y16uDcp1wgXC0p 1gPLIXCWkge6G2peM6o16I3xAOWEP88IjOCWjM09Ki/tsWBXsoZ0EOVmZhHZnxhZFNzB SXdD4a2H0rF1kYwNbD2JJ3WD+YeIu38CvWZ5z1DtyXuWCB75hpyrMyy0LEF3qClLYXCz XNzs/Qk37/31QKjdBXCxGYrckXh6N1S8PkQbRVpNuLwz1Fvh65gOC/EtZs5f0fESzh+f 8oaBJJK+8VuubNguYBk3+xdiUaPsKwTU68LGfdAW6NzisDhoWXL/NyEr4dX7WuvGV/n1 1Trg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=KDc8hCKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p5-20020a170902e74500b001cfdaca2b92si7645043plf.386.2023.12.03.23.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:53:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=KDc8hCKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 198F080681D4; Sun, 3 Dec 2023 23:53:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234894AbjLDHwx (ORCPT + 99 others); Mon, 4 Dec 2023 02:52:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234719AbjLDHwp (ORCPT ); Mon, 4 Dec 2023 02:52:45 -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 AA9A5102; Sun, 3 Dec 2023 23:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1701676352; bh=S9V/IJQi2EMf1kRNVARgwVZ9ApUdndNydZjX5OKBihc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KDc8hCKfDhh524oHnRJPJz0iNBKtq1KksoAS8/EBsl7Ak4JWrGsbbXOdVe6MMDUM4 XfikUAI0N5MybtF9Lh//LM50eJilELIxaInUuWDBKyMvDd6gqAKsGpibPTN8X+imTO HMTwJbVN8BiCRjVmszIFT37OeQ88hi/Ykllu/AzY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 04 Dec 2023 08:52:23 +0100 Subject: [PATCH v2 10/18] sysctl: treewide: constify ctl_table_root::permissions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231204-const-sysctl-v2-10-7a5060b11447@weissschuh.net> References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> In-Reply-To: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> To: Kees Cook , "Gustavo A. R. Silva" , Luis Chamberlain , Iurii Zaikin , Greg Kroah-Hartman , Joel Granados Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701676350; l=2382; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=S9V/IJQi2EMf1kRNVARgwVZ9ApUdndNydZjX5OKBihc=; b=HnfoCDmJBovIxiovoyRKYbwFwzbbCaj+R/sL4531aUB8MM1AzeDUZRnRsHT+2K69vhtsTyNUm 2Sv5i/tkSuQCcDN+8GyyuUL1c56UbP9k3xL8fjP8ojnT386O28+fLCs X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Sun, 03 Dec 2023 23:53:22 -0800 (PST) In a future commit the sysctl core will only use "const struct ctl_table". As a preparation for that adapt the permission callbacks. Signed-off-by: Thomas Weißschuh --- include/linux/sysctl.h | 2 +- ipc/ipc_sysctl.c | 2 +- kernel/ucount.c | 2 +- net/sysctl_net.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 800154e1ff88..92c1d0114cdc 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -207,7 +207,7 @@ struct ctl_table_root { void (*set_ownership)(struct ctl_table_header *head, const struct ctl_table *table, kuid_t *uid, kgid_t *gid); - int (*permissions)(struct ctl_table_header *head, struct ctl_table *table); + int (*permissions)(struct ctl_table_header *head, const struct ctl_table *table); }; /* struct ctl_path describes where in the hierarchy a table is added */ diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c index 8c62e443f78b..b087787f608f 100644 --- a/ipc/ipc_sysctl.c +++ b/ipc/ipc_sysctl.c @@ -190,7 +190,7 @@ static int set_is_seen(struct ctl_table_set *set) return ¤t->nsproxy->ipc_ns->ipc_set == set; } -static int ipc_permissions(struct ctl_table_header *head, struct ctl_table *table) +static int ipc_permissions(struct ctl_table_header *head, const struct ctl_table *table) { int mode = table->mode; diff --git a/kernel/ucount.c b/kernel/ucount.c index 4aa6166cb856..90300840256b 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -38,7 +38,7 @@ static int set_is_seen(struct ctl_table_set *set) } static int set_permissions(struct ctl_table_header *head, - struct ctl_table *table) + const struct ctl_table *table) { struct user_namespace *user_ns = container_of(head->set, struct user_namespace, set); diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 1310ef8f0958..2873a4fed47d 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c @@ -40,7 +40,7 @@ static int is_seen(struct ctl_table_set *set) /* Return standard mode bits for table entry. */ static int net_ctl_permissions(struct ctl_table_header *head, - struct ctl_table *table) + const struct ctl_table *table) { struct net *net = container_of(head->set, struct net, sysctls); -- 2.43.0