lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <30a74160-1798-4d77-9118-a46a5c7102e0@arnaud-lcm.com>
Date: Wed, 10 Sep 2025 21:01:23 +0100
From: Arnaud Lecomte <contact@...aud-lcm.com>
To: Song Liu <song@...nel.org>
Cc: alexei.starovoitov@...il.com, yonghong.song@...ux.dev, andrii@...nel.org,
 ast@...nel.org, bpf@...r.kernel.org, daniel@...earbox.net,
 eddyz87@...il.com, haoluo@...gle.com, john.fastabend@...il.com,
 jolsa@...nel.org, kpsingh@...nel.org, linux-kernel@...r.kernel.org,
 martin.lau@...ux.dev, sdf@...ichev.me,
 syzbot+c9b724fbb41cf2538b7b@...kaller.appspotmail.com,
 syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH bpf-next v8 3/3] bpf: fix stackmap overflow check in
 __bpf_get_stackid()


On 09/09/2025 17:41, Song Liu wrote:
> On Fri, Sep 5, 2025 at 9:48 AM Arnaud lecomte <contact@...aud-lcm.com> wrote:
>> From: Arnaud Lecomte <contact@...aud-lcm.com>
>>
>> Syzkaller reported a KASAN slab-out-of-bounds write in __bpf_get_stackid()
>> when copying stack trace data. The issue occurs when the perf trace
>>   contains more stack entries than the stack map bucket can hold,
>>   leading to an out-of-bounds write in the bucket's data array.
>>
>> Reported-by: syzbot+c9b724fbb41cf2538b7b@...kaller.appspotmail.com
>> Closes: https://syzkaller.appspot.com/bug?extid=c9b724fbb41cf2538b7b
>> Fixes: ee2a098851bf ("bpf: Adjust BPF stack helper functions to accommodate skip > 0")
>> Signed-off-by: Arnaud Lecomte <contact@...aud-lcm.com>
>> Acked-by: Yonghong Song <yonghong.song@...ux.dev>
> Acked-by: Song Liu <song@...nel.org>
>
> With one nitpick below.
>
> [...]
>> @@ -390,15 +391,16 @@ BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx,
>>                  return -EFAULT;
>>
>>          nr_kernel = count_kernel_ip(trace);
>> +       elem_size = stack_map_data_size(map);
>> +       __u64 nr = trace->nr; /* save original */
> nit: I think all variable declarations should go to the beginning of
> the {} block.
> I am surprised ./scripts/checkpatch.pl doesn't complain this.
>
Good catch, thanks !
I should maybe wait for comments from other reviewers because raising
an other revision.
>>          if (kernel) {
>> -               __u64 nr = trace->nr;
>> -
> [...]
>
Thanks,
Arnaud


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