Skip to content

Commit 2caa6b8

Browse files
t-8chanakryiko
authored andcommitted
bpf: Don't use %pK through printk
In the past %pK was preferable to %p as it would not leak raw pointer values into the kernel log. Since commit ad67b74 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue. Furthermore, restricted pointers ("%pK") were never meant to be used through printk(). They can still unintentionally leak raw pointers or acquire sleeping locks in atomic contexts. Switch to the regular pointer formatting which is safer and easier to reason about. Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent bf0c2a8 commit 2caa6b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other);
12961296
static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
12971297
u32 pass, void *image)
12981298
{
1299-
pr_err("flen=%u proglen=%u pass=%u image=%pK from=%s pid=%d\n", flen,
1299+
pr_err("flen=%u proglen=%u pass=%u image=%p from=%s pid=%d\n", flen,
13001300
proglen, pass, image, current->comm, task_pid_nr(current));
13011301

13021302
if (image)

0 commit comments

Comments
 (0)