Skip to content

Commit f789383

Browse files
committed
x86/ia32: State that IA32 emulation is disabled
Issue a short message once, on the first try to load a 32-bit process to save people time when wondering why it won't load and trying to execute it, would say: -bash: ./strsep32: cannot execute binary file: Exec format error Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://lore.kernel.org/r/20231130155213.1407-1-bp@alien8.de
1 parent 79c603e commit f789383

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

arch/x86/include/asm/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ do { \
150150
((x)->e_machine == EM_X86_64)
151151

152152
#define compat_elf_check_arch(x) \
153-
((elf_check_arch_ia32(x) && ia32_enabled()) || \
153+
((elf_check_arch_ia32(x) && ia32_enabled_verbose()) || \
154154
(IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
155155

156156
static inline void elf_common_init(struct thread_struct *t,

arch/x86/include/asm/ia32.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#ifndef _ASM_X86_IA32_H
33
#define _ASM_X86_IA32_H
44

5-
65
#ifdef CONFIG_IA32_EMULATION
76

87
#include <linux/compat.h>
@@ -84,4 +83,14 @@ static inline bool ia32_enabled(void)
8483

8584
#endif
8685

86+
static inline bool ia32_enabled_verbose(void)
87+
{
88+
bool enabled = ia32_enabled();
89+
90+
if (IS_ENABLED(CONFIG_IA32_EMULATION) && !enabled)
91+
pr_notice_once("32-bit emulation disabled. You can reenable with ia32_emulation=on\n");
92+
93+
return enabled;
94+
}
95+
8796
#endif /* _ASM_X86_IA32_H */

0 commit comments

Comments
 (0)