Skip to content

Commit 83e8053

Browse files
pvts-matPlaidCat
authored andcommitted
x86: Make IA32_EMULATION boot time configurable
jira VULN-772 cve-pre CVE-2024-25744 commit-author Nikolay Borisov <nik.borisov@suse.com> commit a11e097 Distributions would like to reduce their attack surface as much as possible but at the same time they'd want to retain flexibility to cater to a variety of legacy software. This stems from the conjecture that compat layer is likely rarely tested and could have latent security bugs. Ideally distributions will set their default policy and also give users the ability to override it as appropriate. To enable this use case, introduce CONFIG_IA32_EMULATION_DEFAULT_DISABLED compile time option, which controls whether 32bit processes/syscalls should be allowed or not. This option is aimed mainly at distributions to set their preferred default behavior in their kernels. To allow users to override the distro's policy, introduce the 'ia32_emulation' parameter which allows overriding CONFIG_IA32_EMULATION_DEFAULT_DISABLED state at boot time. Signed-off-by: Nikolay Borisov <nik.borisov@suse.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230623111409.3047467-7-nik.borisov@suse.com (cherry picked from commit a11e097) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 62cd6a7 commit 83e8053

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,12 @@
17411741
0 -- machine default
17421742
1 -- force brightness inversion
17431743

1744+
ia32_emulation= [X86-64]
1745+
Format: <bool>
1746+
When true, allows loading 32-bit programs and executing 32-bit
1747+
syscalls, essentially overriding IA32_EMULATION_DEFAULT_DISABLED at
1748+
boot time. When false, unconditionally disables IA32 emulation.
1749+
17441750
icn= [HW,ISDN]
17451751
Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
17461752

arch/x86/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2944,6 +2944,15 @@ config IA32_EMULATION
29442944
64-bit kernel. You should likely turn this on, unless you're
29452945
100% sure that you don't have any 32-bit programs left.
29462946

2947+
config IA32_EMULATION_DEFAULT_DISABLED
2948+
bool "IA32 emulation disabled by default"
2949+
default n
2950+
depends on IA32_EMULATION
2951+
help
2952+
Make IA32 emulation disabled by default. This prevents loading 32-bit
2953+
processes and access to 32-bit syscalls. If unsure, leave it to its
2954+
default value.
2955+
29472956
config IA32_AOUT
29482957
tristate "IA32 a.out support"
29492958
depends on IA32_EMULATION

arch/x86/entry/common.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/nospec.h>
2020
#include <linux/syscalls.h>
2121
#include <linux/uaccess.h>
22+
#include <linux/init.h>
2223

2324
#ifdef CONFIG_XEN_PV
2425
#include <xen/xen-ops.h>
@@ -97,7 +98,13 @@ static __always_inline int syscall_32_enter(struct pt_regs *regs)
9798
}
9899

99100
#ifdef CONFIG_IA32_EMULATION
100-
bool __ia32_enabled __ro_after_init = true;
101+
bool __ia32_enabled __ro_after_init = !IS_ENABLED(CONFIG_IA32_EMULATION_DEFAULT_DISABLED);
102+
103+
static int ia32_emulation_override_cmdline(char *arg)
104+
{
105+
return kstrtobool(arg, &__ia32_enabled);
106+
}
107+
early_param("ia32_emulation", ia32_emulation_override_cmdline);
101108
#endif
102109

103110
/*

0 commit comments

Comments
 (0)