]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 8986/1: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints
authorWill Deacon <will@kernel.org>
Thu, 18 Jun 2020 10:16:45 +0000 (11:16 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Tue, 21 Jul 2020 15:32:54 +0000 (16:32 +0100)
commit3475c8b9871121b2e50011da4f7d53ddc3211493
tree36f0cd8798f26a08319d8b35b5ab877a26ade01c
parent20d527e148caa0342b75a096c4ba477fca3deb5d
ARM: 8986/1: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints

Unprivileged memory accesses generated by the so-called "translated"
instructions (e.g. LDRT) in kernel mode can cause user watchpoints to fire
unexpectedly. In such cases, the hw_breakpoint logic will invoke the user
overflow handler which will typically raise a SIGTRAP back to the current
task. This is futile when returning back to the kernel because (a) the
signal won't have been delivered and (b) userspace can't handle the thing
anyway.

Avoid invoking the user overflow handler for watchpoints triggered by
kernel uaccess routines, and instead single-step over the faulting
instruction as we would if no overflow handler had been installed.

Cc: <stable@vger.kernel.org>
Fixes: ba384d63b894 ("ARM: 6356/1: hw-breakpoint: add ARM backend for the hw-breakpoint framework")
Reported-by: Luis Machado <luis.machado@linaro.org>
Tested-by: Luis Machado <luis.machado@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/hw_breakpoint.c