Skip to content

Commit 04db3df

Browse files
pvts-matPlaidCat
authored andcommitted
x86: Introduce ia32_enabled()
jira VULN-772 cve-pre CVE-2024-25744 commit-author Nikolay Borisov <nik.borisov@suse.com> commit 1da5c9b IA32 support on 64bit kernels depends on whether CONFIG_IA32_EMULATION is selected or not. As it is a compile time option it doesn't provide the flexibility to have distributions set their own policy for IA32 support and give the user the flexibility to override it. As a first step introduce ia32_enabled() which abstracts whether IA32 compat is turned on or off. Upcoming patches will implement the ability to set IA32 compat 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-2-nik.borisov@suse.com (cherry picked from commit 1da5c9b) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent a61efbb commit 04db3df

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

arch/x86/entry/common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ static __always_inline int syscall_32_enter(struct pt_regs *regs)
9696
return (int)regs->orig_ax;
9797
}
9898

99+
#ifdef CONFIG_IA32_EMULATION
100+
bool __ia32_enabled __ro_after_init = true;
101+
#endif
102+
99103
/*
100104
* Invoke a 32-bit syscall. Called with IRQs on in CONTEXT_KERNEL.
101105
*/

arch/x86/include/asm/ia32.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ extern void ia32_pick_mmap_layout(struct mm_struct *mm);
6868

6969
#endif
7070

71-
#endif /* CONFIG_IA32_EMULATION */
71+
extern bool __ia32_enabled;
72+
73+
static inline bool ia32_enabled(void)
74+
{
75+
return __ia32_enabled;
76+
}
77+
78+
#else /* !CONFIG_IA32_EMULATION */
79+
80+
static inline bool ia32_enabled(void)
81+
{
82+
return IS_ENABLED(CONFIG_X86_32);
83+
}
84+
85+
#endif
7286

7387
#endif /* _ASM_X86_IA32_H */

0 commit comments

Comments
 (0)