lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 8 May 2023 08:30:07 +0200
From:   Mirsad Goran Todorovac <mirsad.goran.todorovac@....hr>
To:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-input@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Jiri Kosina <jikos@...nel.org>
Subject: [BUG] Kmemleak, possibly hiddev_connect(), in 6.3.0+ torvalds tree
 commit gfc4354c6e5c2

Hi,

There seems to be a kernel memory leak in the USB keyboard driver.

The leaked memory allocs are 96 and 512 bytes.

The platform is Ubuntu 22.04 LTS on a assembled AMD Ryzen 9 with X670E 
PG Lightning mobo,
and Genius SlimStar i220 GK-080012 keyboard.

(Logitech M100 HID mouse is not affected by the bug.)

BIOS is:

      *-firmware
           description: BIOS
           vendor: American Megatrends International, LLC.
           physical id: 0
           version: 1.21
           date: 04/26/2023
           size: 64KiB

The kernel is 6.3.0-torvalds-<id>-13466-gfc4354c6e5c2.

The keyboard is recognised as Chicony:

                  *-usb
                       description: Keyboard
                       product: CHICONY USB Keyboard
                       vendor: CHICONY
                       physical id: 2
                       bus info: usb@5:2
                       logical name: input35
                       logical name: /dev/input/event4
                       logical name: input35::capslock
                       logical name: input35::numlock
                       logical name: input35::scrolllock
                       logical name: input36
                       logical name: /dev/input/event5
                       logical name: input37
                       logical name: /dev/input/event6
                       logical name: input38
                       logical name: /dev/input/event8
                       version: 2.30
                       capabilities: usb-2.00 usb
                       configuration: driver=usbhid maxpower=100mA 
speed=1Mbit/s

The bug is easily reproduced by unplugging the USB keyboard, waiting 
about a couple of seconds,
and then reconnect and scan for memory leaks twice.

The kmemleak log is as follows [edited privacy info]:

root@...tname:/home/username# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8dd020037c00 (size 96):
   comm "systemd-udevd", pid 435, jiffies 4294892550 (age 8909.356s)
   hex dump (first 32 bytes):
     5d 8e 4e b9 ff ff ff ff 00 00 00 00 00 00 00 00 ].N.............
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb87543d9>] class_create+0x29/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb8752748>] __driver_attach+0xe8/0x1e0
     [<ffffffffb874f8ee>] bus_for_each_dev+0x7e/0xd0
     [<ffffffffb8751822>] driver_attach+0x22/0x30
     [<ffffffffb8750e70>] bus_add_driver+0x120/0x220
unreferenced object 0xffff8dd015653e00 (size 512):
   comm "systemd-udevd", pid 435, jiffies 4294892550 (age 8909.356s)
   hex dump (first 32 bytes):
     00 3e 65 15 d0 8d ff ff 00 3e 65 15 d0 8d ff ff .>e......>e.....
     00 00 00 00 00 00 00 00 5d 8e 4e b9 ff ff ff ff ........].N.....
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb8754292>] class_register+0x32/0x140
     [<ffffffffb87543f4>] class_create+0x44/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb8752748>] __driver_attach+0xe8/0x1e0
     [<ffffffffb874f8ee>] bus_for_each_dev+0x7e/0xd0
     [<ffffffffb8751822>] driver_attach+0x22/0x30
unreferenced object 0xffff8dd020037f60 (size 96):
   comm "kworker/0:2", pid 496256, jiffies 4295987055 (age 4531.432s)
   hex dump (first 32 bytes):
     5d 8e 4e b9 ff ff ff ff 00 00 00 00 00 00 00 00 ].N.............
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb87543d9>] class_create+0x29/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb87525c2>] __device_attach_driver+0x92/0x120
     [<ffffffffb874f9da>] bus_for_each_drv+0x8a/0xe0
     [<ffffffffb8752ad1>] __device_attach+0xc1/0x1f0
     [<ffffffffb8752ed7>] device_initial_probe+0x17/0x20
unreferenced object 0xffff8dd07df25a00 (size 512):
   comm "kworker/0:2", pid 496256, jiffies 4295987055 (age 4531.500s)
   hex dump (first 32 bytes):
     00 5a f2 7d d0 8d ff ff 00 5a f2 7d d0 8d ff ff .Z.}.....Z.}....
     00 00 00 00 00 00 00 00 5d 8e 4e b9 ff ff ff ff ........].N.....
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb8754292>] class_register+0x32/0x140
     [<ffffffffb87543f4>] class_create+0x44/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb87525c2>] __device_attach_driver+0x92/0x120
     [<ffffffffb874f9da>] bus_for_each_drv+0x8a/0xe0
     [<ffffffffb8752ad1>] __device_attach+0xc1/0x1f0
unreferenced object 0xffff8dd015e66e40 (size 96):
   comm "kworker/1:0", pid 487844, jiffies 4296102566 (age 4069.472s)
   hex dump (first 32 bytes):
     5d 8e 4e b9 ff ff ff ff 00 00 00 00 00 00 00 00 ].N.............
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb87543d9>] class_create+0x29/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb87525c2>] __device_attach_driver+0x92/0x120
     [<ffffffffb874f9da>] bus_for_each_drv+0x8a/0xe0
     [<ffffffffb8752ad1>] __device_attach+0xc1/0x1f0
     [<ffffffffb8752ed7>] device_initial_probe+0x17/0x20
unreferenced object 0xffff8dd0caffe800 (size 512):
   comm "kworker/1:0", pid 487844, jiffies 4296102566 (age 4069.472s)
   hex dump (first 32 bytes):
     00 e8 ff ca d0 8d ff ff 00 e8 ff ca d0 8d ff ff ................
     00 00 00 00 00 00 00 00 5d 8e 4e b9 ff ff ff ff ........].N.....
   backtrace:
     [<ffffffffb81a74be>] __kmem_cache_alloc_node+0x22e/0x2b0
     [<ffffffffb8127b6e>] kmalloc_trace+0x2e/0xa0
     [<ffffffffb8754292>] class_register+0x32/0x140
     [<ffffffffb87543f4>] class_create+0x44/0x80
     [<ffffffffb8880d24>] usb_register_dev+0x1d4/0x2e0
     [<ffffffffc03d7bab>] hiddev_connect+0x11b/0x1b0 [usbhid]
     [<ffffffffc03b6d4e>] hid_connect+0xde/0x580 [hid]
     [<ffffffffc03b724c>] hid_hw_start+0x4c/0x70 [hid]
     [<ffffffffc0388092>] hid_generic_probe+0x32/0x40 [hid_generic]
     [<ffffffffc03b7450>] hid_device_probe+0x100/0x170 [hid]
     [<ffffffffb8752082>] really_probe+0x1b2/0x420
     [<ffffffffb875237e>] __driver_probe_device+0x7e/0x170
     [<ffffffffb87524a3>] driver_probe_device+0x23/0xa0
     [<ffffffffb87525c2>] __device_attach_driver+0x92/0x120
     [<ffffffffb874f9da>] bus_for_each_drv+0x8a/0xe0
     [<ffffffffb8752ad1>] __device_attach+0xc1/0x1f0
root@...tname:/home/username#

Best regards,
Mirsad


Download attachment "config-6.3.0-torvalds-13466-gfc4354c6e5c2.xz" of type "application/x-xz" (56828 bytes)

View attachment "hid-kmemleak.log" of type "text/x-log" (4728 bytes)

View attachment "lshw.txt" of type "text/plain" (58238 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