diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2021-04-17 03:10:08 +0200 |
---|---|---|
committer | Greg Ungerer <gerg@linux-m68k.org> | 2021-04-19 01:56:37 +0200 |
commit | 04d82a6d0881ef1ab1e9f66f10805177ee2fb1e8 (patch) | |
tree | 24c5ead3c1bb507a8682a01b98a278eb95108adb /fs/Kconfig.binfmt | |
parent | Linux 5.12-rc8 (diff) | |
download | linux-04d82a6d0881ef1ab1e9f66f10805177ee2fb1e8.tar.xz linux-04d82a6d0881ef1ab1e9f66f10805177ee2fb1e8.zip |
binfmt_flat: allow not offsetting data start
Commit 2217b9826246 ("binfmt_flat: revert "binfmt_flat: don't offset
the data start"") restored offsetting the start of the data section by
a number of words defined by MAX_SHARED_LIBS. As a result, since
MAX_SHARED_LIBS is never 0, a gap between the text and data sections
always exists. For architectures which cannot support a such gap
between the text and data sections (e.g. riscv nommu), flat binary
programs cannot be executed.
To allow an architecture to request no data start offset to allow for
contiguous text and data sections for binaries flagged with
FLAT_FLAG_RAM, introduce the new config option
CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET. Using this new option, the
macro DATA_START_OFFSET_WORDS is conditionally defined in binfmt_flat.c
to MAX_SHARED_LIBS for architectures tolerating or needing the data
start offset (CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET disabled case)
and to 0 when CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET is enabled.
DATA_START_OFFSET_WORDS is used in load_flat_file() to calculate the
data section length and start position.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Diffstat (limited to 'fs/Kconfig.binfmt')
-rw-r--r-- | fs/Kconfig.binfmt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index c6f1c8c1934e..06fb7a93a1bd 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt @@ -112,6 +112,9 @@ config BINFMT_FLAT_ARGVP_ENVP_ON_STACK config BINFMT_FLAT_OLD_ALWAYS_RAM bool +config BINFMT_FLAT_NO_DATA_START_OFFSET + bool + config BINFMT_FLAT_OLD bool "Enable support for very old legacy flat binaries" depends on BINFMT_FLAT |