Re: [syzbot] [mm?] KMSAN: kernel-infoleak in bpf_probe_write_user

From: Alexei Starovoitov
Date: Tue Apr 16 2024 - 11:16:40 EST


On Tue, Apr 16, 2024 at 1:52 AM Alexander Potapenko <glider@xxxxxxxxxx> wrote:
>
> On Mon, Apr 15, 2024 at 11:06 PM Alexei Starovoitov
> <alexei.starovoitov@xxxxxxxxx> wrote:
> >
> > Hi,
> >
> > syzbot folks, please disable such "bug" reporting.
> > The whole point of bpf is to pass such info to userspace.
> > probe_write_user, various ring buffers, bpf_*_printk-s, bpf maps
> > all serve this purpose of "infoleak".
> >
>
> Hi Alexei,
>
> From KMSAN's perspective it is fine to pass information to the
> userspace, unless it is marked as uninitialized.
> It could be that we are missing some initialization in kernel/bpf/core.c though.
> Do you know which part of the code is supposed to initialize the stack
> in PROG_NAME?

cap_bpf + cap_perfmon bpf program are allowed to read uninitialized stack.

And recently we added
commit e8742081db7d ("bpf: Mark bpf prog stack with
kmsan_unposion_memory in interpreter mode")
to shut up syzbot.