From: Damien Le Moal <damien.lemoal@wdc.com> To: uclinux-dev@uclinux.org, ugerg@linux-m68k.org, Palmer Dabbelt <palmer@dabbelt.com>, linux-riscv@lists.infradead.org, Alexander Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org Cc: Max Filippov <jcmvbkbc@gmail.com>, Greg Ungerer <gerg@linux-m68k.org>, Anup Patel <anup.patel@wdc.com>, Christoph Hellwig <hch@lst.de> Subject: [PATCH v3 2/2] riscv: Disable text-data gap in flat binaries Date: Thu, 15 Apr 2021 15:15:02 +0900 [thread overview] Message-ID: <20210415061502.7248-3-damien.lemoal@wdc.com> (raw) In-Reply-To: <20210415061502.7248-1-damien.lemoal@wdc.com> uclibc/gcc combined with elf2flt riscv linker file fully resolve the PC relative __global_pointer$ value at compile time and do not generate a relocation entry to set a runtime gp value. As a result, if the flatbin loader introduces a gap between the text and data sections, the gp value becomes incorrect and prevent correct execution of a flatbin executable. Avoid this problem by enabling CONFIG_BINFMT_FLAT_NO_TEXT_DATA_GAP automatically when CONFIG_RISCV is enabled and CONFIG_MMU disabled. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Acked-by: Palmer Dabbelt <palmerdabbelt@google.com> --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0d0cf67359cb..6a85fbbd056e 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -33,6 +33,7 @@ config RISCV select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_HUGE_PMD_SHARE if 64BIT + select BINFMT_FLAT_NO_TEXT_DATA_GAP if !MMU select CLONE_BACKWARDS select CLINT_TIMER if !MMU select COMMON_CLK -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Damien Le Moal <damien.lemoal@wdc.com> To: uclinux-dev@uclinux.org, ugerg@linux-m68k.org, Palmer Dabbelt <palmer@dabbelt.com>, linux-riscv@lists.infradead.org, Alexander Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org Cc: Max Filippov <jcmvbkbc@gmail.com>, Greg Ungerer <gerg@linux-m68k.org>, Anup Patel <anup.patel@wdc.com>, Christoph Hellwig <hch@lst.de> Subject: [PATCH v3 2/2] riscv: Disable text-data gap in flat binaries Date: Thu, 15 Apr 2021 15:15:02 +0900 [thread overview] Message-ID: <20210415061502.7248-3-damien.lemoal@wdc.com> (raw) In-Reply-To: <20210415061502.7248-1-damien.lemoal@wdc.com> uclibc/gcc combined with elf2flt riscv linker file fully resolve the PC relative __global_pointer$ value at compile time and do not generate a relocation entry to set a runtime gp value. As a result, if the flatbin loader introduces a gap between the text and data sections, the gp value becomes incorrect and prevent correct execution of a flatbin executable. Avoid this problem by enabling CONFIG_BINFMT_FLAT_NO_TEXT_DATA_GAP automatically when CONFIG_RISCV is enabled and CONFIG_MMU disabled. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Acked-by: Palmer Dabbelt <palmerdabbelt@google.com> --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0d0cf67359cb..6a85fbbd056e 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -33,6 +33,7 @@ config RISCV select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_HUGE_PMD_SHARE if 64BIT + select BINFMT_FLAT_NO_TEXT_DATA_GAP if !MMU select CLONE_BACKWARDS select CLINT_TIMER if !MMU select COMMON_CLK -- 2.30.2 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-04-15 6:15 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-15 6:15 [PATCH v3 0/2] Fix binfmt_flat loader for RISC-V Damien Le Moal 2021-04-15 6:15 ` Damien Le Moal 2021-04-15 6:15 ` [PATCH v3 1/2] binfmt_flat: allow not offsetting data start Damien Le Moal 2021-04-15 6:15 ` Damien Le Moal 2021-04-15 14:04 ` Greg Ungerer 2021-04-15 14:04 ` Greg Ungerer 2021-04-15 23:22 ` Damien Le Moal 2021-04-15 23:22 ` Damien Le Moal 2021-04-16 7:24 ` Greg Ungerer 2021-04-16 7:24 ` Greg Ungerer 2021-04-16 7:35 ` Damien Le Moal 2021-04-16 7:35 ` Damien Le Moal 2021-04-15 6:15 ` Damien Le Moal [this message] 2021-04-15 6:15 ` [PATCH v3 2/2] riscv: Disable text-data gap in flat binaries Damien Le Moal
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=20210415061502.7248-3-damien.lemoal@wdc.com \ --to=damien.lemoal@wdc.com \ --cc=anup.patel@wdc.com \ --cc=gerg@linux-m68k.org \ --cc=hch@lst.de \ --cc=jcmvbkbc@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=uclinux-dev@uclinux.org \ --cc=ugerg@linux-m68k.org \ --cc=viro@zeniv.linux.org.uk \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.