Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2547799rdb; Sun, 3 Dec 2023 23:52:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+J3XG2u7Z341TRYkmUGwPqgGPirXqIT6guRwaExfppDxuxUcLoEDAJy1s+E0XiS0CJkEJ X-Received: by 2002:a05:6808:f10:b0:3b8:b063:6ba3 with SMTP id m16-20020a0568080f1000b003b8b0636ba3mr4630232oiw.82.1701676375990; Sun, 03 Dec 2023 23:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676375; cv=none; d=google.com; s=arc-20160816; b=uNxK3Zt4Ca+BQSYE66nsnvAKBtdNvgqk1zt5nUd9nuctIeQ57chBWFIHiwFne6HndK 66/xWdE4XPsfr7Kgz8nc0Gt+njvzP2eOpMkAq7d9+RrPhB2RhGkZCt0TX8Wa8ob3nsz4 S1OyIw07VofO26AMS0yy+Ik0x7E7bI31mhi7FGHQr/fWWGA10n7bBhK3w/P/zxeHEQVG 9IEVJxeUSPAOe2TCu6cQhqbkcsPQNVPYrjJW+vdPRNArqlDVTMorPolmw95dRnhdHbW6 LguV2yICP5fAjahwRwFsfRKu8+D09GcvX2jVydu6OzEB5eafH4CtZS5xsL40K3hbdgTt CiBg== 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=p/UjKpA16+JG2YBmymo0ggL/0SspbUnyy5dBpqxfT5o=; fh=1v5zqbO9sIGUc9bsdyhYE0zxdK1knZz2xnJYWUWMFKo=; b=WnipmURkzbOb5LY6VxpNOgzTfYgpz4IsR91Bdmobda/1b2XbBOagzASj+s6hkV7sd4 AODiu1Du3APUCl56+dpLwOc+YMLmKVRSrkv0CXFgptO5y+Prij3E1FeCZMMOZ/T24cli OuftkGyYJi4jrcuwAaKGUCteK49DoerE3WfEnfN64KUERJLW7qH0rfT8xOKSe2G+Esi5 4iZ1fithKO7MFHS8USi3a+UR9dTtw4FlpR1Wsb1lbiefNSujGmyk+FcwBikQIi0KeORt 8Jk+i4a5cV9iG0w9699LUrU5ZjGB2kZj8GWUHMB5NEHxhI7Q+0PKdgS904xMouDdcaMd DtxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=ZBXFhIz9; 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 Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id j4-20020a056a00130400b006cbd8368e73si7549992pfu.173.2023.12.03.23.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:52:55 -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=@weissschuh.net header.s=mail header.b=ZBXFhIz9; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 88F61808EE6F; Sun, 3 Dec 2023 23:52:53 -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 S1343496AbjLDHwh (ORCPT + 99 others); Mon, 4 Dec 2023 02:52:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343502AbjLDHw3 (ORCPT ); Mon, 4 Dec 2023 02:52:29 -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 8626D135; Sun, 3 Dec 2023 23:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1701676351; bh=T3jII5zUnYlnbPPOk4OeB1e7CrcIRU8AQwdXqX+t2X0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZBXFhIz94gSg8Kt7v4w19SdE5yTe/j5v18vyl9a3isW/pKheYAYWCJ55ZQhgDSVA/ VVK2ulqv4htTjx9Gvb3dCYsL2nmaejGLVJvR8Fev13rdYXI3H7RuqdTH3r99MH26RL 3yay1rFxRe0DseFdG/F9jH9gklQnbzsfpENugf0o= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 04 Dec 2023 08:52:17 +0100 Subject: [PATCH v2 04/18] cgroup: bpf: constify ctl_table arguments and fields MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231204-const-sysctl-v2-4-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=1943; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=T3jII5zUnYlnbPPOk4OeB1e7CrcIRU8AQwdXqX+t2X0=; b=empLB4oJMwGiCFdfTNXuKBYx88Wx32Olsk3PXjNKGw04ybJ6PSzYfGsjskQjHYM/x/F1Q2mHD B8qDNrFLuhSDfKF7RqS74q2ZdbS3z89noN6eESpUZOp3EUXpVM/QYbb 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 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]); Sun, 03 Dec 2023 23:52:53 -0800 (PST) In a future commit the sysctl core will only use "const struct ctl_table". As a preparation for that adapt the cgroup-bpf code. Signed-off-by: Thomas Weißschuh --- include/linux/bpf-cgroup.h | 2 +- include/linux/filter.h | 2 +- kernel/bpf/cgroup.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index a789266feac3..504fe9f8a3e7 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -138,7 +138,7 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, short access, enum cgroup_bpf_attach_type atype); int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, - struct ctl_table *table, int write, + const struct ctl_table *table, int write, char **buf, size_t *pcount, loff_t *ppos, enum cgroup_bpf_attach_type atype); diff --git a/include/linux/filter.h b/include/linux/filter.h index a4953fafc8cb..4d035fbd8558 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1358,7 +1358,7 @@ struct bpf_sock_ops_kern { struct bpf_sysctl_kern { struct ctl_table_header *head; - struct ctl_table *table; + const struct ctl_table *table; void *cur_val; size_t cur_len; void *new_val; diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 491d20038cbe..85476970b487 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -1694,7 +1694,7 @@ const struct bpf_verifier_ops cg_dev_verifier_ops = { * returned value != 1 during execution. In all other cases 0 is returned. */ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, - struct ctl_table *table, int write, + const struct ctl_table *table, int write, char **buf, size_t *pcount, loff_t *ppos, enum cgroup_bpf_attach_type atype) { -- 2.43.0