Re: [PATCH 12/14] x86: remove address space overrides using set_fs()

From: Linus Torvalds
Date: Thu Sep 03 2020 - 19:26:22 EST


On Thu, Sep 3, 2020 at 2:30 PM David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> A non-canonical (is that the right term) address between the highest
> valid user address and the lowest valid kernel address (7ffe to fffe?)
> will fault anyway.

Yes.

But we actually warn against that fault, because it's been a good way
to catch places that didn't use the proper "access_ok()" pattern.

See ex_handler_uaccess() and the

WARN_ONCE(trapnr == X86_TRAP_GP, "General protection fault in
user access. Non-canonical address?");

warning. It's been good for randomized testing - a missing range check
on a user address will often hit this.

Of course, you should never see it in real life (and hopefully not in
testing either any more). But belt-and-suspenders..

Linus