Re: [PATCH v10 08/15] x86/vsyscall: Reorganize the page fault emulation code

From: Edgecombe, Rick P

Date: Wed Oct 08 2025 - 13:43:11 EST


On Tue, 2025-10-07 at 15:52 -0700, Sohil Mehta wrote:
> >
> > If indeed we should add a check, it should probably go in one of the later
> > patches and not this one.
>
> We already check CS before calling emulate_vsyscall_gp().
>
> if (user_mode(regs)) {
>
> ...
> if (emulate_vsyscall_gp(regs))
> goto exit;
>
> ...
> }

Ah, right, I missed that. But in the new code, the way to get there is by taking
a GP with an RIP in the vsyscall range. Does this seem a bit stale though?

/*
* No point in checking CS -- the only way to get here is a user mode
* trap to a high address, which means that we're in 64-bit user code.
*/

For one, "No point in checking CS", while true kind of implies that CS wasn't
already checked. The second half I guess is still true if you call the fetch #GP
a trap, and actually maybe more accurate for LASS then it was for the older
paradigm with the "high address" verbiage.

I'm fine either way.