* [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors
@ 2024-07-23 8:51 kernel test robot
2024-07-23 22:20 ` Andrey Konovalov
2024-07-23 23:35 ` Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2024-07-23 8:51 UTC (permalink / raw)
To: Andrey Konovalov
Cc: oe-lkp, lkp, linux-kernel, Andrew Morton, Erhard Furtner,
Nico Pache, Marco Elver, Alexander Potapenko, Andrey Ryabinin,
Daniel Axtens, Dmitry Vyukov, linux-hardening, oliver.sang
Hello,
we noticed this is a fix commit, however, we don't have enough knowledge to
determine if new KASAN issue is expected actually after this fix.
so we just made this report FYI what we observed in our tests.
kernel test robot noticed "BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors" on:
commit: 2e577732e8d28b9183df701fb90cb7943aa4ed16 ("kasan, fortify: properly rename memintrinsics")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
[test failed on linus/master 2c9b3512402ed192d1f43f4531fb5da947e72bd0]
[test failed on linux-next/master 41c196e567fb1ea97f68a2ffb7faab451cd90854]
in testcase: boot
compiler: gcc-13
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
+--------------------------------------------------------------------+------------+------------+
| | a38568a0b4 | 2e577732e8 |
+--------------------------------------------------------------------+------------+------------+
| BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors | 0 | 33 |
+--------------------------------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202407231547.389c0ad2-oliver.sang@intel.com
[ 25.773129][ T1] usbcore: registered new device driver usbip-host
[ 25.774597][ T1] ==================================================================
[ 25.775287][ T1] BUG: KASAN: global-out-of-bounds in usb_copy_descriptors+0x15f/0x370
[ 25.776048][ T1] Read of size 192 at addr ffffffff90c3e4c0 by task swapper/0/1
[ 25.776678][ T1]
[ 25.776874][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.9.0-11955-g2e577732e8d2 #1 fc5a69228220b3bda6c63ecfbdf264b31ed62f1e
[ 25.777833][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 25.777833][ T1] Call Trace:
[ 25.777833][ T1] <TASK>
[ 25.777833][ T1] dump_stack_lvl+0x62/0x90
[ 25.777833][ T1] print_address_description+0x55/0x370
[ 25.777833][ T1] ? usb_copy_descriptors+0x15f/0x370
[ 25.777833][ T1] print_report+0xb9/0x2b0
[ 25.777833][ T1] ? __virt_addr_valid+0x213/0x3e0
[ 25.777833][ T1] ? kasan_addr_to_slab+0x1d/0x60
[ 25.777833][ T1] ? usb_copy_descriptors+0x15f/0x370
[ 25.777833][ T1] kasan_report+0xa1/0xe0
[ 25.777833][ T1] ? usb_copy_descriptors+0x15f/0x370
[ 25.777833][ T1] kasan_check_range+0x101/0x1b0
[ 25.777833][ T1] __asan_memcpy+0x1f/0x60
[ 25.777833][ T1] usb_copy_descriptors+0x15f/0x370
[ 25.777833][ T1] usb_assign_descriptors+0xad/0x410
[ 25.777833][ T1] f_audio_bind+0xe25/0x24f0
[ 25.785907][ T1] usb_add_function+0x192/0x4e0
[ 25.785907][ T1] audio_do_config+0xf9/0x160
[ 25.785907][ T1] ? __pfx_audio_do_config+0x10/0x10
[ 25.785907][ T1] usb_add_config+0x38/0x460
[ 25.785907][ T1] audio_bind+0x315/0x540
[ 25.785907][ T1] ? composite_dev_prepare+0x22e/0x410
[ 25.785907][ T1] composite_bind+0x1a9/0x750
[ 25.785907][ T1] gadget_bind_driver+0x211/0xae0
[ 25.785907][ T1] really_probe+0x1c8/0x6a0
[ 25.785907][ T1] __driver_probe_device+0x24c/0x310
[ 25.785907][ T1] driver_probe_device+0x4e/0x210
[ 25.785907][ T1] __device_attach_driver+0x161/0x320
[ 25.793935][ T1] ? __pfx___device_attach_driver+0x10/0x10
[ 25.793935][ T1] bus_for_each_drv+0x114/0x1a0
[ 25.793935][ T1] ? __pfx_bus_for_each_drv+0x10/0x10
[ 25.793935][ T1] ? _raw_spin_unlock_irqrestore+0x3e/0x50
[ 25.793935][ T1] __device_attach+0x199/0x380
[ 25.793935][ T1] ? __pfx___device_attach+0x10/0x10
[ 25.793935][ T1] ? bus_to_subsys+0xd7/0x110
[ 25.793935][ T1] ? do_raw_spin_unlock+0x54/0x1f0
[ 25.793935][ T1] bus_probe_device+0x12f/0x180
[ 25.793935][ T1] device_add+0x98f/0x1010
[ 25.793935][ T1] ? __pfx_device_add+0x10/0x10
[ 25.793935][ T1] ? lockdep_hardirqs_on_prepare+0x275/0x3e0
[ 25.793935][ T1] usb_add_gadget+0x4b4/0x720
[ 25.793935][ T1] usb_add_gadget_udc+0x160/0x1e0
[ 25.793935][ T1] vudc_probe+0x15d/0x230
[ 25.793935][ T1] platform_probe+0x9e/0x140
[ 25.793935][ T1] really_probe+0x1c8/0x6a0
[ 25.801841][ T1] __driver_probe_device+0x24c/0x310
[ 25.801841][ T1] ? acpi_driver_match_device+0xac/0x100
[ 25.801841][ T1] driver_probe_device+0x4e/0x210
[ 25.801841][ T1] __device_attach_driver+0x161/0x320
[ 25.801841][ T1] ? __pfx___device_attach_driver+0x10/0x10
[ 25.801841][ T1] bus_for_each_drv+0x114/0x1a0
[ 25.801841][ T1] ? __pfx_bus_for_each_drv+0x10/0x10
[ 25.801841][ T1] ? _raw_spin_unlock_irqrestore+0x3e/0x50
[ 25.801841][ T1] __device_attach+0x199/0x380
[ 25.801841][ T1] ? __pfx___device_attach+0x10/0x10
[ 25.801841][ T1] ? bus_to_subsys+0xd7/0x110
[ 25.801841][ T1] ? do_raw_spin_unlock+0x54/0x1f0
[ 25.801841][ T1] bus_probe_device+0x12f/0x180
[ 25.801841][ T1] device_add+0x98f/0x1010
[ 25.801841][ T1] ? __pfx_device_add+0x10/0x10
[ 25.801841][ T1] ? __raw_spin_lock_init+0x3b/0x110
[ 25.801841][ T1] platform_device_add+0x376/0x5b0
[ 25.809850][ T1] ? platform_device_alloc+0xc9/0x260
[ 25.809850][ T1] vudc_init+0x7d/0x370
[ 25.809850][ T1] ? __pfx_vudc_init+0x10/0x10
[ 25.809850][ T1] do_one_initcall+0xdf/0x460
[ 25.809850][ T1] ? __pfx_do_one_initcall+0x10/0x10
[ 25.809850][ T1] ? __kmalloc_noprof+0x219/0x430
[ 25.809850][ T1] ? do_initcalls+0x2e/0x3d0
[ 25.809850][ T1] do_initcalls+0x1b6/0x3d0
[ 25.809850][ T1] kernel_init_freeable+0x230/0x3c0
[ 25.809850][ T1] ? __pfx_kernel_init+0x10/0x10
[ 25.809850][ T1] kernel_init+0x1b/0x1e0
[ 25.809850][ T1] ? _raw_spin_unlock_irq+0x24/0x40
[ 25.809850][ T1] ret_from_fork+0x30/0x70
[ 25.809850][ T1] ? __pfx_kernel_init+0x10/0x10
[ 25.809850][ T1] ret_from_fork_asm+0x1a/0x30
[ 25.809850][ T1] </TASK>
[ 25.809850][ T1]
[ 25.809850][ T1] The buggy address belongs to the variable:
[ 25.809850][ T1] ac_header_desc+0x0/0x40
[ 25.809850][ T1]
[ 25.817848][ T1] The buggy address belongs to the physical page:
[ 25.817848][ T1] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10c3e
[ 25.817848][ T1] flags: 0x100000000002000(reserved|node=0|zone=1)
[ 25.817848][ T1] raw: 0100000000002000 ffffea0000430f88 ffffea0000430f88 0000000000000000
[ 25.817848][ T1] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
[ 25.817848][ T1] page dumped because: kasan: bad access detected
[ 25.817848][ T1] page_owner info is not present (never set?)
[ 25.817848][ T1]
[ 25.817848][ T1] Memory state around the buggy address:
[ 25.817848][ T1] ffffffff90c3e380: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
[ 25.817848][ T1] ffffffff90c3e400: 00 00 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
[ 25.817848][ T1] >ffffffff90c3e480: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
[ 25.817848][ T1] ^
[ 25.825831][ T1] ffffffff90c3e500: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
[ 25.825831][ T1] ffffffff90c3e580: 00 00 f9 f9 f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9
[ 25.825831][ T1] ==================================================================
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240723/202407231547.389c0ad2-oliver.sang@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors
2024-07-23 8:51 [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors kernel test robot
@ 2024-07-23 22:20 ` Andrey Konovalov
2024-07-23 23:35 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Konovalov @ 2024-07-23 22:20 UTC (permalink / raw)
To: kernel test robot
Cc: oe-lkp, lkp, linux-kernel, Andrew Morton, Erhard Furtner,
Nico Pache, Marco Elver, Alexander Potapenko, Andrey Ryabinin,
Daniel Axtens, Dmitry Vyukov, linux-hardening
On Tue, Jul 23, 2024 at 10:51 AM kernel test robot
<oliver.sang@intel.com> wrote:
>
> Hello,
>
> we noticed this is a fix commit, however, we don't have enough knowledge to
> determine if new KASAN issue is expected actually after this fix.
> so we just made this report FYI what we observed in our tests.
>
>
> kernel test robot noticed "BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors" on:
>
> commit: 2e577732e8d28b9183df701fb90cb7943aa4ed16 ("kasan, fortify: properly rename memintrinsics")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
Hi,
Yes, that patch might uncover new bugs that previously were not
detectable. There's still a chance that something is wrong with KASAN
and it reports a false positive, but most likely, this report is a
real issue.
Thank you!
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors
2024-07-23 8:51 [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors kernel test robot
2024-07-23 22:20 ` Andrey Konovalov
@ 2024-07-23 23:35 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2024-07-23 23:35 UTC (permalink / raw)
To: kernel test robot
Cc: Andrey Konovalov, oe-lkp, lkp, linux-kernel, Andrew Morton,
Erhard Furtner, Nico Pache, Marco Elver, Alexander Potapenko,
Andrey Ryabinin, Daniel Axtens, Dmitry Vyukov, linux-hardening
On Tue, Jul 23, 2024 at 04:51:36PM +0800, kernel test robot wrote:
> [ 25.775287][ T1] BUG: KASAN: global-out-of-bounds in usb_copy_descriptors+0x15f/0x370
> [ 25.776048][ T1] Read of size 192 at addr ffffffff90c3e4c0 by task swapper/0/1
> ...
> [ 25.777833][ T1] __asan_memcpy+0x1f/0x60
> [ 25.777833][ T1] usb_copy_descriptors+0x15f/0x370
> [ 25.777833][ T1] usb_assign_descriptors+0xad/0x410
> [ 25.777833][ T1] f_audio_bind+0xe25/0x24f0
> [ 25.785907][ T1] usb_add_function+0x192/0x4e0
> [ 25.785907][ T1] audio_do_config+0xf9/0x160
> [ 25.785907][ T1] usb_add_config+0x38/0x460
The memcpy is:
usb_copy_descriptors(struct usb_descriptor_header **src)
...
memcpy(mem, *src, (*src)->bLength);
I can't find a bLength for a struct usb_descriptor_header::bLength that is 192...
...
audio_do_config()
usb_add_function()
function->bind(config, function);
gadget/legacy/audio.c:audio_bind()
usb_add_config()
audio_do_config()
usb_add_function()
function->bind(config, function);
f_audio_bind()
usb_assign_descriptors()
usb_copy_descriptors()
Is this thing in a loop?
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-23 23:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 8:51 [linus:master] [kasan, fortify] 2e577732e8: BUG:KASAN:global-out-of-bounds_in_usb_copy_descriptors kernel test robot
2024-07-23 22:20 ` Andrey Konovalov
2024-07-23 23:35 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox