All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@kernel.org>
To: John Fastabend <john.fastabend@gmail.com>,
	syzbot <syzbot+8cd36f6b65f3cafd400a@syzkaller.appspotmail.com>,
	andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
	daniel@iogearbox.net, davem@davemloft.net, haoluo@google.com,
	hawk@kernel.org, john.fastabend@gmail.com, jolsa@kernel.org,
	kpsingh@kernel.org, kuba@kernel.org,
	linux-kernel@vger.kernel.org, martin.lau@linux.dev,
	netdev@vger.kernel.org, sdf@google.com, song@kernel.org,
	syzkaller-bugs@googlegroups.com, yonghong.song@linux.dev
Subject: Re: [syzbot] [bpf?] [net?] BUG: unable to handle kernel NULL pointer dereference in dev_map_hash_update_elem
Date: Tue, 27 Feb 2024 14:50:10 +0100	[thread overview]
Message-ID: <87msrmdnjh.fsf@toke.dk> (raw)
In-Reply-To: <65dd075bc6cbd_20e0a20892@john.notmuch>

John Fastabend <john.fastabend@gmail.com> writes:

> syzbot wrote:
>> syzbot has found a reproducer for the following issue on:
>> 
>> HEAD commit:    70ff1fe626a1 Merge tag 'docs-6.8-fixes3' of git://git.lwn...
>> git tree:       upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=1762045c180000
>> kernel config:  https://syzkaller.appspot.com/x/.config?x=4cf52b43f46d820d
>> dashboard link: https://syzkaller.appspot.com/bug?extid=8cd36f6b65f3cafd400a
>> compiler:       arm-linux-gnueabi-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
>> userspace arch: arm
>> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=110cf122180000
>> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=142f6d8c180000
>> 
>> Downloadable assets:
>> disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/8ead8862021c/non_bootable_disk-70ff1fe6.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/bc398db9fd8c/vmlinux-70ff1fe6.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/6d3f8b72a671/zImage-70ff1fe6.xz
>> 
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+8cd36f6b65f3cafd400a@syzkaller.appspotmail.com
>> 
>
> I'll take a look this week if no one beats me to it. Looks like there is
> a reproducer so should be able to sort it out.

Took a look at the reproducer. Looks like it's creating the map with
max_entries=0x80000202, which means the rounding up of the number of
hash buckets overflows, and somehow the overflow check (for 0) is not
working on a 32-bit machine? I guess because the roundup_power_of_two()
ends up doing a (1UL << 32), which is undefined behaviour when an
unsigned long is four bytes.

I'll send a patch to check the value before the rounding up instead of
after.

-Toke

  reply	other threads:[~2024-02-27 13:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-18 22:22 [syzbot] [net?] [bpf?] BUG: unable to handle kernel NULL pointer dereference in dev_map_hash_update_elem syzbot
2024-02-26  3:49 ` [syzbot] [bpf?] [net?] " syzbot
2024-02-26 21:49   ` John Fastabend
2024-02-27 13:50     ` Toke Høiland-Jørgensen [this message]
2024-02-27 13:52 ` [syzbot] " syzbot
     [not found] <87jzmqdnfv.fsf@toke.dk>
2024-02-27 14:16 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msrmdnjh.fsf@toke.dk \
    --to=toke@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=syzbot+8cd36f6b65f3cafd400a@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.