Re: [PATCH v3 2/7] uaccess: Tell user_access_begin() if it's for a write or not
From: Tony Luck
Date: Sat Jan 25 2020 - 01:17:27 EST
On Thu, Jan 23, 2020 at 10:03 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> We used to have a read/write argument to the old "verify_area()" and
> "access_ok()" model, and it was a mistake. It was due to odd i386 user
> access issues. We got rid of it. I'm not convinced this is any better
> - it looks very similar and for odd ppc access issues.
If the mode (read or write) were made visible to the trap handler, I'd
find that useful for machine check recovery. If I'm in the middle of a
copy_from_user() and I get a machine check reading poison from a
user address ... then I could try to recover in the same way as for the
user accessing the poison (offline the page, SIGBUS the task). But if
the poison is in kernel memory and we are doing a copy_to_user(), then
we are hosed (or would need some more complex recovery plan).
[Note that we only get recoverable machine checks on loads... writes
are posted, so if something goes wrong it isn't synchronous with the store
instruction that initiated it]
-Tony