Skip to content

Commit be2d11b

Browse files
mirabVasily Gorbik
authored andcommitted
s390/unwind: add stack pointer alignment sanity checks
ABI requires SP to be aligned 8 bytes, report unwinding error otherwise. Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Heiko Carstens <[email protected]> Tested-by: Miroslav Benes <[email protected]> Signed-off-by: Miroslav Benes <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent bf018ee commit be2d11b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/s390/kernel/dumpstack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ int get_stack_info(unsigned long sp, struct task_struct *task,
9494
if (!sp)
9595
goto unknown;
9696

97+
/* Sanity check: ABI requires SP to be aligned 8 bytes. */
98+
if (sp & 0x7)
99+
goto unknown;
100+
97101
/* Check per-task stack */
98102
if (in_task_stack(sp, task, info))
99103
goto recursion_check;

arch/s390/kernel/unwind_bc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ bool unwind_next_frame(struct unwind_state *state)
9292
}
9393
}
9494

95+
/* Sanity check: ABI requires SP to be aligned 8 bytes. */
96+
if (sp & 0x7)
97+
goto out_err;
98+
9599
ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *) sp);
96100

97101
/* Update unwind state */

0 commit comments

Comments
 (0)