[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210415061502.7248-1-damien.lemoal@wdc.com>
Date: Thu, 15 Apr 2021 15:15:00 +0900
From: Damien Le Moal <damien.lemoal@....com>
To: uclinux-dev@...inux.org, ugerg@...ux-m68k.org,
Palmer Dabbelt <palmer@...belt.com>,
linux-riscv@...ts.infradead.org,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org
Cc: Max Filippov <jcmvbkbc@...il.com>,
Greg Ungerer <gerg@...ux-m68k.org>,
Anup Patel <anup.patel@....com>, Christoph Hellwig <hch@....de>
Subject: [PATCH v3 0/2] Fix binfmt_flat loader for RISC-V
RISC-V NOMMU flat binaries cannot tolerate a gap between the text and
data section as the toolchain fully resolves at compile time the PC
relative global pointer (__global_pointer$ value loaded in gp register).
Without a relocation entry provided, the flat bin loader cannot fix the
value if a gap is introduced and executables fail to run.
This series fixes this problem by allowing an architecture to request
the flat loader to suppress the gap between the text and data sections.
The first patch fixes binfmt_flat flat_load_file() using the new
configuration option CONFIG_BINFMT_FLAT_NO_TEXT_DATA_GAP. The second
patch enables this option for RISCV NOMMU builds.
These patches do not change the binfmt_flat loader behavior for other
architectures.
Changes from v2:
* Updated distribution list
* Added Palmer ack-by tag
Changes from v1:
* Replace FLAT_TEXT_DATA_NO_GAP macro with
CONFIG_BINFMT_FLAT_NO_TEXT_DATA_GAP config option (patch 1).
* Remove the addition of riscv/include/asm/flat.h and set
CONFIG_BINFMT_FLAT_NO_TEXT_DATA_GAP for RISCV and !MMU
Damien Le Moal (2):
binfmt_flat: allow not offsetting data start
riscv: Disable text-data gap in flat binaries
arch/riscv/Kconfig | 1 +
fs/Kconfig.binfmt | 3 +++
fs/binfmt_flat.c | 21 +++++++++++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
--
2.30.2
Powered by blists - more mailing lists