public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* KASAN: slab-out-of-bounds Read in ntfs_attr_find
@ 2018-04-02 17:01 syzbot
  2019-11-28  6:52 ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2018-04-02 17:01 UTC (permalink / raw)
  To: anton, linux-kernel, linux-ntfs-dev, syzkaller-bugs

Hello,

syzbot hit the following crash on upstream commit
0adb32858b0bddf4ada5f364a84ed60b196dbcda (Sun Apr 1 21:20:27 2018 +0000)
Linux 4.16
syzbot dashboard link:  
https://syzkaller.appspot.com/bug?extid=aed06913f36eff9b544e

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5967192604540928
syzkaller reproducer:  
https://syzkaller.appspot.com/x/repro.syz?id=5683233123467264
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=6754575268708352
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=-2374466361298166459
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+aed06913f36eff9b544e@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.
If you forward the report, please keep this part and the footer.

ntfs: (device loop0): is_boot_sector_ntfs(): Invalid end of sector marker.
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_attr_find+0x99a/0xa00  
fs/ntfs/attrib.c:613
Read of size 4 at addr ffff8801d96bfbb5 by task syzkaller786329/4469

CPU: 0 PID: 4469 Comm: syzkaller786329 Not tainted 4.16.0+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x24d lib/dump_stack.c:53
  print_address_description+0x73/0x250 mm/kasan/report.c:256
  kasan_report_error mm/kasan/report.c:354 [inline]
  kasan_report+0x23c/0x360 mm/kasan/report.c:412
  __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:443
  ntfs_attr_find+0x99a/0xa00 fs/ntfs/attrib.c:613
  ntfs_attr_lookup+0x10e1/0x22a0 fs/ntfs/attrib.c:1203
  ntfs_read_inode_mount+0x6cd/0x20f0 fs/ntfs/inode.c:1858
  ntfs_fill_super+0x13df/0x2fb0 fs/ntfs/super.c:2871
  mount_bdev+0x2b7/0x370 fs/super.c:1119
  ntfs_mount+0x34/0x40 fs/ntfs/super.c:3065
  mount_fs+0x66/0x2d0 fs/super.c:1222
  vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
  vfs_kern_mount fs/namespace.c:2509 [inline]
  do_new_mount fs/namespace.c:2512 [inline]
  do_mount+0xea4/0x2bb0 fs/namespace.c:2842
  SYSC_mount fs/namespace.c:3058 [inline]
  SyS_mount+0xab/0x120 fs/namespace.c:3035
  do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x442eca
RSP: 002b:00007ffce22e1a98 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000442eca
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffce22e1aa0
RBP: 00000000006cb018 R08: 000000002007e200 R09: 000000000000000a
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000004
R13: 0000000000401dc0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 2834:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
  set_track mm/kasan/kasan.c:459 [inline]
  kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:552
  __do_kmalloc_node mm/slab.c:3670 [inline]
  __kmalloc_node+0x47/0x70 mm/slab.c:3677
  kmalloc_node include/linux/slab.h:554 [inline]
  kvmalloc_node+0x99/0xd0 mm/util.c:419
  kvmalloc include/linux/mm.h:541 [inline]
  seq_buf_alloc fs/seq_file.c:29 [inline]
  seq_read+0x7fc/0x1410 fs/seq_file.c:208
  __vfs_read+0xef/0xa00 fs/read_write.c:411
  vfs_read+0x11e/0x350 fs/read_write.c:447
  SYSC_read fs/read_write.c:573 [inline]
  SyS_read+0xef/0x220 fs/read_write.c:566
  do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2834:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
  set_track mm/kasan/kasan.c:459 [inline]
  __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
  kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
  __cache_free mm/slab.c:3486 [inline]
  kfree+0xd9/0x260 mm/slab.c:3801
  kvfree+0x36/0x60 mm/util.c:438
  seq_release fs/seq_file.c:368 [inline]
  single_release+0x78/0xb0 fs/seq_file.c:605
  __fput+0x327/0x7e0 fs/file_table.c:209
  ____fput+0x15/0x20 fs/file_table.c:243
  task_work_run+0x199/0x270 kernel/task_work.c:113
  tracehook_notify_resume include/linux/tracehook.h:191 [inline]
  exit_to_usermode_loop+0x275/0x2f0 arch/x86/entry/common.c:166
  prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
  do_syscall_64+0x6ec/0x940 arch/x86/entry/common.c:292
  entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d96be180
  which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2613 bytes to the right of
  4096-byte region [ffff8801d96be180, ffff8801d96bf180)
The buggy address belongs to the page:
page:ffffea000765af80 count:1 mapcount:0 mapping:ffff8801d96be180 index:0x0  
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801d96be180 0000000000000000 0000000100000001
raw: ffffea0006b1b820 ffffea0007622ba0 ffff8801dac00dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff8801d96bfa80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff8801d96bfb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8801d96bfb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                      ^
  ffff8801d96bfc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff8801d96bfc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzkaller@googlegroups.com.

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is  
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* KASAN: slab-out-of-bounds Read in ntfs_attr_find
@ 2023-02-22  4:45 Palash Oswal
  0 siblings, 0 replies; 3+ messages in thread
