[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADUfDZpSSikiZ8d8eWvfucj=Cvhc=k-sHN03EVExGBQ4Lx+23Q@mail.gmail.com>
Date: Wed, 31 Dec 2025 13:09:19 -0500
From: Caleb Sander Mateos <csander@...estorage.com>
To: bot+bpf-ci@...nel.org
Cc: jikos@...nel.org, bentiss@...nel.org, ast@...nel.org, daniel@...earbox.net,
john.fastabend@...il.com, andrii@...nel.org, martin.lau@...ux.dev,
eddyz87@...il.com, song@...nel.org, yonghong.song@...ux.dev,
kpsingh@...nel.org, sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org,
tj@...nel.org, void@...ifault.com, arighi@...dia.com, changwoo@...lia.com,
mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com, rostedt@...dmis.org,
bsegall@...gle.com, mgorman@...e.de, vschneid@...hat.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
dsahern@...nel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, alibuda@...ux.alibaba.com, dust.li@...ux.alibaba.com,
sidraya@...ux.ibm.com, wenjia@...ux.ibm.com, mjambigi@...ux.ibm.com,
tonylu@...ux.alibaba.com, guwen@...ux.alibaba.com, shuah@...nel.org,
mcoquelin.stm32@...il.com, alexandre.torgue@...s.st.com,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, netdev@...r.kernel.org, sched-ext@...ts.linux.dev,
linux-rdma@...r.kernel.org, linux-s390@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, martin.lau@...nel.org, clm@...a.com,
ihor.solodrai@...ux.dev
Subject: Re: [PATCH 5/5] selftests/bpf: make cfi_stubs globals const
On Wed, Dec 31, 2025 at 10:04 AM <bot+bpf-ci@...nel.org> wrote:
>
> > diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/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
>
> [ ... ]
>
> > @@ -1275,7 +1275,7 @@ bpf_testmod_ops__test_return_ref_kptr(int dummy, struct task_struct *task__ref,
> > return NULL;
> > }
> >
> > -static struct bpf_testmod_ops __bpf_testmod_ops = {
> > +static const struct bpf_testmod_ops __bpf_testmod_ops = {
> > .test_1 = bpf_testmod_test_1,
> > .test_2 = bpf_testmod_test_2,
>
> Is it safe to make __bpf_testmod_ops const here? In bpf_testmod_init(),
> this struct is modified at runtime:
>
> tramp = (void **)&__bpf_testmod_ops.tramp_1;
> while (tramp <= (void **)&__bpf_testmod_ops.tramp_40)
> *tramp++ = bpf_testmod_tramp;
>
> Writing to a const-qualified object is undefined behavior and may cause a
> protection fault when the compiler places this in read-only memory. Would
> the module fail to load on systems where .rodata is actually read-only?
Yup, that's indeed the bug caught by KASAN. Missed this mutation at
init time, I'll leave __bpf_testmod_ops as mutable.
Thanks,
Caleb
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/20624206229
Powered by blists - more mailing lists