Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b13138ef authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller
Browse files

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: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 485d6511
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/linkage.h>
#include <linux/linkage.h>
#include <linux/printk.h>
#include <linux/printk.h>
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/sched.h>


#include <asm/cacheflush.h>
#include <asm/cacheflush.h>


@@ -438,8 +439,9 @@ void bpf_jit_free(struct bpf_prog *fp);
static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
				u32 pass, void *image)
				u32 pass, void *image)
{
{
	pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
	pr_err("flen=%u proglen=%u pass=%u image=%pK from=%s pid=%d\n", flen,
	       flen, proglen, pass, image);
	       proglen, pass, image, current->comm, task_pid_nr(current));

	if (image)
	if (image)
		print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
		print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
			       16, 1, image, proglen, false);
			       16, 1, image, proglen, false);