[PATCH] RISC-V: Reject empty rouding mode and fence operand.

5 views
Skip to first unread message

Kito Cheng

unread,
Aug 21, 2018, 11:54:04 AM8/21/18
to Jim Wilson, binu...@sourceware.org, pat...@groups.riscv.org, Ana Pazos, Alex Bradbury
Hi Jim:

Current assembler will accept empty operand for fence and rounding
mode, such as "fence ," or "fadd.s fa1,fa1,fa1,", it cause by strncmp
with zero length in arg_lookup function.

This patch including the fix and add 2 test cases for that, those case
was explored by LLVM's MC fuzzer testing tool developed by Ana's team
(Codeaurora) :)


gas/ChangeLog

2018-08-21 Kito Cheng <ki...@andestech.com>

* config/tc-riscv.c (arg_lookup): Checking
lenght before look up.
* testsuite/gas/riscv/fence-fail.d: New file.
* testsuite/gas/riscv/fence-fail.l: Likewise.
* testsuite/gas/riscv/fence-fail.s: Likewise.
* testsuite/gas/riscv/rouding-fail.d: Likewise.
* testsuite/gas/riscv/rouding-fail.l: Likewise.
* testsuite/gas/riscv/rouding-fail.s: Likewise.

Jim Wilson

unread,
Aug 21, 2018, 1:59:30 PM8/21/18
to Kito Cheng, Binutils, RISC-V Patches, Ana Pazos, Alex Bradbury
On Tue, Aug 21, 2018 at 8:53 AM, Kito Cheng <kito....@gmail.com> wrote:
> Current assembler will accept empty operand for fence and rounding
> mode, such as "fence ," or "fadd.s fa1,fa1,fa1,", it cause by strncmp
> with zero length in arg_lookup function.

There is a ChangeLog entry but no patch.

There is a typo in the ChangeLog entry
lenght -> length

Jim

Kito Cheng

unread,
Aug 21, 2018, 9:29:23 PM8/21/18
to pat...@groups.riscv.org, binu...@sourceware.org, Ana Pazos, Alex Bradbury
Hi Jim:

Oh, my mistake..., patch attached.




gas/ChangeLog

2018-08-21 Kito Cheng <ki...@andestech.com>

* config/tc-riscv.c (arg_lookup): Checking
length before look up.
* testsuite/gas/riscv/fence-fail.d: New file.
* testsuite/gas/riscv/fence-fail.l: Likewise.
* testsuite/gas/riscv/fence-fail.s: Likewise.
* testsuite/gas/riscv/rouding-fail.d: Likewise.
* testsuite/gas/riscv/rouding-fail.l: Likewise.
* testsuite/gas/riscv/rouding-fail.s: Likewise.
> --
> You received this message because you are subscribed to the Google Groups "RISC-V Patches" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to patches+u...@groups.riscv.org.
> To post to this group, send email to pat...@groups.riscv.org.
> Visit this group at https://groups.google.com/a/groups.riscv.org/group/patches/.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/patches/CAFyWVabKZpw6g4P8Dq_1MMKCLv1yemTsNH6hQ%3DFbKndKL0omkg%40mail.gmail.com.
> For more options, visit https://groups.google.com/a/groups.riscv.org/d/optout.
0001-RISC-V-Reject-empty-rouding-mode-and-fence-operand.patch

Jim Wilson

unread,
Aug 23, 2018, 4:30:32 PM8/23/18
to Kito Cheng, pat...@groups.riscv.org, binu...@sourceware.org, Ana Pazos, Alex Bradbury
On 08/21/2018 06:29 PM, Kito Cheng wrote:
>> On Tue, Aug 21, 2018 at 8:53 AM, Kito Cheng <kito....@gmail.com> wrote:
>>> Current assembler will accept empty operand for fence and rounding
>>> mode, such as "fence ," or "fadd.s fa1,fa1,fa1,", it cause by strncmp
>>> with zero length in arg_lookup function.

Thanks. I did some cross rv{32,64}-{elf,linux} testing and then
committed your patch.

Jim
Reply all
Reply to author
Forward
0 new messages