Skip to content

Commit 6b7dd5d

Browse files
HoyeonRheeekyooo
authored andcommitted
tests/python: use __kmalloc_noprof for kprobe targets
As part of the Memory Allocation Profiling patchset, Linux commit 7bd230a26648 ("mm/slab: enable slab allocation tagging for kmalloc and friends") converted __kmalloc into a wrapper and moved the actual implementation to __kmalloc_noprof, breaking kmalloc kprobes. This commit update the clang/tools_smoke python test to attach to __kmalloc_noprof instead, restoring the kmalloc kprobe test behavior stay valid on modern kernels. Signed-off-by: Hoyeon Lee <hoyeon.lee@suse.com>
1 parent c338547 commit 6b7dd5d

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

tests/python/test_clang.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,14 @@ def test_task_switch(self):
420420
fn_name=b"count_sched"
421421
)
422422

423+
@skipUnless(kernel_version_ge(6,10), "requires kernel >= 6.10")
423424
def test_probe_simple_assign(self):
424425
b = BPF(text=b"""
425426
#include <uapi/linux/ptrace.h>
426427
#include <linux/gfp.h>
427428
struct leaf { size_t size; };
428429
BPF_HASH(simple_map, u32, struct leaf);
429-
int kprobe____kmalloc(struct pt_regs *ctx, size_t size) {
430+
int kprobe____kmalloc_noprof(struct pt_regs *ctx, size_t size) {
430431
u32 pid = bpf_get_current_pid_tgid();
431432
struct leaf* leaf = simple_map.lookup(&pid);
432433
if (leaf)

tests/python/test_tools_smoke.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ def test_filetop(self):
195195
self.run_with_duration("filetop.py 1 1")
196196

197197
def test_funccount(self):
198-
self.run_with_int("funccount.py __kmalloc -i 1")
198+
self.run_with_int("funccount.py __kmalloc_noprof -i 1")
199199

200200
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
201201
def test_funclatency(self):
202-
self.run_with_int("funclatency.py __kmalloc -i 1")
202+
self.run_with_int("funclatency.py __kmalloc_noprof -i 1")
203203

204204
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
205205
def test_funcslower(self):
206-
self.run_with_int("funcslower.py __kmalloc")
206+
self.run_with_int("funcslower.py __kmalloc_noprof")
207207

208208
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
209209
def test_gethostlatency(self):
@@ -332,7 +332,7 @@ def test_sslsniff(self):
332332

333333
@skipUnless(kernel_version_ge(4,6), "requires kernel >= 4.6")
334334
def test_stackcount(self):
335-
self.run_with_int("stackcount.py __kmalloc -i 1")
335+
self.run_with_int("stackcount.py __kmalloc_noprof -i 1")
336336

337337
@skipUnless(kernel_version_ge(4,4), "requires kernel >= 4.4")
338338
def test_statsnoop(self):

0 commit comments

Comments
 (0)