Skip to content

Commit a52067c

Browse files
t-8chKAGA-KOKO
authored andcommitted
timer_list: Don't use %pK through printk()
This reverts commit f590308 ("timer debug: Hide kernel addresses via %pK in /proc/timer_list") The timer list helper SEQ_printf() uses either the real seq_printf() for procfs output or vprintk() to print to the kernel log, when invoked from SysRq-q. It uses %pK for printing pointers. In the past %pK was prefered over %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 looks in atomic contexts. Switch to the regular pointer formatting which is safer, easier to reason about and sufficient here. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@linutronix.de/ Link: https://lore.kernel.org/all/20250311-restricted-pointers-timer-v1-1-6626b91e54ab@linutronix.de
1 parent 7a6b158 commit a52067c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/time/timer_list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void
4646
print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer,
4747
int idx, u64 now)
4848
{
49-
SEQ_printf(m, " #%d: <%pK>, %ps", idx, taddr, timer->function);
49+
SEQ_printf(m, " #%d: <%p>, %ps", idx, taddr, timer->function);
5050
SEQ_printf(m, ", S:%02x", timer->state);
5151
SEQ_printf(m, "\n");
5252
SEQ_printf(m, " # expires at %Lu-%Lu nsecs [in %Ld to %Ld nsecs]\n",
@@ -98,7 +98,7 @@ print_active_timers(struct seq_file *m, struct hrtimer_clock_base *base,
9898
static void
9999
print_base(struct seq_file *m, struct hrtimer_clock_base *base, u64 now)
100100
{
101-
SEQ_printf(m, " .base: %pK\n", base);
101+
SEQ_printf(m, " .base: %p\n", base);
102102
SEQ_printf(m, " .index: %d\n", base->index);
103103

104104
SEQ_printf(m, " .resolution: %u nsecs\n", hrtimer_resolution);

0 commit comments

Comments
 (0)