From nobody Mon Feb 9 05:59:25 2026 Received: from mail-lj1-f228.google.com (mail-lj1-f228.google.com [209.85.208.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0A8B2BE622 for ; Wed, 31 Dec 2025 17:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767202650; cv=none; b=W3SYT7A1rqQuTVbpBoIB5PNwFTWxFPqltqdiKmk49B0SWr7wHeH+xDw3KZkA4hAdPm5ZCqnPuyab/6UlY3DRl+BFhIdIuunoK6r9cI01354nyBdVmpp1xlMbcXRPY4uR5x4t3D7MbcHYQ/vnuuUUdmTZnwcuEoC0Xj8Z55Y+1GI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767202650; c=relaxed/simple; bh=+qs2O0p6JSmasUPfUb0PrNjt2zEzZFmnX/PzeN+aGlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s4icu0p4Jar0xBZ8BcpgXHUN2qiq+1WQyZYpnglWTZWTaeBVun33D00ZnZOBX4lKzEjcX2yzEQG0OpHRaZdIxUYh1G+4EI6sI/m4c343uc7VC7dPyBS5taHHCgsnzz6mrc97qM6Jjuow0r5tqaNDDo82XVwRTWi8pvUTEmsqF+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=SWgzDxwL; arc=none smtp.client-ip=209.85.208.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="SWgzDxwL" Received: by mail-lj1-f228.google.com with SMTP id 38308e7fff4ca-37f8cc9a9feso12947611fa.0 for ; Wed, 31 Dec 2025 09:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767202645; x=1767807445; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=evGP5W8eaS0gGQmtryNYpPPxNCoy7QWmqYRyuLboZRo=; b=SWgzDxwLxk4IHhdqL7am7ZWGGW/UgDtLxQpB+RB2EAoNRxqgf0pqEqmrgtUSkdLEOs s3Kz+33lY+oL4kuEITZl7eHMAgn7Z0tA8qWlvOJW/g5YHix/fJvLf7GxnpeR/5Wx+loX EqeygASMuZJ+/kDPe0vQKeT6WA2TTwLacxgqR7Z6n9C8JQIDlN9eWnMNIegX6MwfmQKC /no0mibjlmypLz4CcnP/45nRK40FnjnrNvXp7r0oy0nHxRMYUbu6hAVFmlqkbnpFcnnp SRgM6+mle0M2/xjOs2M+YzOw9VAQqBl48FtLV8KP9ptlwe46UYXjP5i/SSXaeqELQypW UrQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767202645; x=1767807445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=evGP5W8eaS0gGQmtryNYpPPxNCoy7QWmqYRyuLboZRo=; b=PBVB7lEXSscdDw+xI5d4e+EXk4aAnBhx4C/8qG2C2CNzuwO4oT52GvsNOpspn3l8Vh QqzydnFpfWka+xYl/u4wVYP63pDwHaNO1UNb3xvohi+G023QcOZ9b+hzFv5rB7Z+L7ZR o4iE5po7YmgavHvgl+6a4FiBkrvyD1ouWtqS6h9mK4aMmp6Y6xA/UziKuhsddeFobVcR Kb7TzejsM5lnocewBN20ERg6iO6Tlo64IrsZp/AiYtzyiRseCS7CZ5ys91RtJmClDMrr ZvQzE5Jg/DirgAJuukKjhfeQtUfiFf4+a82WnoocDFCHwKnZTRx+VhQW9IFSt7uMFwuC fD6A== X-Forwarded-Encrypted: i=1; AJvYcCXm+LZCcCK7yshAVXnB8Euli0/lwc3fqwHpaGSI6+vIPYycV2ygZTSIEncyUGioMh15zllbGFQx4HCLe8g=@vger.kernel.org X-Gm-Message-State: AOJu0YwHc854IqKaGpVmncTW1HSzjhIZu5H1Iija0KpVPQYluYNgV1r2 M7QL3K2ZDUlZFm6AsCWtkqHybeGWF2v2wp1XGIZ1OZE8sVX0BlXRr1uK3PXqRw6DK06b73ZoxDh eC34GJhejAGRtOQVagihDllgAlk02HxZ1SPe2 X-Gm-Gg: AY/fxX6BbOOFbkWUFvFGBzkq2lBfj1Z5t7nSQfNkiHWxhvbHzjQSLSRunq31LchfQqy 0E689ch9qVcQJnx60AhSZ21Xz6JcgYlr7RF3MivNj3YN5QkPpR2NUhyi/ru48jUnbgQPifvF2yM FgH7n/YPMtMQmUUyYf8VbeNspJaQvtwPIUSrcKanolrMw8txwW2UG56UIBsgefbVss6Qw4du5PL nJLDYxEcSuHNwfQvM80vzA/YUB1vwk946mB/sKReOLbWU6jNDd8+lCDcW3q6E1k62sQyi3HssQv KYRGO6bNzr5UbiYgubl49CmeEaXzxwNXbnMRUCzdt/3fn4gqBhTOUYh1jcbkk8feeib28uZaOSQ 0a+s56Ws9QCNw44XSaT/hx07yUtpkp9Sy1maosKKOOA== X-Google-Smtp-Source: AGHT+IH27R9QYE1O2Ywp3/SP9pHkjO2yXz4EIipzqt9GsBoAsX+S1qf9N7p0ezxigbjNdJtb7dYT0W/PMzz9 X-Received: by 2002:a05:6512:2388:b0:598:e3ed:b43e with SMTP id 2adb3069b0e04-59a17d75aacmr7318962e87.6.1767202644708; Wed, 31 Dec 2025 09:37:24 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 2adb3069b0e04-59a18641fe3sm7185875e87.60.2025.12.31.09.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Dec 2025 09:37:24 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.49.34.222]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id C9BEB342241; Wed, 31 Dec 2025 10:37:22 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id C3D39E4234A; Wed, 31 Dec 2025 10:37:22 -0700 (MST) From: Caleb Sander Mateos To: Jiri Kosina , Benjamin Tissoires , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , David Ahern , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "D. Wythe" , Dust Li , Sidraya Jayagond , Wenjia Zhang , Mahanta Jambigi , Tony Lu , Wen Gu , Shuah Khan , Maxime Coquelin , Alexandre Torgue Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, sched-ext@lists.linux.dev, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Caleb Sander Mateos Subject: [PATCH 5/5] selftests/bpf: make cfi_stubs globals const Date: Wed, 31 Dec 2025 10:36:33 -0700 Message-ID: <20251231173633.3981832-6-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251231173633.3981832-1-csander@purestorage.com> References: <20251231173633.3981832-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that struct bpf_struct_ops's cfi_stubs field is a const pointer, declare the __test_no_cif_ops, __bpf_testmod_ops*, st_ops_cfi_stubs, and multi_st_ops_cfi_stubs global variables it points to as const. This tests that BPF struct_ops implementations are allowed to declare cfi_stubs global variables as const. Signed-off-by: Caleb Sander Mateos --- .../testing/selftests/bpf/test_kmods/bpf_test_no_cfi.c | 2 +- tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_test_no_cfi.c b/too= ls/testing/selftests/bpf/test_kmods/bpf_test_no_cfi.c index 948eb3962732..1d76912f1a45 100644 --- a/tools/testing/selftests/bpf/test_kmods/bpf_test_no_cfi.c +++ b/tools/testing/selftests/bpf/test_kmods/bpf_test_no_cfi.c @@ -39,11 +39,11 @@ static void bpf_test_no_cfi_ops__fn_1(void) =20 static void bpf_test_no_cfi_ops__fn_2(void) { } =20 -static struct bpf_test_no_cfi_ops __test_no_cif_ops =3D { +static const struct bpf_test_no_cfi_ops __test_no_cif_ops =3D { .fn_1 =3D bpf_test_no_cfi_ops__fn_1, .fn_2 =3D bpf_test_no_cfi_ops__fn_2, }; =20 static struct bpf_struct_ops test_no_cif_ops =3D { diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/t= esting/selftests/bpf/test_kmods/bpf_testmod.c index 90c4b1a51de6..5e460b1dbdb6 100644 --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c @@ -295,11 +295,11 @@ static int bpf_testmod_test_3(void) static int bpf_testmod_test_4(void) { return 0; } =20 -static struct bpf_testmod_ops3 __bpf_testmod_ops3 =3D { +static const struct bpf_testmod_ops3 __bpf_testmod_ops3 =3D { .test_1 =3D bpf_testmod_test_3, .test_2 =3D bpf_testmod_test_4, }; =20 static void bpf_testmod_test_struct_ops3(void) @@ -1273,11 +1273,11 @@ bpf_testmod_ops__test_return_ref_kptr(int dummy, st= ruct task_struct *task__ref, struct cgroup *cgrp) { return NULL; } =20 -static struct bpf_testmod_ops __bpf_testmod_ops =3D { +static const struct bpf_testmod_ops __bpf_testmod_ops =3D { .test_1 =3D bpf_testmod_test_1, .test_2 =3D bpf_testmod_test_2, .test_maybe_null =3D bpf_testmod_ops__test_maybe_null, .test_refcounted =3D bpf_testmod_ops__test_refcounted, .test_return_ref_kptr =3D bpf_testmod_ops__test_return_ref_kptr, @@ -1300,11 +1300,11 @@ static int bpf_dummy_reg2(void *kdata, struct bpf_l= ink *link) =20 ops->test_1(); return 0; } =20 -static struct bpf_testmod_ops2 __bpf_testmod_ops2 =3D { +static const struct bpf_testmod_ops2 __bpf_testmod_ops2 =3D { .test_1 =3D bpf_testmod_test_1, }; =20 struct bpf_struct_ops bpf_testmod_ops2 =3D { .verifier_ops =3D &bpf_testmod_verifier_ops, @@ -1547,11 +1547,11 @@ static const struct bpf_verifier_ops st_ops_verifie= r_ops =3D { .gen_prologue =3D st_ops_gen_prologue, .gen_epilogue =3D st_ops_gen_epilogue, .get_func_proto =3D bpf_base_func_proto, }; =20 -static struct bpf_testmod_st_ops st_ops_cfi_stubs =3D { +static const struct bpf_testmod_st_ops st_ops_cfi_stubs =3D { .test_prologue =3D bpf_test_mod_st_ops__test_prologue, .test_epilogue =3D bpf_test_mod_st_ops__test_epilogue, .test_pro_epilogue =3D bpf_test_mod_st_ops__test_pro_epilogue, }; =20 @@ -1715,11 +1715,11 @@ static void multi_st_ops_unreg(void *kdata, struct = bpf_link *link) static int bpf_testmod_multi_st_ops__test_1(struct st_ops_args *args) { return 0; } =20 -static struct bpf_testmod_multi_st_ops multi_st_ops_cfi_stubs =3D { +static const struct bpf_testmod_multi_st_ops multi_st_ops_cfi_stubs =3D { .test_1 =3D bpf_testmod_multi_st_ops__test_1, }; =20 struct bpf_struct_ops testmod_multi_st_ops =3D { .verifier_ops =3D &bpf_testmod_verifier_ops, --=20 2.45.2