From: Palash Oswal @ 2023-02-22  4:45 UTC (permalink / raw)
  To: anton, LKML, linux-ntfs-dev, syzkaller-bugs

Hello,
I found the following issue using syzkaller on:
HEAD commit : e60276b8c11ab4a8be23807bc67b04
8cfb937dfa (v6.0.8)
git tree: stable

C Reproducer : https://gist.github.com/oswalpalash/cb298c137f3dbfb95a609671a61103fb
Kernel .config :
https://gist.github.com/oswalpalash/0962c70d774e5ec736a047bba917cecb

I found a related discussion in the past about a similar bug here :
https://groups.google.com/g/syzkaller-bugs/c/BFLa1ZwXyG0/m/UIh6Pl2GBAAJ

Console log :

loop3: detected capacity change from 0 to 4096
==================================================================
BUG: KASAN: slab-out-of-bounds in ntfs_attr_find+0xb87/0xce0
Read of size 2 at addr ffff888106fc30ab by task syz-executor.3/11599

CPU: 0 PID: 11599 Comm: syz-executor.3 Not tainted 6.0.8-pasta #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xcd/0x134
 print_report.cold+0xe5/0x63a
 kasan_report+0x8a/0x1b0
 ntfs_attr_find+0xb87/0xce0
 ntfs_attr_lookup+0x1051/0x2040
 ntfs_read_locked_inode+0xb0c/0x5ab0
 ntfs_iget+0x12d/0x180
 ntfs_fill_super+0x1ed0/0x8590
 mount_bdev+0x34d/0x410
 legacy_get_tree+0x105/0x220
 vfs_get_tree+0x89/0x2f0
 path_mount+0x121b/0x1cb0
 do_mount+0xf3/0x110
 __x64_sys_mount+0x18f/0x230
 do_syscall_64+0x35/0xb0
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f0e85e9146e
Code: 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f
84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0e849fda08 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007f0e85e9146e
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f0e849fda60
RBP: 00007f0e849fdaa0 R08: 00007f0e849fdaa0 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000020000000
R13: 0000000020000100 R14: 00007f0e849fda60 R15: 0000000020000040
 </TASK>

Allocated by task 1:
 kasan_save_stack+0x1e/0x40
 __kasan_slab_alloc+0x85/0xb0
 kmem_cache_alloc+0x204/0xcc0
 __kernfs_new_node+0xd4/0x8b0
 kernfs_new_node+0x93/0x120
 __kernfs_create_file+0x51/0x350
 sysfs_add_file_mode_ns+0x20f/0x3f0
 internal_create_group+0x314/0xba0
 internal_create_groups.part.0+0x90/0x140
 sysfs_create_groups+0x25/0x50
 kobject_add_internal+0x318/0x8f0
 kobject_init_and_add+0x101/0x160
 netdev_queue_update_kobjects+0x1fe/0x4e0
 netdev_register_kobject+0x333/0x400
 register_netdevice+0xbe9/0x1390
 bond_create+0xb4/0x120
 bonding_init+0x9f/0x114
 do_one_initcall+0xfe/0x650
 kernel_init_freeable+0x6c3/0x74c
 kernel_init+0x1a/0x1d0
 ret_from_fork+0x1f/0x30

The buggy address belongs to the object at ffff888106fc3000
 which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 3 bytes to the right of
 168-byte region [ffff888106fc3000, ffff888106fc30a8)

The buggy address belongs to the physical page:
page:ffffea00041bf0c0 refcount:1 mapcount:0 mapping:0000000000000000
index:0x0 pfn:0x106fc3
flags: 0x57ff00000000200(slab|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000000200 ffffea00041bc848 ffffea00041a9fc8 ffff88810006f200
raw: 0000000000000000 ffff888106fc3000 0000000100000011 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask
0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE),
pid 1, tgid 1 (swapper/0), ts 8385653965, free_ts 0
 prep_new_page+0x2c6/0x350
 get_page_from_freelist+0xae9/0x3a80
 __alloc_pages+0x321/0x710
 cache_grow_begin+0x75/0x360
 kmem_cache_alloc+0xb69/0xcc0
 __kernfs_new_node+0xd4/0x8b0
 kernfs_new_node+0x93/0x120
 kernfs_create_dir_ns+0x48/0x150
 sysfs_create_dir_ns+0x127/0x290
 kobject_add_internal+0x2c9/0x8f0
 kobject_init_and_add+0x101/0x160
 net_rx_queue_update_kobjects+0x264/0x510
 netdev_register_kobject+0x278/0x400
 register_netdevice+0xbe9/0x1390
 bond_create+0xb4/0x120
 bonding_init+0x9f/0x114
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888106fc2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888106fc3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888106fc3080: 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00
                                  ^
 ffff888106fc3100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888106fc3180: 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00 00
==================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-22  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-02 17:01 KASAN: slab-out-of-bounds Read in ntfs_attr_find syzbot
2019-11-28  6:52 ` syzbot
  -- strict thread matches above, loose matches on Subject: below --
2023-02-22  4:45 Palash Oswal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox