From: Greg Kroah-Hartman Date: Wed, 5 Oct 2016 08:19:28 +0000 (+0200) Subject: 4.8-stable patches X-Git-Tag: v4.8.1~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f57c8625da4f41d14794b7cc0fc0e8c819da743a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.8-stable patches added patches: arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch --- diff --git a/queue-4.8/arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch b/queue-4.8/arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch new file mode 100644 index 00000000000..dcf2309012f --- /dev/null +++ b/queue-4.8/arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch @@ -0,0 +1,46 @@ +From 3a402a709500c5a3faca2111668c33d96555e35a Mon Sep 17 00:00:00 2001 +From: Will Deacon +Date: Fri, 26 Aug 2016 11:36:39 +0100 +Subject: arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP + +From: Will Deacon + +commit 3a402a709500c5a3faca2111668c33d96555e35a upstream. + +When TIF_SINGLESTEP is set for a task, the single-step state machine is +enabled and we must take care not to reset it to the active-not-pending +state if it is already in the active-pending state. + +Unfortunately, that's exactly what user_enable_single_step does, by +unconditionally setting the SS bit in the SPSR for the current task. +This causes failures in the GDB testsuite, where GDB ends up missing +expected step traps if the instruction being stepped generates another +trap, e.g. PTRACE_EVENT_FORK from an SVC instruction. + +This patch fixes the problem by preserving the current state of the +stepping state machine when TIF_SINGLESTEP is set on the current thread. + +Cc: +Reported-by: Yao Qi +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/kernel/debug-monitors.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/arm64/kernel/debug-monitors.c ++++ b/arch/arm64/kernel/debug-monitors.c +@@ -435,8 +435,10 @@ NOKPROBE_SYMBOL(kernel_active_single_ste + /* ptrace API */ + void user_enable_single_step(struct task_struct *task) + { +- set_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP); +- set_regs_spsr_ss(task_pt_regs(task)); ++ struct thread_info *ti = task_thread_info(task); ++ ++ if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP)) ++ set_regs_spsr_ss(task_pt_regs(task)); + } + NOKPROBE_SYMBOL(user_enable_single_step); + diff --git a/queue-4.8/series b/queue-4.8/series new file mode 100644 index 00000000000..b960d72aa1f --- /dev/null +++ b/queue-4.8/series @@ -0,0 +1 @@ +arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch