On Fri, Feb 09, 2024 at 10:08:27AM -0800, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: 445a555e0623 Add linux-next specific files for 20240209 > git tree: linux-next > console+strace: https://syzkaller.appspot.com/x/log.txt?x=147c85b8180000 > kernel config: https://syzkaller.appspot.com/x/.config?x=85aa3388229f9ea9 > dashboard link: https://syzkaller.appspot.com/bug?extid=96f61f1ad84e33cee93e > 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=178b1e20180000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=143db9f4180000 > > Downloadable assets: > disk image: https://storage.googleapis.com/syzbot-assets/9188bb84c998/disk-445a555e.raw.xz > vmlinux: https://storage.googleapis.com/syzbot-assets/3ce0c98eabb2/vmlinux-445a555e.xz > kernel image: https://storage.googleapis.com/syzbot-assets/ab801b1c1d6d/bzImage-445a555e.xz > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+96f61f1ad84e33cee93e@xxxxxxxxxxxxxxxxxxxxxxxxx > > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 5075 at block/bdev.c:930 blk_to_file_flags block/bdev.c:930 [inline] > WARNING: CPU: 1 PID: 5075 at block/bdev.c:930 bdev_file_open_by_dev+0x112/0x270 block/bdev.c:963 > Modules linked in: > CPU: 1 PID: 5075 Comm: syz-executor215 Not tainted 6.8.0-rc3-next-20240209-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 > RIP: 0010:blk_to_file_flags block/bdev.c:930 [inline] So, the gist is O_* flags are annoying. The longer story is that you can open any file with int fd = open("bla", O_RDWR | O_WRONLY). That's mostly nonsensical. But the VFS layer will record file->f_flags |= O_RDWR | O_WRONLY. And for the block layer this translates to BLK_OPEN_WRITE_IOCTL. Which is meaningless except for the floppy driver from When The West Was One. So we need to account for that nonsense when we translate block flags bag into O_* flags. Fix pushed.