Bug 1911 - [ANCK-5.10 2208-rc1][anolis8][x86_64][debug内核]多次重启VM,kmemleak检测疑似有12处内存泄漏
Summary: [ANCK-5.10 2208-rc1][anolis8][x86_64][debug内核]多次重启VM,kmemleak检测疑似有12处内存泄漏
Status: RESOLVED FIXED
Alias: None
Product: ANCK 5.10 Dev
Classification: ANCK
Component: general/others (show other bugs) general/others
Version: 5.10.y-12
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: xuyu
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-16 16:03 UTC by zhixin01
Modified: 2022-09-05 09:48 UTC (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhixin01 2022-08-16 16:03:43 UTC
Description of problem:
从host主机多次重启VM,kmemleak检测疑似有12处内存泄漏

dmesg日志:
[root@VM20210305-16 ~]# dmesg |grep memleak
[    0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.10.134-12_rc1.an8.x86_64+debug root=UUID=169a0746-c62d-49a2-bd6b-0eaec098d42c ro crashkernel=2G crash_kexec_post_notifiers rhgb slub_debug=FPZU kmemleak=on console=tty0 console=ttyS0,115200 console=ttyAMA0,115200n8
[    1.624500] Kernel command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.10.134-12_rc1.an8.x86_64+debug root=UUID=169a0746-c62d-49a2-bd6b-0eaec098d42c ro crashkernel=2G crash_kexec_post_notifiers rhgb slub_debug=FPZU kmemleak=on console=tty0 console=ttyS0,115200 console=ttyAMA0,115200n8
[   54.179832] kmemleak: Kernel memory leak detector initialized (mem pool available: 14148)
[   54.179841] kmemleak: Automatic memory scanning thread started
[  786.563659] kmemleak: 12 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

/sys/kernel/debug/kmemleak日志:
[root@VM20210305-16 ~]# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff88812badbe00 (size 512):
  comm "swapper/0", pid 1, jiffies 4294688037 (age 1776.176s)
  hex dump (first 32 bytes):
    00 c0 dc 06 81 88 ff ff 03 00 00 00 05 00 00 00  ................
    03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000442f156a>] selinux_sb_alloc_security+0x44/0x200
    [<000000007369f053>] security_sb_alloc+0x3c/0x80
    [<000000000f1b150a>] alloc_super+0x17c/0x9f0
    [<00000000664da278>] sget_fc+0x113/0x6e0
    [<000000008af236a6>] vfs_get_super+0x61/0x2b0
    [<00000000a14f5713>] vfs_get_tree+0x86/0x2d0
    [<00000000cffb5339>] fc_mount+0xf/0x90
    [<000000005c5a2071>] vfs_kern_mount.part.38+0x5c/0x90
    [<000000002f43995e>] kern_mount+0x42/0xa0
    [<000000009897353a>] init_sel_fs+0x136/0x1ef
    [<000000007df5d583>] do_one_initcall+0xf9/0x550
    [<00000000c86a8540>] kernel_init_freeable+0x672/0x6ed
    [<00000000a206f47b>] kernel_init+0xc/0x13b
    [<00000000947b3751>] ret_from_fork+0x1f/0x30
unreferenced object 0xffff8881076b4eb8 (size 8):
  comm "(journald)", pid 291, jiffies 4294718446 (age 1745.784s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000009c322877>] keyring_alloc+0x26/0x70
    [<000000007aab0b61>] install_session_keyring_to_cred+0x137/0x1d0
    [<00000000cbe564fe>] join_session_keyring+0x1df/0x2c0
    [<00000000119fbfec>] keyctl_join_session_keyring+0x5e/0x80
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff8881076b4760 (size 8):
  comm "(journald)", pid 291, jiffies 4294718447 (age 1745.783s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000008e995b0f>] key_create_or_update+0x52b/0xa70
    [<000000003f235625>] __x64_sys_add_key+0x20d/0x3b0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff888104cb11a8 (size 8):
  comm "(lymouthd)", pid 401, jiffies 4294730285 (age 1733.964s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000009c322877>] keyring_alloc+0x26/0x70
    [<000000007aab0b61>] install_session_keyring_to_cred+0x137/0x1d0
    [<00000000cbe564fe>] join_session_keyring+0x1df/0x2c0
    [<00000000119fbfec>] keyctl_join_session_keyring+0x5e/0x80
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff888104cb0d40 (size 8):
  comm "(lymouthd)", pid 401, jiffies 4294730285 (age 1733.964s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000008e995b0f>] key_create_or_update+0x52b/0xa70
    [<000000003f235625>] __x64_sys_add_key+0x20d/0x3b0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff88813a02c9e0 (size 32):
  comm "plymouthd", pid 409, jiffies 4294730348 (age 1733.929s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 00 00 03 00 00 00 18 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000ffefb509>] selinux_sk_alloc_security+0x7e/0x1c0
    [<000000008b3c21b1>] security_sk_alloc+0x4c/0x90
    [<00000000a9b75f6b>] sk_prot_alloc+0x7f/0x260
    [<00000000e9799949>] sk_alloc+0x35/0xe90
    [<000000007e934823>] unix_create1+0x9f/0x530
    [<000000001cf5a151>] unix_create+0x127/0x1d0
    [<0000000086e6f276>] __sock_create+0x3a8/0x890
    [<000000002bebbca9>] __sys_socket+0xcc/0x1a0
    [<00000000a06b6cad>] __x64_sys_socket+0x6f/0xb0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff8881386c21c0 (size 32):
  comm "(ystemctl)", pid 523, jiffies 4294740943 (age 1723.347s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 00 00 01 00 00 00 18 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000ffefb509>] selinux_sk_alloc_security+0x7e/0x1c0
    [<000000008b3c21b1>] security_sk_alloc+0x4c/0x90
    [<00000000a9b75f6b>] sk_prot_alloc+0x7f/0x260
    [<00000000e9799949>] sk_alloc+0x35/0xe90
    [<000000007e934823>] unix_create1+0x9f/0x530
    [<000000001cf5a151>] unix_create+0x127/0x1d0
    [<0000000086e6f276>] __sock_create+0x3a8/0x890
    [<000000002bebbca9>] __sys_socket+0xcc/0x1a0
    [<00000000a06b6cad>] __x64_sys_socket+0x6f/0xb0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff8881386c26a0 (size 32):
  comm "(ystemctl)", pid 523, jiffies 4294740944 (age 1723.346s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 00 00 01 00 00 00 18 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000ffefb509>] selinux_sk_alloc_security+0x7e/0x1c0
    [<000000008b3c21b1>] security_sk_alloc+0x4c/0x90
    [<00000000a9b75f6b>] sk_prot_alloc+0x7f/0x260
    [<00000000e9799949>] sk_alloc+0x35/0xe90
    [<000000007e934823>] unix_create1+0x9f/0x530
    [<00000000154b2bfd>] unix_stream_connect+0x1a4/0x1590
    [<00000000ed72ef01>] __sys_connect+0xfa/0x130
    [<0000000052569bc3>] __x64_sys_connect+0x6f/0xb0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff888107434d40 (size 8):
  comm "(ystemctl)", pid 523, jiffies 4294740959 (age 1723.331s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000009c322877>] keyring_alloc+0x26/0x70
    [<000000007aab0b61>] install_session_keyring_to_cred+0x137/0x1d0
    [<00000000cbe564fe>] join_session_keyring+0x1df/0x2c0
    [<00000000119fbfec>] keyctl_join_session_keyring+0x5e/0x80
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff888107435788 (size 8):
  comm "(ystemctl)", pid 523, jiffies 4294740960 (age 1723.359s)
  hex dump (first 8 bytes):
    01 00 00 00 00 00 00 00                          ........
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000d66213b7>] selinux_key_alloc+0x4b/0x1b0
    [<0000000038c65696>] security_key_alloc+0x4c/0x90
    [<000000009308491e>] key_alloc+0x721/0xfc0
    [<000000008e995b0f>] key_create_or_update+0x52b/0xa70
    [<000000003f235625>] __x64_sys_add_key+0x20d/0x3b0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff88813f4b2360 (size 32):
  comm "systemctl", pid 523, jiffies 4294741048 (age 1723.271s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 00 00 01 00 00 00 18 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000ffefb509>] selinux_sk_alloc_security+0x7e/0x1c0
    [<000000008b3c21b1>] security_sk_alloc+0x4c/0x90
    [<00000000a9b75f6b>] sk_prot_alloc+0x7f/0x260
    [<00000000e9799949>] sk_alloc+0x35/0xe90
    [<000000007e934823>] unix_create1+0x9f/0x530
    [<000000001cf5a151>] unix_create+0x127/0x1d0
    [<0000000086e6f276>] __sock_create+0x3a8/0x890
    [<000000002bebbca9>] __sys_socket+0xcc/0x1a0
    [<00000000a06b6cad>] __x64_sys_socket+0x6f/0xb0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
