[BUG] mem leak (not: info leak) in perf (kernel 4.0.0-rc2)

From: Robert ÅwiÄcki
Date: Thu Mar 12 2015 - 13:15:16 EST


Hi,

I suppose I observe a substantial mem leak in the kernel while using
perf_event_open()

Reproducible under:
Kernel: $ uname -a
Linux test1 4.0.0-0.rc2.git0.1.fc22.x86_64 #1 SMP Tue Mar 3 21:24:17
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Not reproducible under:
Linux test2 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15
17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Repro - with: https://code.google.com/p/honggfuzz/source/checkout

Note: It might be related to the CPU, as Intel vs AMD code differs in
a few places here. I tested it under Intel only though.

$ ~/src/honggfuzz/honggfuzz -Di -f /bin/ls -s -- /bin/ls
...

$ while [ 1 ]; do cat /proc/meminfo | grep -E "Stack|Slab"; sleep 1; done
Slab: 437584 kB
KernelStack: 1037472 kB
Slab: 439160 kB
KernelStack: 1046528 kB
Slab: 443036 kB
KernelStack: 1055488 kB
Slab: 446360 kB
KernelStack: 1065888 kB
Slab: 448540 kB
KernelStack: 1073008 kB
Slab: 452428 kB
KernelStack: 1082912 kB
Slab: 455548 kB
KernelStack: 1094640 kB
Slab: 458620 kB
KernelStack: 1102448 kB
Slab: 462488 kB
KernelStack: 1114752 kB
Slab: 466632 kB
KernelStack: 1123936 kB
Slab: 468024 kB
KernelStack: 1129040 kB
Slab: 470780 kB
KernelStack: 1135712 kB
Slab: 473148 kB
KernelStack: 1145856 kB
Slab: 477684 kB
KernelStack: 1156528 kB
Slab: 480804 kB
KernelStack: 1165904 kB
Slab: 482524 kB
KernelStack: 1174032 kB
Slab: 485496 kB
KernelStack: 1183120 kB

# slabtop
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
90528 90528 100% 2.47K 7544 12 241408K task_struct

[a few sec sleep]

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
97356 97356 100% 2.47K 8113 12 259616K task_struct

[a few sec sleep]

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
103668 103668 100% 2.47K 8639 12 276448K task_struct

It seems to be not released after all involved processes have terminated.

Will try to debug it more, but others might see some obvious problem here.

--
Robert ÅwiÄcki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/