linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-mips@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH 10/10] Kconfig: regularize selection of CONFIG_BINFMT_ELF
Date: Thu,  3 Dec 2020 21:46:41 +0000	[thread overview]
Message-ID: <20201203214641.3887979-10-viro@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20201203214641.3887979-1-viro@ZenIV.linux.org.uk>

From: Al Viro <viro@zeniv.linux.org.uk>

with mips converted to use of fs/config_binfmt_elf.c, there's no
need to keep selects of that thing all over arch/* - we can simply
turn into def_bool y if COMPAT && BINFMT_ELF (in fs/Kconfig.binfmt)
and get rid of all selects.

Several architectures got those selects wrong (e.g. you could
end up with sparc64 sans BINFMT_ELF, with select violating
dependencies, or with amd64 with X32 and BINFMT_ELF enabled,
but unable to exec any X32 binaries), etc.

Randy Dunlap has spotted some of those; IMO this is simpler than
his fix, but it depends upon the stuff that would need to be
backported, so we might end up using his variant for -stable.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 arch/arm64/Kconfig   | 1 -
 arch/mips/Kconfig    | 2 --
 arch/parisc/Kconfig  | 1 -
 arch/powerpc/Kconfig | 1 -
 arch/s390/Kconfig    | 1 -
 arch/sparc/Kconfig   | 1 -
 arch/x86/Kconfig     | 1 -
 fs/Kconfig.binfmt    | 2 +-
 8 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f858c352f72a..84a0af4ba8d7 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1196,7 +1196,6 @@ config ARM64_TAGGED_ADDR_ABI
 menuconfig COMPAT
 	bool "Kernel support for 32-bit EL0"
 	depends on ARM64_4K_PAGES || EXPERT
-	select COMPAT_BINFMT_ELF if BINFMT_ELF
 	select HAVE_UID16
 	select OLD_SIGSUSPEND3
 	select COMPAT_OLD_SIGACTION
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index f14731aee182..df35ce61aa81 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3271,7 +3271,6 @@ config MIPS32_O32
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT
 	select MIPS32_COMPAT
-	select COMPAT_BINFMT_ELF
 	select SYSVIPC_COMPAT if SYSVIPC
 	help
 	  Select this option if you want to run o32 binaries.  These are pure
@@ -3285,7 +3284,6 @@ config MIPS32_N32
 	depends on 64BIT
 	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
 	select COMPAT
-	select COMPAT_BINFMT_ELF
 	select MIPS32_COMPAT
 	select SYSVIPC_COMPAT if SYSVIPC
 	help
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index b234e8154cbd..97c233a7445c 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -336,7 +336,6 @@ source "kernel/Kconfig.hz"
 config COMPAT
 	def_bool y
 	depends on 64BIT
-	select COMPAT_BINFMT_ELF if BINFMT_ELF
 
 config SYSVIPC_COMPAT
 	def_bool y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e9f13fe08492..d27469a024a5 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -278,7 +278,6 @@ config COMPAT
 	bool "Enable support for 32bit binaries"
 	depends on PPC64
 	default y if !CPU_LITTLE_ENDIAN
-	select COMPAT_BINFMT_ELF
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
 
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 4a2a12be04c9..55d140044f32 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -426,7 +426,6 @@ config 64BIT
 config COMPAT
 	def_bool y
 	prompt "Kernel support for 31 bit emulation"
-	select COMPAT_BINFMT_ELF if BINFMT_ELF
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
 	select HAVE_UID16
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index a6ca135442f9..12943d94fcd0 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -496,7 +496,6 @@ config COMPAT
 	bool
 	depends on SPARC64
 	default y
-	select COMPAT_BINFMT_ELF
 	select HAVE_UID16
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select COMPAT_OLD_SIGACTION
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8eea77cf53a7..638fdf3e6578 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2844,7 +2844,6 @@ config IA32_EMULATION
 	depends on X86_64
 	select ARCH_WANT_OLD_COMPAT_IPC
 	select BINFMT_ELF
-	select COMPAT_BINFMT_ELF
 	select COMPAT_OLD_SIGACTION
 	help
 	  Include code to run legacy 32-bit programs under a
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 885da6d983b4..b32f5df68ae9 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -29,7 +29,7 @@ config BINFMT_ELF
 	  latest version).
 
 config COMPAT_BINFMT_ELF
-	bool
+	def_bool y
 	depends on COMPAT && BINFMT_ELF
 	select ELFCORE
 
-- 
2.11.0


  parent reply	other threads:[~2020-12-03 21:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 21:45 [PATCHSET] saner elf compat Al Viro
2020-12-03 21:46 ` [PATCH 01/10] binfmt_elf: partially sanitize PRSTATUS_SIZE and SET_PR_FPVALID Al Viro
2020-12-03 21:46   ` [PATCH 02/10] elf_prstatus: collect the common part (everything before pr_reg) into a struct Al Viro
2020-12-03 21:46   ` [PATCH 03/10] [elfcore-compat][amd64] clean PRSTATUS_SIZE/SET_PR_FPVALID up properly Al Viro
2020-12-03 21:46   ` [PATCH 04/10] mips binfmt_elf*32.c: use elfcore-compat.h Al Viro
2020-12-03 21:46   ` [PATCH 05/10] mips: kill unused definitions in binfmt_elf[on]32.c Al Viro
2020-12-03 21:46   ` [PATCH 06/10] mips: KVM_GUEST makes no sense for 64bit builds Al Viro
2020-12-03 21:46   ` [PATCH 07/10] mips compat: don't bother with ELF_ET_DYN_BASE Al Viro
2020-12-03 21:46   ` [PATCH 08/10] mips: don't bother with ELF_CORE_EFLAGS Al Viro
2020-12-03 21:46   ` [PATCH 09/10] mips compat: switch to compat_binfmt_elf.c Al Viro
2020-12-03 21:46   ` Al Viro [this message]
2020-12-03 22:09 ` [PATCHSET] saner elf compat Linus Torvalds
2020-12-03 23:03   ` Al Viro
2020-12-06  3:23     ` Al Viro
2020-12-07  3:36       ` hpa
2020-12-07 18:01     ` Maciej W. Rozycki
2020-12-16  3:01       ` Al Viro
2020-12-16  9:44         ` Maciej W. Rozycki
2020-12-22 20:04           ` Al Viro
2020-12-22 21:38             ` Al Viro
2020-12-22 22:57               ` Al Viro
2020-12-23  7:03           ` Al Viro
2020-12-23  7:12             ` Al Viro
2020-12-24 19:44               ` [RFC][PATCH] NT_FILE/NT_SIGINFO breakage on mips compat coredumps Al Viro
2020-12-29 15:09                 ` Thomas Bogendoerfer
2020-12-15 19:54     ` [PATCHSET] saner elf compat Thomas Bogendoerfer

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=20201203214641.3887979-10-viro@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).