From: <Conor.Dooley@microchip.com>
To: <vineetg@rivosinc.com>, <linux-riscv@lists.infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <palmer@rivosinc.com>,
<cmuellner@ventanamicro.com>, <linux@rivosinc.com>
Subject: Re: [PATCH v2] riscv: ztso: disallow elf binaries needing TSO
Date: Fri, 16 Sep 2022 06:58:05 +0000 [thread overview]
Message-ID: <9b9ff287-75e5-3ee5-e6c5-1daca6c562dc@microchip.com> (raw)
In-Reply-To: <67a3aba3-68bb-5e8b-4e4e-869c8e99e879@microchip.com>
On 16/09/2022 07:34, Conor Dooley wrote:
> On 16/09/2022 05:23, Vineet Gupta wrote:
>> [You don't often get email from vineetg@rivosinc.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> As of now the software stack needs work to support ztso. Until that work
>> is finished, disallow binaries needing TSO.
>>
>> This patch is needed to help ztso ratification and prolifiration of tso
>> bits in tooling.
>
> I have to admit to being a little confused here, if Ztso is not ratified
> why do we need to protect ourselves from it?
Also, since this is not marked as a fix, why would we not just apply the
patchset from Palmer that looks like a more complete version of this
patch:
https://lore.kernel.org/linux-riscv/20220902034352.8825-1-palmer@rivosinc.com/
Maybe you could offer an R-b or some comments on that patch instead?
Thanks,
Conor.
>
>>
>> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
>> ---
>> Changes since v1
>> - Build error (and boot tested on qemu)
>> - Improved the comments a bit
>> ---
>> arch/riscv/include/asm/elf.h | 11 ++++++++++-
>> arch/riscv/include/uapi/asm/elf.h | 2 ++
>> 2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h
>> index f53c40026c7a..b6b4542b3039 100644
>> --- a/arch/riscv/include/asm/elf.h
>> +++ b/arch/riscv/include/asm/elf.h
>> @@ -26,10 +26,19 @@
>>
>> #define ELF_DATA ELFDATA2LSB
>>
>> +/*
>> + * Make sure the elf being loaded is compatible with extensions.
>> + *
>> + * In the final incarnation this will get the extension list from DT and
>> + * make sure elf can run on given hardware+kernel.
>> + * For now disallow TSO built binaries.
>> + */
>> +#define rv_ext_ok(x) (!((x)->e_flags & EF_RISCV_TSO))
>> +
>> /*
>> * This is used to ensure we don't load something for the wrong architecture.
>> */
>> -#define elf_check_arch(x) ((x)->e_machine == EM_RISCV)
>> +#define elf_check_arch(x) ((x)->e_machine == EM_RISCV && rv_ext_ok(x))
>>
>> #define CORE_DUMP_USE_REGSET
>> #define ELF_EXEC_PAGESIZE (PAGE_SIZE)
>> diff --git a/arch/riscv/include/uapi/asm/elf.h b/arch/riscv/include/uapi/asm/elf.h
>> index d696d6610231..fa9e4c52c7ac 100644
>> --- a/arch/riscv/include/uapi/asm/elf.h
>> +++ b/arch/riscv/include/uapi/asm/elf.h
>> @@ -32,6 +32,8 @@ typedef union __riscv_fp_state elf_fpregset_t;
>> #define ELF_RISCV_R_TYPE(r_info) ELF32_R_TYPE(r_info)
>> #endif
>>
>> +#define EF_RISCV_TSO (1 << 3)
>
> s/EF/ELF ?
>
> Thanks,
> Conor.
>
>> +
>> /*
>> * RISC-V relocation types
>> */
>> --
>> 2.34.1
>>
>>
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
next prev parent reply other threads:[~2022-09-16 6:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 3:05 [PATCH] riscv: ztso: disallow elf binaries needing TSO Vineet Gupta
2022-09-16 4:23 ` [PATCH v2] " Vineet Gupta
2022-09-16 6:34 ` Conor.Dooley
[not found] ` <CAHYeh+okQuVQjRX_6CwEK5-zWFDcRfUF132WXt2BNbMSAP8_mA@mail.gmail.com>
2022-09-16 6:50 ` Conor.Dooley
2022-09-16 6:58 ` Conor.Dooley [this message]
2022-09-16 9:54 ` Palmer Dabbelt
2022-09-16 16:28 ` Vineet Gupta
2022-09-16 16:37 ` Conor.Dooley
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=9b9ff287-75e5-3ee5-e6c5-1daca6c562dc@microchip.com \
--to=conor.dooley@microchip.com \
--cc=cmuellner@ventanamicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@rivosinc.com \
--cc=palmer@rivosinc.com \
--cc=vineetg@rivosinc.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox