Re: [PATCH 3/6] selftests/x86/xstate: Validate XSTATE_BV in ptrace test
From: Chang S. Bae
Date: Fri Nov 20 2026 - 18:05:53 EST
On 11/9/2026 7:16 PM, Chang S. Bae wrote:
+ if ((xstate.mask & get_xstatebv(xbuf)) == (xstate.mask & get_xstatebv(expected))) {
+ printf("#\tok\tXSTATE_BV\n");
+ } else {
+ printf("#\tnot ok\tXSTATE_BV\n");
+ failed++;
+ }
This check looks excessive because of the XSAVE behavior.
If the kernel ever falls back to XSAVE instead of its variants like XSAVES, XSTATE_BV may be set even if a component stays in init-state. Whether the bit is cleared or not depends on the init-tracking implementation.
So, the most this check can do is ensuring XSTATE_BV is set when the state actually carries non-init values. Let me fix on my next posting.
Thanks,
Chang