Re: [PATCH v11 6/9] x86/cet: Add PTRACE interface for CET

From: Yu, Yu-cheng
Date: Thu Sep 03 2020 - 13:59:21 EST


On 9/3/2020 9:42 AM, Dave Hansen wrote:
On 9/3/20 9:32 AM, Andy Lutomirski wrote:
Taking the config register out of the init state is illogical, as is
writing to SSP while the config register is in its init state.
What's so special about the INIT state? It's optimized by XSAVES, but
it's just a number, right? So taking the register out of the INIT
state is kind of like saying "gdb wanted to set xmm0 to (0,0,0,1), but
it was in the INIT state to begin with", right?

Yeah, that's a good point. The init state shouldn't be special, as the
hardware is within its right to choose not to use the init optimization
at any time.

Then, I would suggest changing get_xsave_addr() to return non-null for the INIT state case. For the other two cases, it still returns NULL. But this also requires any write to INIT states to set xstate_bv bits properly. This would be a pitfall for any code addition later on.

Looking at this another way. Would it be better for the debugger to get an error and then to set the MSR directly first (vs. changing the XSAVES INIT state first)?