[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210407141359.GA19843@lst.de>
Date: Wed, 7 Apr 2021 16:13:59 +0200
From: Christoph Hellwig <hch@....de>
To: Damien Le Moal <damien.lemoal@....com>
Cc: Palmer Dabbelt <palmer@...belt.com>,
linux-riscv@...ts.infradead.org,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org, Max Filippov <jcmvbkbc@...il.com>,
Greg Ungerer <gerg@...ux-m68k.org>,
Anup Patel <anup.patel@....com>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 1/2] binfmt_flat: allow not offsetting data start
On Wed, Apr 07, 2021 at 08:56:37PM +0900, Damien Le Moal wrote:
> 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 exist. For architecture 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 contiguous text and data sections,
> introduce the macro FLAT_TEXT_DATA_NO_GAP which can be defined by the
> architecture in its asm/flat.h file. With this change, the macro
> DATA_GAP_WORDS is conditionally defined in binfmt_flat.c to
> MAX_SHARED_LIBS for architectures tolerating the gap
> (FLAT_TEXT_DATA_NO_GAP undefined case) and to 0 when
> FLAT_TEXT_DATA_NO_GAP is defined. DATA_GAP_WORDS is used in
> load_flat_file() to calculate the data section length and start
> position.
>
> The definition of FLAT_TEXT_DATA_NO_GAP by an architecture also
> prevents the use of the separate text/data load case (when
> FLAT_FLAG_RAM and FLAT_FLAG_GZIP are not set with NOMMU kernels).
Please make this a CONFIG_* option selected by the architecture,
which also allows to use IS_ENABLED() to error out early for
your check.
Powered by blists - more mailing lists