Re: [PATCH] selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage

From: Thomas Gleixner
Date: Sat Oct 30 2021 - 17:08:54 EST


On Sat, Oct 30 2021 at 10:39, Borislav Petkov wrote:

> From: Borislav Petkov <bp@xxxxxxx>
>
> Commit in Fixes changed the iopl emulation to not #GP on CLI and STI
> because it would break some insane luserspace tools which would toggle
> interrupts.
>
> The corresponding selftest would rely on the fact that executing CLI/STI
> would trigger a #GP and thus detect it this way but since that #GP is
> not happening anymore, the detection is now wrong too.
>
> Extend the test to actually look at the IF flag and whether executing
> those insns had any effect on it. The STI detection needs to have the
> fact that interrupts were previously disabled, passed in so do that from
> the previous CLI test, i.e., STI test needs to follow a previous CLI one
> for it to make sense.
>
> Fixes: b968e84b509d ("x86/iopl: Fake iopl(3) CLI/STI usage")
> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>

Acked-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>