Revert "arm64: uaccess: implement unsafe accessors"
authorJames Morse <james.morse@arm.com>
Wed, 10 Oct 2018 15:55:44 +0000 (16:55 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 10 Oct 2018 16:52:08 +0000 (17:52 +0100)
commit3b82a6ea23277f56c4f005872bb73c8ce29779d7
tree9b9a4e0faa0221fbb22aee5a214424ba784d0e63
parent742fafa50b62cb9f379ba14a13443f52afdc0c5d
Revert "arm64: uaccess: implement unsafe accessors"

This reverts commit a1f33941f7e103bcf471eaf8461b212223c642d6.

The unsafe accessors allow the PAN enable/disable calls to be made
once for a group of accesses. Adding these means we can now have
sequences that look like this:

| user_access_begin();
| unsafe_put_user(static-value, x, err);
| unsafe_put_user(helper-that-sleeps(), x, err);
| user_access_end();

Calling schedule() without taking an exception doesn't switch the
PSTATE or TTBRs. We can switch out of a uaccess-enabled region, and
run other code with uaccess enabled for a different thread.

We can also switch from uaccess-disabled code back into this region,
meaning the unsafe_put_user()s will fault.

For software-PAN, threads that do this will get stuck as
handle_mm_fault() will determine the page has already been mapped in,
but we fault again as the page tables aren't loaded.

To solve this we need code in __switch_to() that save/restores the
PAN state.

Acked-by: Julien Thierry <julien.thierry@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/uaccess.h