[PATCH 4/7] x86/dumpstack: If addr_limit is non-default, display it
From: Andy Lutomirski
Date: Tue May 24 2016 - 18:49:05 EST
This will help debug OOPSes related to USER_DS vs KERNEL_DS.
Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
---
arch/x86/kernel/dumpstack_32.c | 4 ++++
arch/x86/kernel/dumpstack_64.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 464ffd69b92e..5dbb08fd8291 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -124,8 +124,12 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
void show_regs(struct pt_regs *regs)
{
int i;
+ struct thread_info *ti = current_thread_info();
show_regs_print_info(KERN_EMERG);
+ if (ti->addr_limit.seg != TASK_SIZE_MAX)
+ printk(KERN_DEFAULT "task.addr_limit: 0x%lx\n",
+ ti->addr_limit.seg);
__show_regs(regs, !user_mode(regs));
/*
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 5f1c6266eb30..2fdeb64dfed0 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -301,9 +301,14 @@ void show_regs(struct pt_regs *regs)
{
int i;
unsigned long sp;
+ struct thread_info *ti = current_thread_info();
sp = regs->sp;
+
show_regs_print_info(KERN_DEFAULT);
+ if (ti->addr_limit.seg != TASK_SIZE_MAX)
+ printk(KERN_DEFAULT "task.addr_limit: 0x%lx\n",
+ ti->addr_limit.seg);
__show_regs(regs, 1);
/*
--
2.5.5