[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <patch-1.thread-a0061f.git-617139935cc4.your-ad-here.call-01575012971-ext-9115@work.hours>
Date: Fri, 29 Nov 2019 08:41:48 +0100
From: Vasily Gorbik <gor@...ux.ibm.com>
To: Miroslav Benes <mbenes@...e.cz>
Cc: heiko.carstens@...ibm.com, borntraeger@...ibm.com,
jpoimboe@...hat.com, joe.lawrence@...hat.com,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
jikos@...nel.org, pmladek@...e.com, nstange@...e.de,
live-patching@...r.kernel.org
Subject: [PATCH v4 1/2] s390/unwind: add stack pointer alignment sanity checks
From: Miroslav Benes <mbenes@...e.cz>
ABI requires SP to be aligned 8 bytes, report unwinding error otherwise.
Signed-off-by: Vasily Gorbik <gor@...ux.ibm.com>
---
arch/s390/kernel/dumpstack.c | 4 ++++
arch/s390/kernel/unwind_bc.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c
index d74e21a23703..d306fe04489a 100644
--- a/arch/s390/kernel/dumpstack.c
+++ b/arch/s390/kernel/dumpstack.c
@@ -94,6 +94,10 @@ int get_stack_info(unsigned long sp, struct task_struct *task,
if (!sp)
goto unknown;
+ /* Sanity check: ABI requires SP to be aligned 8 bytes. */
+ if (sp & 0x7)
+ goto unknown;
+
/* Check per-task stack */
if (in_task_stack(sp, task, info))
goto recursion_check;
diff --git a/arch/s390/kernel/unwind_bc.c b/arch/s390/kernel/unwind_bc.c
index ef42d5f77ce7..da2d4d4c5b0e 100644
--- a/arch/s390/kernel/unwind_bc.c
+++ b/arch/s390/kernel/unwind_bc.c
@@ -92,6 +92,10 @@ bool unwind_next_frame(struct unwind_state *state)
}
}
+ /* Sanity check: ABI requires SP to be aligned 8 bytes. */
+ if (sp & 0x7)
+ goto out_err;
+
ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *) sp);
/* Update unwind state */
--
2.21.0
Powered by blists - more mailing lists