diff options
-rw-r--r-- | meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-Fix-syscall-restarting-around-signal-suppresse.patch | 72 | ||||
-rw-r--r-- | meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb | 2 |
2 files changed, 74 insertions, 0 deletions
diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-Fix-syscall-restarting-around-signal-suppresse.patch b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-Fix-syscall-restarting-around-signal-suppresse.patch new file mode 100644 index 0000000..11159ff --- /dev/null +++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-Fix-syscall-restarting-around-signal-suppresse.patch @@ -0,0 +1,72 @@ +From 0fe42512b2f03f9e5a20b9f55ef1013a68b4cd48 Mon Sep 17 00:00:00 2001 +From: Dave Martin <Dave.Martin@arm.com> +Date: Thu, 7 Jun 2018 12:32:05 +0100 +Subject: arm64: Fix syscall restarting around signal suppressed by tracer + +Commit 17c2895 ("arm64: Abstract syscallno manipulation") abstracts +out the pt_regs.syscallno value for a syscall cancelled by a tracer +as NO_SYSCALL, and provides helpers to set and check for this +condition. However, the way this was implemented has the +unintended side-effect of disabling part of the syscall restart +logic. + +This comes about because the second in_syscall() check in +do_signal() re-evaluates the "in a syscall" condition based on the +updated pt_regs instead of the original pt_regs. forget_syscall() +is explicitly called prior to the second check in order to prevent +restart logic in the ret_to_user path being spuriously triggered, +which means that the second in_syscall() check always yields false. + +This triggers a failure in +tools/testing/selftests/seccomp/seccomp_bpf.c, when using ptrace to +suppress a signal that interrups a nanosleep() syscall. + +Misbehaviour of this type is only expected in the case where a +tracer suppresses a signal and the target process is either being +single-stepped or the interrupted syscall attempts to restart via +-ERESTARTBLOCK. + +This patch restores the old behaviour by performing the +in_syscall() check only once at the start of the function. + +Fixes: 17c289586009 ("arm64: Abstract syscallno manipulation") +Signed-off-by: Dave Martin <Dave.Martin@arm.com> +Reported-by: Sumit Semwal <sumit.semwal@linaro.org> +Cc: Will Deacon <will.deacon@arm.com> +Cc: <stable@vger.kernel.org> # 4.14.x- +Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> +--- + arch/arm64/kernel/signal.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +(limited to 'arch/arm64/kernel/signal.c') + +diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c +index e7da5dba7ba8..511af13e8d8f 100644 +--- a/arch/arm64/kernel/signal.c ++++ b/arch/arm64/kernel/signal.c +@@ -843,11 +843,12 @@ static void do_signal(struct pt_regs *regs) + unsigned long continue_addr = 0, restart_addr = 0; + int retval = 0; + struct ksignal ksig; ++ bool syscall = in_syscall(regs); + + /* + * If we were from a system call, check for system call restarting... + */ +- if (in_syscall(regs)) { ++ if (syscall) { + continue_addr = regs->pc; + restart_addr = continue_addr - (compat_thumb_mode(regs) ? 2 : 4); + retval = regs->regs[0]; +@@ -899,7 +900,7 @@ static void do_signal(struct pt_regs *regs) + * Handle restarting a different system call. As above, if a debugger + * has chosen to restart at a different PC, ignore the restart. + */ +- if (in_syscall(regs) && regs->pc == restart_addr) { ++ if (syscall && regs->pc == restart_addr) { + if (retval == -ERESTART_RESTARTBLOCK) + setup_restart_syscall(regs); + user_rewind_single_step(current); +-- +cgit 1.2-0.3.lf.el7 diff --git a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb index 75008b6..05540b2 100644 --- a/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb +++ b/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb @@ -15,8 +15,10 @@ SRCREV = "118adc53e8e9806d76f40859ba96290f289f8839" SRC_URI = "${RENESAS_BSP_URL};protocol=git;nocheckout=1;branch=${BRANCH}" # Fix micro SD card issue on M3ULCB +# Fix syscall restarting bug on aarch64(existing in version < 4.14.53) SRC_URI_append = " \ file://0001-Revert-mmc-renesas_sdhi_internal_dmac-limit-DMA-RX-f.patch \ + file://0001-arm64-Fix-syscall-restarting-around-signal-suppresse.patch \ " # Fix inaccessible SSI for Renesas ADSP firmware |