[PATCH] x86/vm86: Remove deprecated VM86 support
From: Ashwin Gundarapu
Date: Tue May 26 2026 - 12:31:24 EST
VM86 support allows 16-bit DOS programs to run in virtual 8086 mode
on 32-bit x86 kernels. This feature has been deprecated and the Kconfig
help text itself states that any recent software works without it.
Remove the vm86 subsystem including the main driver, Kconfig options,
header files, and all references in thread_info, processor, and
processor-flags headers.
Signed-off-by: Ashwin Gundarapu <linuxuser509@xxxxxxxxxxx>
---
arch/x86/Kconfig | 30 --------------------------
arch/x86/include/asm/processor-flags.h | 6 +-----
arch/x86/include/asm/processor.h | 5 +----
arch/x86/include/asm/thread_info.h | 6 +-----
arch/x86/kernel/Makefile | 1 -
arch/x86/kernel/process.c | 5 -----
6 files changed, 3 insertions(+), 50 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f3f7cb01d69d..de00975e0f11 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1206,36 +1206,6 @@ config X86_MCE_INJECT
source "arch/x86/events/Kconfig"
-config X86_LEGACY_VM86
- bool "Legacy VM86 support"
- depends on X86_32
- help
- This option allows user programs to put the CPU into V8086
- mode, which is an 80286-era approximation of 16-bit real mode.
-
- Some very old versions of X and/or vbetool require this option
- for user mode setting. Similarly, DOSEMU will use it if
- available to accelerate real mode DOS programs. However, any
- recent version of DOSEMU, X, or vbetool should be fully
- functional even without kernel VM86 support, as they will all
- fall back to software emulation. Nevertheless, if you are using
- a 16-bit DOS program where 16-bit performance matters, vm86
- mode might be faster than emulation and you might want to
- enable this option.
-
- Note that any app that works on a 64-bit kernel is unlikely to
- need this option, as 64-bit kernels don't, and can't, support
- V8086 mode. This option is also unrelated to 16-bit protected
- mode and is not needed to run most 16-bit programs under Wine.
-
- Enabling this option increases the complexity of the kernel
- and slows down exception handling a tiny bit.
-
- If unsure, say N here.
-
-config VM86
- bool
- default X86_LEGACY_VM86
config X86_16BIT
bool "Enable support for 16-bit segments" if EXPERT
diff --git a/arch/x86/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h
index e5f204b9b33d..ae0d9980912c 100644
--- a/arch/x86/include/asm/processor-flags.h
+++ b/arch/x86/include/asm/processor-flags.h
@@ -5,11 +5,7 @@
#include <uapi/asm/processor-flags.h>
#include <linux/mem_encrypt.h>
-#ifdef CONFIG_VM86
-#define X86_VM_MASK X86_EFLAGS_VM
-#else
-#define X86_VM_MASK 0 /* No VM86 support */
-#endif
+#define X86_VM_MASK 0 /* No VM86 support */
/*
* CR3's layout varies depending on several things.
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 10b5355b323e..ac9ddde54a93 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -488,10 +488,7 @@ struct thread_struct {
unsigned long cr2;
unsigned long trap_nr;
unsigned long error_code;
-#ifdef CONFIG_VM86
- /* Virtual 86 mode info */
- struct vm86 *vm86;
-#endif
+
/* IO permissions: */
struct io_bitmap *io_bitmap;
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 0067684afb5b..a4af29a906b5 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -36,11 +36,7 @@
* dynamic, but for now it is always 2 words longer.
*/
#ifdef CONFIG_X86_32
-# ifdef CONFIG_VM86
-# define TOP_OF_KERNEL_STACK_PADDING 16
-# else
-# define TOP_OF_KERNEL_STACK_PADDING 8
-# endif
+# define TOP_OF_KERNEL_STACK_PADDING 8
#else /* x86-64 */
# ifdef CONFIG_X86_FRED
# define TOP_OF_KERNEL_STACK_PADDING (2 * 8)
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 47a32f583930..4820aff6cc1b 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -129,7 +129,6 @@ obj-y += kprobes/
obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_X86_32) += doublefault_32.o
obj-$(CONFIG_KGDB) += kgdb.o
-obj-$(CONFIG_VM86) += vm86_32.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_HPET_TIMER) += hpet.o
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4c718f8adc59..7f52fa76b048 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -107,9 +107,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
/* fpu_clone() will initialize the "dst_fpu" memory */
memcpy_and_pad(dst, arch_task_struct_size, src, sizeof(*dst), 0);
-#ifdef CONFIG_VM86
- dst->thread.vm86 = NULL;
-#endif
return 0;
}
@@ -127,12 +124,10 @@ void arch_release_task_struct(struct task_struct *tsk)
*/
void exit_thread(struct task_struct *tsk)
{
- struct thread_struct *t = &tsk->thread;
if (test_thread_flag(TIF_IO_BITMAP))
io_bitmap_exit(tsk);
- free_vm86(t);
shstk_free(tsk);
fpu__drop(tsk);
--
2.43.0