mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: Borislav Petkov <bp@alien8.de>, X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/ia32: State that IA32 emulation is disabled
Date: Thu, 30 Nov 2023 18:04:20 +0200	[thread overview]
Message-ID: <6adeb081-33d9-47f5-b812-e867561e0ded@suse.com> (raw)
In-Reply-To: <20231130155213.1407-1-bp@alien8.de>



On 30.11.23 г. 17:52 ч., Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> 
> 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 says:
> 
>    -bash: ./strsep32: cannot execute binary file: Exec format error
> 
> No functional changes.
> 
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Cc: Nikolay Borisov <nik.borisov@suse.com>
> ---
>   arch/x86/include/asm/elf.h  | 2 +-
>   arch/x86/include/asm/ia32.h | 9 ++++++++-
>   2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
> index a0234dfd1031..1e16bd5ac781 100644
> --- a/arch/x86/include/asm/elf.h
> +++ b/arch/x86/include/asm/elf.h
> @@ -150,7 +150,7 @@ do {						\
>   	((x)->e_machine == EM_X86_64)
>   
>   #define compat_elf_check_arch(x)					\
> -	((elf_check_arch_ia32(x) && ia32_enabled()) ||			\
> +	((elf_check_arch_ia32(x) && ia32_enabled_verbose()) ||		\
>   	 (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
>   
>   static inline void elf_common_init(struct thread_struct *t,
> diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
> index 5a2ae24b1204..43e02b52ad19 100644
> --- a/arch/x86/include/asm/ia32.h
> +++ b/arch/x86/include/asm/ia32.h
> @@ -2,7 +2,6 @@
>   #ifndef _ASM_X86_IA32_H
>   #define _ASM_X86_IA32_H
>   
> -
>   #ifdef CONFIG_IA32_EMULATION
>   
>   #include <linux/compat.h>
> @@ -84,4 +83,12 @@ static inline bool ia32_enabled(void)
>   
>   #endif
>   
> +static inline bool ia32_enabled_verbose(void)
> +{
> +#ifdef CONFIG_IA32_EMULATION
> +	pr_notice_once("32-bit emulation disabled. You can reenable with ia32_emulation=on\n");

	Actually this will result in a false-positive, even with the 
DEFAULT_DISABLED but booting with ia32_emulation = 0 so it's best if 
it's predicated on the output of ia32_enabled. This means we'll always 
pay the price of the branch even if it's disabled but removes a spurious 
notice in a certain case.

> +#endif
> +	return ia32_enabled();
> +}
> +
>   #endif /* _ASM_X86_IA32_H */

  parent reply	other threads:[~2023-11-30 16:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 15:52 Borislav Petkov
2023-11-30 15:59 ` Nikolay Borisov
2023-11-30 16:00 ` Nikolay Borisov
2023-11-30 16:03   ` Borislav Petkov
2023-11-30 16:04 ` Nikolay Borisov [this message]
2023-11-30 16:09 ` Borislav Petkov
2023-11-30 16:42   ` Brian Gerst
2023-11-30 16:47     ` Brian Gerst
2023-12-06 17:20   ` [PATCH -v2] " Borislav Petkov
2023-12-08 18:42     ` Nikolay Borisov
2023-12-08 19:22       ` Borislav Petkov
2023-12-08 19:28         ` Nikolay Borisov
2023-12-11  9:28 ` [tip: x86/misc] " tip-bot2 for Borislav Petkov (AMD)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6adeb081-33d9-47f5-b812-e867561e0ded@suse.com \
    --to=nik.borisov@suse.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®