Re: [PATCH] sched/x86: Save [ER]FLAGS on context switch

From: Peter Zijlstra
Date: Tue Feb 19 2019 - 04:45:04 EST


On Tue, Feb 19, 2019 at 10:04:09AM +0100, Peter Zijlstra wrote:
> > Does that make more sense?
>
> It appears to me you're going about it backwards.

So how about you do a GCC plugin that verifies limits on code-gen
between user_access_begin/user_access_end() ?

- No CALL/RET
- implies user_access_end() happens
- implies no fentry hooks
- No __preempt_count frobbing
- No tracepoints
- ...

That way you put the burden on the special code, not on the rest of the
kernel.