diff options
author | Christoph Hellwig <hch@lst.de> | 2018-01-04 19:55:55 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2018-01-30 19:12:38 -0800 |
commit | fe9b842f72921fb18b93cf47a255f374289ef242 (patch) | |
tree | 9fe9b96a98c5471f3f943690ab30d13064f181d4 /arch/sh | |
parent | 509009ccfa53d031be5f5551fa2b7f9a4cbd2d93 (diff) | |
download | talos-op-linux-fe9b842f72921fb18b93cf47a255f374289ef242.tar.gz talos-op-linux-fe9b842f72921fb18b93cf47a255f374289ef242.zip |
riscv: disable SUM in the exception handler
The SUM bit is enabled at the beginning of the copy_{to,from}_user and
{get,put}_user routines, and cleared before they return. But these user
copy helper can be interrupted by exceptions, in which case the SUM bit
will remain set, which leads to elevated privileges for the code running
in exception context, as that can now access userspace address space
unconditionally. This frequently happens when the user copy routines
access freshly allocated user memory that hasn't been faulted in, and a
pagefault needs to be taken before the user copy routines can continue.
Fix this by unconditionally clearing SUM when the exception handler is
called - the restore code will automatically restore it based on the
saved value.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/sh')
0 files changed, 0 insertions, 0 deletions