[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251231072919.1018961-1-buaajxlj@163.com>
Date: Wed, 31 Dec 2025 15:29:19 +0800
From: Liang Jie <buaajxlj@....com>
To: ameryhung@...il.com
Cc: andrii@...nel.org,
ast@...nel.org,
bpf@...r.kernel.org,
buaajxlj@....com,
daniel@...earbox.net,
eddyz87@...il.com,
haoluo@...gle.com,
john.fastabend@...il.com,
jolsa@...nel.org,
kpsingh@...nel.org,
liangjie@...iang.com,
linux-kernel@...r.kernel.org,
martin.lau@...ux.dev,
sdf@...ichev.me,
song@...nel.org,
syzbot+4fe468a3f7fac86ea2c9@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com,
yonghong.song@...ux.dev
Subject: Re: [syzbot] [bpf?] general protection fault in bpf_get_local_storage (2)
On Tue, 30 Dec 2025 22:18:00 -0800, Amery Hung <ameryhung@...il.com> wrote:
> >
> > #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3f0e9c8cefa9
> >
> > diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
> > index 69988af44b37..2bc27ece5cc5 100644
> > --- a/kernel/bpf/cgroup.c
> > +++ b/kernel/bpf/cgroup.c
> > @@ -1768,6 +1768,9 @@ BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
> > ctx = container_of(current->bpf_ctx, struct bpf_cg_run_ctx, run_ctx);
> > storage = ctx->prog_item->cgroup_storage[stype];
> >
> > + if (unlikely(!storage))
> > + return (unsigned long)NULL;
> > +
> > if (stype == BPF_CGROUP_STORAGE_SHARED)
> > ptr = &READ_ONCE(storage->buf)->data[0];
> >
> >
>
> Hi Liang,
>
> I don't think we can do this here due to backward compatibility. The
> return type of the helper is RET_PTR_TO_MAP_VALUE. Your proposed fix
> would require adding a PTR_MAYBE_NULL and existing BPF programs would
> no longer pass the verifier.
>
> Did you look into why the storage pointer is NULL in the first place?
>
> BTW, there is also another similar report and a work-in-progress fix
> [1]. Do you think this is a separate issue from that?
Hi Amery,
Thanks for pointing this out.
Sorry, I initially missed your earlier WIP fix. Looking at it now, this
does seem to be addressing the same class of issues where
bpf_get_local_storage() can observe a NULL storage pointer.
I'm interested in this area and will take a closer look to see whether
your patch also covers the syzbot report.
Thanks,
Liang
Powered by blists - more mailing lists