]> git.ipfire.org Git - people/arne_f/kernel.git/commit
ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE
authorVineet Gupta <vgupta@synopsys.com>
Wed, 20 May 2020 05:28:32 +0000 (22:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jul 2020 07:22:19 +0000 (09:22 +0200)
commitd939945a2a89ec6a6a31b158ae822f4e502324a8
tree88ff1ec33da38a2241a8a0ac1bd57d44aab1b5a9
parentf5d07c5a0758bf28be89d3e41a0a414e4d8a2e36
ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE

commit 00fdec98d9881bf5173af09aebd353ab3b9ac729 upstream.

Trap handler for syscall tracing reads EFA (Exception Fault Address),
in case strace wants PC of trap instruction (EFA is not part of pt_regs
as of current code).

However this EFA read is racy as it happens after dropping to pure
kernel mode (re-enabling interrupts). A taken interrupt could
context-switch, trigger a different task's trap, clobbering EFA for this
execution context.

Fix this by reading EFA early, before re-enabling interrupts. A slight
side benefit is de-duplication of FAKE_RET_FROM_EXCPN in trap handler.
The trap handler is common to both ARCompact and ARCv2 builds too.

This just came out of code rework/review and no real problem was reported
but is clearly a potential problem specially for strace.

Cc: <stable@vger.kernel.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arc/kernel/entry.S