Skip to content

Commit b13138e

Browse files
borkmanndavem330
authored andcommitted
bpf: also show process name/pid in bpf_jit_dump
It can be useful for testing to see the actual process/pid who is loading a given filter. I was running some BPF test program and noticed unusual filter loads from time to time, triggered by some other application in the background. bpf_jit_disasm is still working after this change. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 485d651 commit b13138e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/linux/filter.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/linkage.h>
1313
#include <linux/printk.h>
1414
#include <linux/workqueue.h>
15+
#include <linux/sched.h>
1516

1617
#include <asm/cacheflush.h>
1718

@@ -438,8 +439,9 @@ void bpf_jit_free(struct bpf_prog *fp);
438439
static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
439440
u32 pass, void *image)
440441
{
441-
pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
442-
flen, proglen, pass, image);
442+
pr_err("flen=%u proglen=%u pass=%u image=%pK from=%s pid=%d\n", flen,
443+
proglen, pass, image, current->comm, task_pid_nr(current));
444+
443445
if (image)
444446
print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
445447
16, 1, image, proglen, false);

0 commit comments

Comments
 (0)