]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage
authorBorislav Petkov <bp@suse.de>
Fri, 29 Oct 2021 17:27:32 +0000 (19:27 +0200)
committerBorislav Petkov <bp@suse.de>
Sat, 30 Oct 2021 21:18:04 +0000 (23:18 +0200)
commit8d6bf28ae73a89e39a5c8588ab8c39da2e2daea7
tree2c4697954966337d8c576fce4181cb1d81c46bf8
parentb5d0d6cc9213b850e3c21304f56e22c30f4df516
selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage

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: da70be30a85a ("x86/iopl: Fake iopl(3) CLI/STI usage")
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20211030083939.13073-1-bp@alien8.de
tools/testing/selftests/x86/iopl.c