On Thu, 2 May 2019, Linus Torvalds wrote:
I forget: is #BP _only_ for the "int3" instruction?
Hmm, according to 17.3.2 in vol 3 of SDM (and table 6-1 there), that indeed seems to be the case, so we should be fine.
But if "int3 from kernel space" _only_ happens on actual "int3" instructions, then we really could just special-case that case. We'd know that %cr3 has been switched, we'd know that we don't need to do fsgs switching, we'd know we already have a good stack and percpu data etc set up.
That should indeed be doable, under the asumption that noone is doing any int3 games before we've switched away from entry trampoline.
I've briefly looked, and seems like we have proper notrace anotations for stackleak_erase(), which seems to be the only C (ftrace-able) code that's running on a trampoline (off-topic: where does PTI code make sure that we actually map this symbol into user pagetables in case we're not doing global mapping?).