|
12 | 12 | #include <linux/linkage.h> |
13 | 13 | #include <linux/printk.h> |
14 | 14 | #include <linux/workqueue.h> |
| 15 | +#include <linux/sched.h> |
15 | 16 |
|
16 | 17 | #include <asm/cacheflush.h> |
17 | 18 |
|
@@ -354,6 +355,16 @@ static inline unsigned int bpf_prog_size(unsigned int proglen) |
354 | 355 | offsetof(struct bpf_prog, insns[proglen])); |
355 | 356 | } |
356 | 357 |
|
| 358 | +static inline bool bpf_prog_was_classic(const struct bpf_prog *prog) |
| 359 | +{ |
| 360 | + /* When classic BPF programs have been loaded and the arch |
| 361 | + * does not have a classic BPF JIT (anymore), they have been |
| 362 | + * converted via bpf_migrate_filter() to eBPF and thus always |
| 363 | + * have an unspec program type. |
| 364 | + */ |
| 365 | + return prog->type == BPF_PROG_TYPE_UNSPEC; |
| 366 | +} |
| 367 | + |
357 | 368 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
358 | 369 |
|
359 | 370 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX |
@@ -428,8 +439,9 @@ void bpf_jit_free(struct bpf_prog *fp); |
428 | 439 | static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, |
429 | 440 | u32 pass, void *image) |
430 | 441 | { |
431 | | - pr_err("flen=%u proglen=%u pass=%u image=%pK\n", |
432 | | - 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 | + |
433 | 445 | if (image) |
434 | 446 | print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET, |
435 | 447 | 16, 1, image, proglen, false); |
|
0 commit comments