Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Do not hash userspace addresses in fault handlers

The hashing of %p was designed to restrict kernel addresses. There is
no reason to hash the userspace values seen during a segfault report,
so switch these to %px. (Some architectures already use %lx.)

Fixes: ad67b74d2469d9b8 ("printk: hash addresses printed with %p")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kees Cook and committed by
Linus Torvalds
10a7e9d8 ace52288

+4 -4
+1 -1
arch/sparc/mm/fault_32.c
··· 113 113 if (!printk_ratelimit()) 114 114 return; 115 115 116 - printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", 116 + printk("%s%s[%d]: segfault at %lx ip %px (rpc %px) sp %px error %x", 117 117 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, 118 118 tsk->comm, task_pid_nr(tsk), address, 119 119 (void *)regs->pc, (void *)regs->u_regs[UREG_I7],
+1 -1
arch/sparc/mm/fault_64.c
··· 154 154 if (!printk_ratelimit()) 155 155 return; 156 156 157 - printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", 157 + printk("%s%s[%d]: segfault at %lx ip %px (rpc %px) sp %px error %x", 158 158 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, 159 159 tsk->comm, task_pid_nr(tsk), address, 160 160 (void *)regs->tpc, (void *)regs->u_regs[UREG_I7],
+1 -1
arch/um/kernel/trap.c
··· 150 150 if (!printk_ratelimit()) 151 151 return; 152 152 153 - printk("%s%s[%d]: segfault at %lx ip %p sp %p error %x", 153 + printk("%s%s[%d]: segfault at %lx ip %px sp %px error %x", 154 154 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, 155 155 tsk->comm, task_pid_nr(tsk), FAULT_ADDRESS(*fi), 156 156 (void *)UPT_IP(regs), (void *)UPT_SP(regs),
+1 -1
arch/x86/mm/fault.c
··· 860 860 if (!printk_ratelimit()) 861 861 return; 862 862 863 - printk("%s%s[%d]: segfault at %lx ip %p sp %p error %lx", 863 + printk("%s%s[%d]: segfault at %lx ip %px sp %px error %lx", 864 864 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, 865 865 tsk->comm, task_pid_nr(tsk), address, 866 866 (void *)regs->ip, (void *)regs->sp, error_code);