]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/iopl: Restrict iopl() permission scope
authorThomas Gleixner <tglx@linutronix.de>
Mon, 11 Nov 2019 22:03:28 +0000 (23:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 16 Nov 2019 10:24:05 +0000 (11:24 +0100)
commitc8137ace56383688af911fea5934c71ad158135e
tree27f653f628e61a868ef0e4d9ece62185e1c24952
parentbe9afb4b529d9e3a68da1212e33be677bbfc8d2c
x86/iopl: Restrict iopl() permission scope

The access to the full I/O port range can be also provided by the TSS I/O
bitmap, but that would require to copy 8k of data on scheduling in the
task. As shown with the sched out optimization TSS.io_bitmap_base can be
used to switch the incoming task to a preallocated I/O bitmap which has all
bits zero, i.e. allows access to all I/O ports.

Implementing this allows to provide an iopl() emulation mode which restricts
the IOPL level 3 permissions to I/O port access but removes the STI/CLI
permission which is coming with the hardware IOPL mechansim.

Provide a config option to switch IOPL to emulation mode, make it the
default and while at it also provide an option to disable IOPL completely.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
arch/x86/Kconfig
arch/x86/include/asm/pgtable_32_types.h
arch/x86/include/asm/processor.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/ioport.c
arch/x86/kernel/process.c