Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1652067 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2017-05-28 11:30 +0200 |
| Last post | 2017-05-29 10:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86/kernel/process_32: Convert a smp_processor_id() call Borislav Petkov <bp@alien8.de> - 2017-05-28 11:30 +0200
[tip:x86/urgent] x86/debug/32: Convert a smp_processor_id() call to raw to avoid DEBUG_PREEMPT warning tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-05-29 10:30 +0200
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2017-05-28 11:30 +0200 |
| Subject | [PATCH] x86/kernel/process_32: Convert a smp_processor_id() call |
| Message-ID | <tM2Gl-8vl-9@gated-at.bofh.it> |
Hi,
this is on 32-bit with tip/master.
I *think* the solution is as straight-forward but pls double-check me on
that.
Thanks.
---
From: Borislav Petkov <bp@suse.de>
Date: Sun, 28 May 2017 11:03:42 +0200
Subject: [PATCH] x86/kernel/process_32: Convert a smp_processor_id() call
... to raw_smp_processor_id() to not trip the
BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
check. The reasoning behind it is that __warn() already uses the raw_
variants but the show_regs() path on 32-bit doesn't.
Otherwise, you get splat in a splat:
Write protecting the kernel read-only data: 2980k
NX-protecting the kernel data: 4744k
x86/mm: Found insecure W+X mapping at address c00a0000/0xc00a0000
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at .../arch/x86/mm/dump_pagetables.c:236 note_page+0x6ca/0x8e0
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc2+ #1
Hardware name: LENOVO 30515QG/30515QG, BIOS 8RET30WW (1.12 ) 09/15/2011
task: f4120000 task.stack: f411a000
EIP: note_page+0x6ca/0x8e0
BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is debug_smp_processor_id
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc2+ #1
Hardware name: LENOVO 30515QG/30515QG, BIOS 8RET30WW (1.12 ) 09/15/2011
Call Trace:
dump_stack
check_preemption_disabled
debug_smp_processor_id
__show_regs
? note_page
? printk
? show_regs_print_info
? note_page
show_regs
? vprintk_func
? note_page
__warn
? note_page
? note_page
report_bug
do_trap
? do_error_trap
? __this_cpu_preempt_check
? trace_hardirqs_on_caller
do_error_trap
? note_page
? wake_up_klogd
? console_unlock
? common_exception
? do_overflow
? __this_cpu_preempt_check
? trace_hardirqs_off_caller
? do_overflow
do_invalid_op
common_exception
EIP: note_page+0x6ca/0x8e0
EFLAGS: 00210286 CPU: 0
EAX: 00000041 EBX: f411bf40 ECX: 00000000 EDX: c10bd629
ESI: 80000000 EDI: 00000000 EBP: f411bf0c ESP: f411bed4
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
? wake_up_klogd
? do_overflow
? change_page_attr_set_clr
ptdump_walk_pgd_level_core
ptdump_walk_pgd_level_checkwx
mark_rodata_ro
? rest_init
kernel_init
? schedule_tail_wrapper
ret_from_fork
EFLAGS: 00210286 CPU: 0
EAX: 00000041 EBX: f411bf40 ECX: 00000000 EDX: c10bd629
ESI: 80000000 EDI: 00000000 EBP: f411bf0c ESP: f411bed4
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
CR0: 80050033 CR2: ffbff000 CR3: 01bbe000 CR4: 000006f0
Call Trace:
? change_page_attr_set_clr
ptdump_walk_pgd_level_core
ptdump_walk_pgd_level_checkwx
mark_rodata_ro
? rest_init
kernel_init
? schedule_tail_wrapper
ret_from_fork
---[ end trace e1a49e2b8e42d056 ]---
x86/mm: Checked W+X mappings: FAILED, 96 W+X pages found.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/process_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index ff40e74c9181..ffeae818aa7a 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -78,7 +78,7 @@ void __show_regs(struct pt_regs *regs, int all)
printk(KERN_DEFAULT "EIP: %pS\n", (void *)regs->ip);
printk(KERN_DEFAULT "EFLAGS: %08lx CPU: %d\n", regs->flags,
- smp_processor_id());
+ raw_smp_processor_id());
printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
regs->ax, regs->bx, regs->cx, regs->dx);
--
2.11.0
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
[toc] | [next] | [standalone]
| From | tip-bot for Borislav Petkov <tipbot@zytor.com> |
|---|---|
| Date | 2017-05-29 10:30 +0200 |
| Subject | [tip:x86/urgent] x86/debug/32: Convert a smp_processor_id() call to raw to avoid DEBUG_PREEMPT warning |
| Message-ID | <tModP-5Cf-1@gated-at.bofh.it> |
| In reply to | #1652067 |
Commit-ID: 5d9070b1f0fc9a159a9a3240c43004828408444b Gitweb: http://git.kernel.org/tip/5d9070b1f0fc9a159a9a3240c43004828408444b Author: Borislav Petkov <bp@suse.de> AuthorDate: Sun, 28 May 2017 11:03:42 +0200 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Mon, 29 May 2017 08:22:49 +0200 x86/debug/32: Convert a smp_processor_id() call to raw to avoid DEBUG_PREEMPT warning ... to raw_smp_processor_id() to not trip the BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1 check. The reasoning behind it is that __warn() already uses the raw_ variants but the show_regs() path on 32-bit doesn't. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170528092212.fiod7kygpjm23m3o@pd.tnic Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/kernel/process_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index ff40e74..ffeae81 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -78,7 +78,7 @@ void __show_regs(struct pt_regs *regs, int all) printk(KERN_DEFAULT "EIP: %pS\n", (void *)regs->ip); printk(KERN_DEFAULT "EFLAGS: %08lx CPU: %d\n", regs->flags, - smp_processor_id()); + raw_smp_processor_id()); printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->ax, regs->bx, regs->cx, regs->dx);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web