unreferenced object 0xffff88813f4b29e0 (size 32):
  comm "systemctl", pid 523, jiffies 4294741048 (age 1723.271s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 00 00 01 00 00 00 18 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000600794e5>] kmem_cache_alloc_trace+0x128/0x260
    [<00000000ffefb509>] selinux_sk_alloc_security+0x7e/0x1c0
    [<000000008b3c21b1>] security_sk_alloc+0x4c/0x90
    [<00000000a9b75f6b>] sk_prot_alloc+0x7f/0x260
    [<00000000e9799949>] sk_alloc+0x35/0xe90
    [<000000007e934823>] unix_create1+0x9f/0x530
    [<00000000154b2bfd>] unix_stream_connect+0x1a4/0x1590
    [<00000000ed72ef01>] __sys_connect+0xfa/0x130
    [<0000000052569bc3>] __x64_sys_connect+0x6f/0xb0
    [<0000000023cbc3c8>] do_syscall_64+0x30/0x40
    [<00000000e494ebc4>] entry_SYSCALL_64_after_hwframe+0x61/0xc6

Version-Release number of selected component (if applicable):
[root@VM20210305-16 ~]# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.4"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.4"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.4"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

[root@VM20210305-16 ~]# uname -r
5.10.134-12_rc1.an8.x86_64+debug

