[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407115638.1055824-1-damien.lemoal@wdc.com>
Date: Wed, 7 Apr 2021 20:56:36 +0900
From: Damien Le Moal <damien.lemoal@....com>
To: 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 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 resolve 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(). The second patch
adds the asm/flat.h file to riscv arch to request the gap suppression
using the newly introduced macro FLAT_TEXT_DATA_NO_GAP.
These patches do not change the binfmt_flat loader behavior for other
architectures.
Damien Le Moal (2):
binfmt_flat: allow not offsetting data start
riscv: introduce asm/flat.h
arch/riscv/include/asm/Kbuild | 1 -
arch/riscv/include/asm/flat.h | 29 +++++++++++++++++++++++++++++
fs/binfmt_flat.c | 25 +++++++++++++++++++------
3 files changed, 48 insertions(+), 7 deletions(-)
create mode 100644 arch/riscv/include/asm/flat.h
--
2.30.2
Powered by blists - more mailing lists