arch/x86: cleanup show_fault_oops()
PATCH 1/1 arch/x86: cleanup show_fault_oops()
From: Dmitry Vyukov <[email protected]>
Remove once used nx_warning and smep_warning. As asked by reviewers in
"arch/x86: get rid of KERN_CONT in show_fault_oops()" review.
Signed-off-by Dmitry Vyukov <[email protected]>
--- arch/x86/mm/fault.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +4 -7
@@ -641,11 +641,6 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)return 0 ; } -static const char nx_warning[] =KERN_CRIT -"kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n" ; -static const char smep_warning[] =KERN_CRIT -"unable to execute userspace code (SMEP?) (uid: %d)\n" ; -static void show_fault_oops (struct pt_regs *regs,unsigned long error_code,unsigned long address)
@@ -664,11 +659,13 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, pte =lookup_address_in_pgd (pgd, address, &level);if (pte &&pte_present (*pte) && !pte_exec (*pte)) -printk (nx_warning,from_kuid (&init_user_ns,current_uid ())); +pr_crit ("kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n" , +from_kuid (&init_user_ns,current_uid ()));if (pte &&pte_present (*pte) &&pte_exec (*pte) && (pgd_flags (*pgd) & _PAGE_USER) && (__read_cr4 () &X86_CR4_SMEP )) -printk (smep_warning,from_kuid (&init_user_ns,current_uid ())); +pr_crit ("unable to execute userspace code (SMEP?) (uid: %d)\n" , +from_kuid (&init_user_ns,current_uid ())); }printk (KERN_ALERT "BUG: unable to handle kernel " );
Signature · 1 line
2.18.0.rc2.346.g013aa6912e-goog
tip-bot for Dmitry Vyukov
merge bot[tip:x86/urgent] x86/mm: Clean up the printk()s in show_fault_oops()
x86/mm: Clean up the printk()s in show_fault_oops()
Commit-ID: d79d0d8ad0cb3d782b41631dfeac8eb05e414bcd Gitweb: https://git.kernel.org/tip/d79d0d8ad0cb3d782b41631dfeac8eb05e414bcd Author: Dmitry Vyukov <[email protected]> AuthorDate: Wed, 27 Jun 2018 11:07:15 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 27 Jun 2018 14:08:11 +0200
x86/mm: Clean up the printk()s in show_fault_oops()
- Remove 'nx_warning' and 'smep_warning', which are just pointless obfuscation.
- Also convert to pr_crit().
Suggested-by Joe Perches <[email protected]>
Signed-off-by Dmitry Vyukov <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/x86/mm/fault.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +4 -7
@@ -641,11 +641,6 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)return 0 ; } -static const char nx_warning[] =KERN_CRIT -"kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n" ; -static const char smep_warning[] =KERN_CRIT -"unable to execute userspace code (SMEP?) (uid: %d)\n" ; -static void show_fault_oops (struct pt_regs *regs,unsigned long error_code,unsigned long address)
@@ -664,11 +659,13 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, pte =lookup_address_in_pgd (pgd, address, &level);if (pte &&pte_present (*pte) && !pte_exec (*pte)) -printk (nx_warning,from_kuid (&init_user_ns,current_uid ())); +pr_crit ("kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n" , +from_kuid (&init_user_ns,current_uid ()));if (pte &&pte_present (*pte) &&pte_exec (*pte) && (pgd_flags (*pgd) & _PAGE_USER) && (__read_cr4 () &X86_CR4_SMEP )) -printk (smep_warning,from_kuid (&init_user_ns,current_uid ())); +pr_crit ("unable to execute userspace code (SMEP?) (uid: %d)\n" , +from_kuid (&init_user_ns,current_uid ())); } pr_alert("BUG: unable to handle kernel %s at %px\n",