netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	yonghong.song@linux.dev
Cc: syzbot <syzbot+1a3cf6f08d68868f9db3@syzkaller.appspotmail.com>,
	bpf@vger.kernel.org, davem@davemloft.net, eddyz87@gmail.com,
	haoluo@google.com, hawk@kernel.org, john.fastabend@gmail.com,
	jolsa@kernel.org, kpsingh@kernel.org, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	sdf@google.com, song@kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bpf?] [net?] KMSAN: uninit-value in dev_map_lookup_elem
Date: Tue, 26 Mar 2024 17:53:49 -0700	[thread overview]
Message-ID: <a402206e-a9c9-40bd-bf78-710054506071@linux.dev> (raw)
In-Reply-To: <0000000000006f876b061478e878@google.com>

On 3/25/24 2:36 AM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    5e74df2f8f15 Merge tag 'x86-urgent-2024-03-24' of git://gi..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=148872a5180000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=e6bd769cb793b98a
> dashboard link: https://syzkaller.appspot.com/bug?extid=1a3cf6f08d68868f9db3
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15921a6e180000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12e081f1180000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/1a82880723a7/disk-5e74df2f.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/fd3046ac43b9/vmlinux-5e74df2f.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/2097be59cbc1/bzImage-5e74df2f.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+1a3cf6f08d68868f9db3@syzkaller.appspotmail.com
> 
> =====================================================
> BUG: KMSAN: uninit-value in __dev_map_lookup_elem kernel/bpf/devmap.c:441 [inline]
> BUG: KMSAN: uninit-value in dev_map_lookup_elem+0xf3/0x170 kernel/bpf/devmap.c:796
>   __dev_map_lookup_elem kernel/bpf/devmap.c:441 [inline]
>   dev_map_lookup_elem+0xf3/0x170 kernel/bpf/devmap.c:796
>   ____bpf_map_lookup_elem kernel/bpf/helpers.c:42 [inline]
>   bpf_map_lookup_elem+0x5c/0x80 kernel/bpf/helpers.c:38
>   ___bpf_prog_run+0x13fe/0xe0f0 kernel/bpf/core.c:1997
>   __bpf_prog_run256+0xb5/0xe0 kernel/bpf/core.c:2237

It should be in the interpreter mode.

The C reproducer is trying to run the following bpf prog:

    0: (18) r0 = 0x0
    2: (18) r1 = map[id:49]
    4: (b7) r8 = 16777216
    5: (7b) *(u64 *)(r10 -8) = r8
    6: (bf) r2 = r10
    7: (07) r2 += -229
            ^^^^^^^^^^

    8: (b7) r3 = 8
    9: (b7) r4 = 0
   10: (85) call dev_map_lookup_elem#1543472
   11: (95) exit

I think this KMSAN report (and a few others related to lookup/delete_elem) 
should only happen in the interpreter mode.

Does it worth to suppress it by always initializing the stack in the interpreter 
mode considering the interpreter is not very speed sensitive ?


>   bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
>   __bpf_prog_run include/linux/filter.h:657 [inline]
>   bpf_prog_run include/linux/filter.h:664 [inline]
>   __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
>   bpf_trace_run5+0x16f/0x350 kernel/trace/bpf_trace.c:2423
>   __bpf_trace_ext4_remove_blocks+0x45/0x60 include/trace/events/ext4.h:1984
>   __traceiter_ext4_remove_blocks+0xb5/0x170 include/trace/events/ext4.h:1984
>   trace_ext4_remove_blocks include/trace/events/ext4.h:1984 [inline]
>   ext4_remove_blocks fs/ext4/extents.c:2463 [inline]
>   ext4_ext_rm_leaf fs/ext4/extents.c:2686 [inline]
>   ext4_ext_remove_space+0x4e30/0x7e00 fs/ext4/extents.c:2934
>   ext4_ext_truncate+0x1e3/0x390 fs/ext4/extents.c:4440
>   ext4_truncate+0x14c6/0x1e10 fs/ext4/inode.c:4146
>   ext4_evict_inode+0x1886/0x24d0 fs/ext4/inode.c:258
>   evict+0x3ae/0xa60 fs/inode.c:667
>   iput_final fs/inode.c:1741 [inline]
>   iput+0x9ca/0xe10 fs/inode.c:1767
>   d_delete_notify include/linux/fsnotify.h:307 [inline]
>   vfs_rmdir+0x53c/0x790 fs/namei.c:4222
>   do_rmdir+0x630/0x8b0 fs/namei.c:4268
>   __do_sys_rmdir fs/namei.c:4287 [inline]
>   __se_sys_rmdir fs/namei.c:4285 [inline]
>   __x64_sys_rmdir+0x78/0xb0 fs/namei.c:4285
>   do_syscall_64+0xd5/0x1f0
>   entry_SYSCALL_64_after_hwframe+0x6d/0x75
> 
> Local variable stack created at:
>   __bpf_prog_run256+0x45/0xe0 kernel/bpf/core.c:2237
>   bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline]
>   __bpf_prog_run include/linux/filter.h:657 [inline]
>   bpf_prog_run include/linux/filter.h:664 [inline]
>   __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline]
>   bpf_trace_run5+0x16f/0x350 kernel/trace/bpf_trace.c:2423
> 
> CPU: 0 PID: 5017 Comm: syz-executor365 Not tainted 6.8.0-syzkaller-13236-g5e74df2f8f15 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
> =====================================================

> 


  reply	other threads:[~2024-03-27  0:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25  9:36 [syzbot] [bpf?] [net?] KMSAN: uninit-value in dev_map_lookup_elem syzbot
2024-03-27  0:53 ` Martin KaFai Lau [this message]
2024-03-27  1:07   ` Alexei Starovoitov
2024-03-27  4:47     ` Yonghong Song
2024-03-27 18:46       ` Martin KaFai Lau
2024-03-28 10:01         ` syzbot
2024-03-28 18:23           ` Martin KaFai Lau

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=a402206e-a9c9-40bd-bf78-710054506071@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --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=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=syzbot+1a3cf6f08d68868f9db3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).