[缺陷描述]: bpftrace-test:watchpoint.unique_probe_bodies测试无法正常结束,串口有异常打印; 非近期新增失败,之前因为watchpoint - knl absolute addres导致系统挂死问题,watchpoint下的用例一直未测试; 串口部分异常日志如下: # [ 2808.237988] systemd-journal: page allocation failure: order:7, mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0 [ 2808.242321] CPU: 3 PID: 568 Comm: systemd-journal Kdump: loaded Not tainted 5.10.134-865.git.51f208302af3.al8.aarch64 #1 [ 2808.244557] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 0.0.0 02/06/2015 [ 2808.245782] Call trace: [ 2808.245985] dump_backtrace+0x0/0x1e0 [ 2808.246722] show_stack+0x1c/0x24 [ 2808.248394] dump_stack+0xcc/0x120 [ 2808.248727] warn_alloc+0x140/0x1b0 [ 2808.250211] __alloc_pages_slowpath.constprop.0+0x73c/0x760 [ 2808.250731] __alloc_pages_nodemask+0x2b4/0x310 [ 2808.252405] alloc_pages_current+0x8c/0x130 [ 2808.255172] kmalloc_order+0x34/0x140 [ 2808.257865] kmalloc_order_trace+0x30/0x114 [ 2808.258501] __kmalloc+0x314/0x360 [ 2808.258870] __regset_get+0x98/0x100 [ 2808.259434] regset_get_alloc+0x18/0x20 [ 2808.259873] fill_thread_core_info+0x128/0x1e0 [ 2808.260331] fill_note_info+0x1d0/0x34c [ 2808.261672] elf_core_dump+0x6c/0x330 [ 2808.262082] do_coredump+0x294/0x7e4 [ 2808.262500] get_signal+0x580/0x790 [ 2808.262849] do_signal+0x128/0x1e0 [ 2808.263219] do_notify_resume+0x138/0x25c [ 2808.265599] work_pending+0xc/0x50 [ 2808.267210] Mem-Info: [ 2808.267871] active_anon:161 inactive_anon:3958336 isolated_anon:0 [ 2808.267871] active_file:1263 inactive_file:2987 isolated_file:89 [ 2808.267871] unevictable:0 dirty:1 writeback:0 [ 2808.267871] slab_reclaimable:5134 slab_unreclaimable:8505 [ 2808.267871] mapped:1011 shmem:173 pagetables:9316 bounce:0 [ 2808.267871] free:24659 free_pcp:1078 free_cma:7434 [ 2808.275436] Node 0 active_anon:644kB inactive_anon:15833344kB active_file:6032kB inactive_file:10516kB unevictable:0kB isolated(anon):0kB isolated(file):356kB mapped:4044kB dirty:4kB writeback:0kB shmem:692kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 239616kB writeback_tmp:0kB kernel_stack:8096kB all_unreclaimable? no [ 2808.278961] Node 0 DMA free:59724kB min:7904kB low:10720kB high:13536kB reserved_highatomic:0KB active_anon:0kB inactive_anon:2751280kB active_file:0kB inactive_file:672kB unevictable:0kB writepending:0kB present:3145728kB managed:2818048kB mlocked:0kB pagetables:0kB bounce:0kB free_pcp:420kB local_pcp:420kB free_cma:29736kB [ 2808.282409] lowmem_reserve[]: 0 0 12963 12963 [ 2808.282835] Node 0 Normal free:38912kB min:37148kB low:50388kB high:63628kB reserved_highatomic:2048KB active_anon:644kB inactive_anon:13082064kB active_file:7168kB inactive_file:9092kB unevictable:0kB writepending:4kB present:13631488kB managed:13274928kB mlocked:0kB pagetables:37264kB bounce:0kB free_pcp:4588kB local_pcp:980kB free_cma:0kB [ 2808.286227] lowmem_reserve[]: 0 0 0 0 [ 2808.286547] Node 0 DMA: 46*4kB (UME) 33*8kB (UME) 8*16kB (UME) 10*32kB (UME) 4*64kB (UME) 5*128kB (UME) 4*256kB (UME) 2*512kB (UM) 3*1024kB (UME) 2*2048kB (UE) 12*4096kB (M) = 60160kB [ 2808.288489] Node 0 Normal: 1850*4kB (UEH) 1218*8kB (UMEH) 575*16kB (UMEH) 243*32kB (UMEH) 69*64kB (UMEH) 1*128kB (M) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 38664kB [ 2808.290135] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB [ 2808.291088] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB [ 2808.291754] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 2808.292423] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB [ 2808.293373] 4549 total pagecache pages [ 2808.293736] 0 pages in swap cache [ 2808.294300] Swap cache stats: add 0, delete 0, find 0/0 [ 2808.294989] Free swap = 0kB [ 2808.295252] Total swap = 0kB [ 2808.295482] 4194304 pages RAM [ 2808.295705] 0 pages HighMem/MovableOnly [ 2808.296054] 171060 pages reserved [ 2808.296480] 16384 pages cma reserved [ 2808.297138] 0 pages hwpoisoned [ 3186.455200] systemd[1]: systemd-journald.service: State 'stop-sigabrt' timed out. Terminating. [ 3952.061769] argusagent invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0 [ 3952.062656] CPU: 2 PID: 17236 Comm: argusagent Kdump: loaded Not tainted 5.10.134-865.git.51f208302af3.al8.aarch64 #1 [ 3952.063471] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 0.0.0 02/06/2015 [ 3952.064023] Call trace: [ 3952.064213] dump_backtrace+0x0/0x1e0 [ 3952.064490] show_stack+0x1c/0x24 [ 3952.064743] dump_stack+0xcc/0x120 [ 3952.065003] dump_header+0x3c/0x44 [ 3952.065267] dump_global_header+0x20/0xe8 [ 3952.065626] oom_kill_process+0x258/0x274 [ 3952.065983] out_of_memory+0x100/0x3d0 [ 3952.066316] __alloc_pages_may_oom+0x11c/0x19c [ 3952.066707] __alloc_pages_slowpath.constprop.0+0x4bc/0x760 [ 3952.067195] __alloc_pages_nodemask+0x2b4/0x310 [ 3952.067612] alloc_pages_current+0x8c/0x130 [ 3952.067976] pagecache_get_page+0x280/0x3f0 [ 3952.068344] filemap_fault+0x544/0x724 [ 3952.068704] ext4_filemap_fault+0x38/0x99c [ext4] [ 3952.069121] __do_fault+0x40/0x1c4 [ 3952.069430] do_read_fault+0x5c/0x1dc [ 3952.069766] do_fault+0x8c/0x180 [ 3952.070201] handle_pte_fault+0x84/0x250 [ 3952.070842] __handle_mm_fault+0x194/0x400 [ 3952.071915] handle_mm_fault+0xa0/0x200 [ 3952.072321] do_page_fault+0x16c/0x394 [ 3952.072699] do_translation_fault+0xac/0xc8 [ 3952.073066] do_mem_abort+0x44/0xa0 [ 3952.073374] el0_ia+0x68/0xdc [ 3952.073645] el0_sync_handler+0x90/0xb0 [ 3952.073991] el0_sync+0x168/0x180 [ 3952.075547] Mem-Info: [ 3952.076702] active_anon:164 inactive_anon:3959233 isolated_anon:0 [ 3952.076702] active_file:594 inactive_file:2744 isolated_file:363 [ 3952.076702] unevictable:0 dirty:1 writeback:0 [ 3952.076702] slab_reclaimable:5032 slab_unreclaimable:8677 [ 3952.076702] mapped:706 shmem:173 pagetables:9628 bounce:0 [ 3952.076702] free:24158 free_pcp:718 free_cma:7380 [ 3952.087867] Node 0 active_anon:656kB inactive_anon:15836932kB active_file:928kB inactive_file:12832kB unevictable:0kB isolated(anon):0kB isolated(file):512kB mapped:2236kB dirty:4kB writeback:0kB shmem:692kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 237568kB writeback_tmp:0kB kernel_stack:8368kB all_unreclaimable? no [ 3952.097080] Node 0 DMA free:59552kB min:7904kB low:10720kB high:13536kB reserved_highatomic:0KB active_anon:0kB inactive_anon:2751304kB active_file:0kB inactive_file:68kB unevictable:0kB writepending:0kB present:3145728kB managed:2818048kB mlocked:0kB pagetables:0kB bounce:0kB free_pcp:4kB local_pcp:0kB free_cma:29520kB [ 3952.107914] lowmem_reserve[]: 0 0 12963 12963 [ 3952.109546] Node 0 Normal free:36528kB min:37148kB low:50388kB high:63628kB reserved_highatomic:0KB active_anon:656kB inactive_anon:13085628kB active_file:104kB inactive_file:14580kB unevictable:0kB writepending:4kB present:13631488kB managed:13274928kB mlocked:0kB pagetables:38512kB bounce:0kB free_pcp:3172kB local_pcp:256kB free_cma:0kB [ 3952.120446] lowmem_reserve[]: 0 0 0 0 [ 3952.120728] Node 0 DMA: 34*4kB (UME) 35*8kB (UME) 17*16kB (UME) 9*32kB (UME) 5*64kB (UME) 5*128kB (UME) 3*256kB (UE) 1*512kB (U) 2*1024kB (UE) 3*2048kB (UEC) 12*4096kB (M) = 60560kB [ 3952.124666] Node 0 Normal: 1161*4kB (UME) 1016*8kB (UME) 564*16kB (UME) 274*32kB (UME) 73*64kB (UME) 4*128kB (M) 2*256kB (M) 0*512kB 1*1024kB (M) 0*2048kB 0*4096kB = 37284kB [ 3952.129844] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB [ 3952.132647] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB [ 3952.136740] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB [ 3952.137509] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB [ 3952.142050] 4121 total pagecache pages [ 3952.143656] 0 pages in swap cache [ 3952.145065] Swap cache stats: add 0, delete 0, find 0/0 [ 3952.147311] Free swap = 0kB [ 3952.147923] Total swap = 0kB [ 3952.148591] 4194304 pages RAM [复现概率]: 必现 [复现环境]: 内核: # uname -r 5.10.134-865.git.51f208302af3.al8.aarch64 # cat /etc/os-release NAME="Alibaba Cloud Linux" VERSION="3 (Soaring Falcon)" ID="alinux" ID_LIKE="rhel fedora centos" VERSION_ID="3" PLATFORM_ID="platform:al8" PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)" ANSI_COLOR="0;31" HOME_URL="https://www.aliyun.com/" CPU信息: # lscpu Architecture: aarch64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: 0x48 Model: 0 Stepping: 0x1 BogoMIPS: 200.00 NUMA node0 CPU(s): 0-3 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop asimddp asimdfhm 内存信息: # free -h total used free shared buff/cache available Mem: 15Gi 343Mi 14Gi 0.0Ki 986Mi 14Gi Swap: 0B 0B 0B [复现步骤]: 1. 下载源码 yum -y install wget unzip wget https://gitee.com/src-anolis-os/bpftrace/repository/archive/a8.zip -O ~/a8.zip cd ~ unzip a8.zip 2.解压源码并打上必要的补丁 yum -y install rpm-build mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo "%_topdir /root/rpmbuild" >~/.rpmmacros cp /root/bpftrace-a8/* /root/rpmbuild/SOURCES cd /root/rpmbuild/SOURCES # 安装编译依赖 yum -y install gcc-c++ bison flex cmake elfutils-libelf-devel zlib-devel llvm-devel clang-devel bcc-devel libbpf-devel libbpf-static binutils-devel llvm-static rpmbuild -bp bpftrace.spec 3.下载googletest.tar.gz以避免编译时git clone失败 wget http://242510.oss-cn-hangzhou-zmf.aliyuncs.com/googletest.tar.gz -O ~/googletest.tar.gz 4.编译 cd /root/rpmbuild/BUILD/bpftrace-* tar xf /root/googletest.tar.gz cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DOFFLINE_BUILDS:BOOL=ON sed -i "s|https://github.com/google|$(readlink -f .)|" tests/gtest-git-prefix/tmp/gtest-git-gitclone.cmake make -j8 5.修改脚本runtime-tests.sh,开始测试 yum -y install bpftrace cd tests ./runtime-tests.sh --filter="watchpoint*" [预期结果]: 用例执行成功 [实际结果]: 用例运行卡主,最后被kill,串口有异常日志