cpu信息:
[root@VM20210305-16 ~]# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           2
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Alibaba Cloud
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
BIOS Model name:     pc-i440fx-2.1
Stepping:            7
CPU MHz:             2499.998
BogoMIPS:            4999.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            36608K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_vnni

内存信息:
[root@VM20210305-16 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           11Gi       955Mi       9.9Gi        17Mi       463Mi        10Gi
Swap:            0B          0B          0B

How reproducible:
1、从host主机上多次重启虚机,每次查看dmesg是否包含kmemleak内存泄漏信息

Steps to Reproduce:
1.从host主机上多次重启虚机
2.查看dmesg是否包含kmemleak内存泄漏信息

Actual results:
kmemleak检测疑似有12处内存泄漏

Expected results:
无内存泄漏

Additional info:
Comment 1 xuyu alibaba_cloud_group 2022-08-25 14:27:04 UTC
selinux kmemleak 每个版本都会测出来。

对于 selinux kmemleak,找到 RFC 和 社区的讨论,https://lore.kernel.org/lkml/70f2c67a-eb8a-5c28-9f78-838b397370b3@schaufler-ca.com/T/#mc653cca5cb0a67842ac8c1479701c22adf49fbe0

reviewer 认为 “I think that the trivial memory leak here is inconsequential compared to the overhead you're introducing by leaving the NO_DEL hooks enabled.”,翻译过来就是这里的 kmemleak 是微不足道、无关紧要的,就没有合入这个 patch。

因此我们也暂时先放过 selinux kmemleak。