2024-03-20 01:13:41

by Mirsad Todorovac

[permalink] [raw]
Subject: [BUG] alsa: KMEMLEAK in pulseaudio and alsa-sink-ALC89

Hi,

On Ubuntu 22.04 LTS, with the torvalds tree kernel vanilla v6.8-11167-g4438a810f396,
there is like 660K memory leaks sized 2048 bytes (1.35 GB)

unreferenced object 0xffff919c43c7c800 (size 2048):
unreferenced object 0xffff919c43c78000 (size 2048):
unreferenced object 0xffff919c43c79800 (size 2048):
root@defiant:/home/marvin/linux/kernel/linux_torvalds# grep size ~marvin/linux/kernel_bugs/v6.8-11167/kmemleak.log | wc -l
663265
root@defiant:/home/marvin/linux/kernel/linux_torvalds#

Please find the .config attached.

The kmemleak output is:

unreferenced object 0xffff9199526ba800 (size 2048):
comm "pulseaudio", pid 2533, jiffies 4294900352
hex dump (first 32 bytes):
04 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
backtrace (crc 87c1dcdc):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
unreferenced object 0xffff9199526bd800 (size 2048):
comm "pulseaudio", pid 2533, jiffies 4294900352
hex dump (first 32 bytes):
05 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
backtrace (crc 1e316a87):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
unreferenced object 0xffff919952520000 (size 2048):
comm "pulseaudio", pid 2533, jiffies 4294900356
hex dump (first 32 bytes):
05 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
backtrace (crc 1e316a87):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
.
.
.
unreferenced object 0xffff919947e48000 (size 2048):
comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
hex dump (first 32 bytes):
27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
backtrace (crc f736d9be):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
unreferenced object 0xffff919947e49800 (size 2048):
comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
hex dump (first 32 bytes):
27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
backtrace (crc f736d9be):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
unreferenced object 0xffff919947e49000 (size 2048):
comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
hex dump (first 32 bytes):
27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
backtrace (crc f736d9be):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
unreferenced object 0xffff919947e4c000 (size 2048):
comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
hex dump (first 32 bytes):
27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
backtrace (crc f736d9be):
[<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
[<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
[<ffffffffb20a102b>] memdup_user+0x2b/0xb0
[<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
[<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
[<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
[<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74

Decoded it looks like this:

1 unreferenced object 0xffff9199526ba800 (size 2048):
2 comm "pulseaudio", pid 2533, jiffies 4294900352
3 hex dump (first 32 bytes):
4 04 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
5 49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
6 backtrace (crc 87c1dcdc):
7 kmemleak_alloc+0x4b/0x90
8 __kmalloc_node_track_caller+0x3c7/0x530
9 memdup_user+0x2b/0xb0
10 snd_ctl_ioctl (/home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1281 /home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1945) snd
11 __x64_sys_ioctl+0x9d/0xe0
12 do_syscall_64+0x83/0x150
13 entry_SYSCALL_64_after_hwframe+0x6c/0x74
14 unreferenced object 0xffff9199526bd800 (size 2048):
15 comm "pulseaudio", pid 2533, jiffies 4294900352
16 hex dump (first 32 bytes):
17 05 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
18 49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
19 backtrace (crc 1e316a87):
20 kmemleak_alloc+0x4b/0x90
21 __kmalloc_node_track_caller+0x3c7/0x530
22 memdup_user+0x2b/0xb0
23 snd_ctl_ioctl (/home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1281 /home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1945) snd
24 __x64_sys_ioctl+0x9d/0xe0
25 do_syscall_64+0x83/0x150
26 entry_SYSCALL_64_after_hwframe+0x6c/0x74

2302 unreferenced object 0xffff919947e48000 (size 2048):
2303 comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
2304 hex dump (first 32 bytes):
2305 27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
2306 50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
2307 backtrace (crc f736d9be):
2308 kmemleak_alloc+0x4b/0x90
2309 __kmalloc_node_track_caller+0x3c7/0x530
2310 memdup_user+0x2b/0xb0
2311 snd_ctl_ioctl (/home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1281 /home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1945) snd
2312 __x64_sys_ioctl+0x9d/0xe0
2313 do_syscall_64+0x83/0x150
2314 entry_SYSCALL_64_after_hwframe+0x6c/0x74
2315 unreferenced object 0xffff919947e49800 (size 2048):
2316 comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
2317 hex dump (first 32 bytes):
2318 27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
2319 50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
2320 backtrace (crc f736d9be):
2321 kmemleak_alloc+0x4b/0x90
2322 __kmalloc_node_track_caller+0x3c7/0x530
2323 memdup_user+0x2b/0xb0
2324 snd_ctl_ioctl (/home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1281 /home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1945) snd
2325 __x64_sys_ioctl+0x9d/0xe0
2326 do_syscall_64+0x83/0x150
2327 entry_SYSCALL_64_after_hwframe+0x6c/0x74
2328 unreferenced object 0xffff919947e49000 (size 2048):
2329 comm "alsa-sink-ALC89", pid 2695, jiffies 4294900510
2330 hex dump (first 32 bytes):
2331 27 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 '...............
2332 50 43 4d 20 50 6c 61 79 62 61 63 6b 20 56 6f 6c PCM Playback Vol
2333 backtrace (crc f736d9be):
2334 kmemleak_alloc+0x4b/0x90
2335 __kmalloc_node_track_caller+0x3c7/0x530
2336 memdup_user+0x2b/0xb0
2337 snd_ctl_ioctl (/home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1281 /home/marvin/linux/kernel/linux_torvalds/sound/core/control.c:1945) snd
2338 __x64_sys_ioctl+0x9d/0xe0
2339 do_syscall_64+0x83/0x150
2340 entry_SYSCALL_64_after_hwframe+0x6c/0x74

Hope this helps.

Best regards,
Mirsad Todorovac


Attachments:
kmemleak-v6.8-pulseaudio-alsa-decoded-01.log.xz (3.59 kB)
config-6.8.0-torv-11167-g4438a810f396-dirty.xz (58.22 kB)
Download all attachments

2024-03-20 06:26:54

by Takashi Iwai

[permalink] [raw]
Subject: Re: [BUG] alsa: KMEMLEAK in pulseaudio and alsa-sink-ALC89

On Wed, 20 Mar 2024 02:13:08 +0100,
Mirsad Todorovac wrote:
>
> Hi,
>
> On Ubuntu 22.04 LTS, with the torvalds tree kernel vanilla v6.8-11167-g4438a810f396,
> there is like 660K memory leaks sized 2048 bytes (1.35 GB)
>
> unreferenced object 0xffff919c43c7c800 (size 2048):
> unreferenced object 0xffff919c43c78000 (size 2048):
> unreferenced object 0xffff919c43c79800 (size 2048):
> root@defiant:/home/marvin/linux/kernel/linux_torvalds# grep size ~marvin/linux/kernel_bugs/v6.8-11167/kmemleak.log | wc -l
> 663265
> root@defiant:/home/marvin/linux/kernel/linux_torvalds#
>
> Please find the .config attached.
>
> The kmemleak output is:
>
> unreferenced object 0xffff9199526ba800 (size 2048):
> comm "pulseaudio", pid 2533, jiffies 4294900352
> hex dump (first 32 bytes):
> 04 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
> 49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
> backtrace (crc 87c1dcdc):
> [<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
> [<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
> [<ffffffffb20a102b>] memdup_user+0x2b/0xb0
> [<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
> [<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
> [<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
> [<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74

Thanks for the report. This was indeed an overlooked marking of
__free(kfree). I'll submit the fix patch.


Takashi

2024-03-20 18:58:19

by Mirsad Todorovac

[permalink] [raw]
Subject: Re: [BUG] alsa: KMEMLEAK in pulseaudio and alsa-sink-ALC89

On 3/20/24 07:26, Takashi Iwai wrote:
> On Wed, 20 Mar 2024 02:13:08 +0100,
> Mirsad Todorovac wrote:
>>
>> Hi,
>>
>> On Ubuntu 22.04 LTS, with the torvalds tree kernel vanilla v6.8-11167-g4438a810f396,
>> there is like 660K memory leaks sized 2048 bytes (1.35 GB)
>>
>> unreferenced object 0xffff919c43c7c800 (size 2048):
>> unreferenced object 0xffff919c43c78000 (size 2048):
>> unreferenced object 0xffff919c43c79800 (size 2048):
>> root@defiant:/home/marvin/linux/kernel/linux_torvalds# grep size ~marvin/linux/kernel_bugs/v6.8-11167/kmemleak.log | wc -l
>> 663265
>> root@defiant:/home/marvin/linux/kernel/linux_torvalds#
>>
>> Please find the .config attached.
>>
>> The kmemleak output is:
>>
>> unreferenced object 0xffff9199526ba800 (size 2048):
>> comm "pulseaudio", pid 2533, jiffies 4294900352
>> hex dump (first 32 bytes):
>> 04 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 ................
>> 49 45 43 39 35 38 20 50 6c 61 79 62 61 63 6b 20 IEC958 Playback
>> backtrace (crc 87c1dcdc):
>> [<ffffffffb2fa477b>] kmemleak_alloc+0x4b/0x90
>> [<ffffffffb210e517>] __kmalloc_node_track_caller+0x3c7/0x530
>> [<ffffffffb20a102b>] memdup_user+0x2b/0xb0
>> [<ffffffffc0746d56>] snd_ctl_ioctl+0x726/0x860 [snd]
>> [<ffffffffb21bed6d>] __x64_sys_ioctl+0x9d/0xe0
>> [<ffffffffb2f93d33>] do_syscall_64+0x83/0x150
>> [<ffffffffb3000121>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
>
> Thanks for the report. This was indeed an overlooked marking of
> __free(kfree). I'll submit the fix patch.
>
> Takashi

Not at all, thanks for such an early response.

I understand the problems with the incremental development. Actually, great it was caught before
the release ;-)

Best regards,
Mirsad Todorovac