Instruction with 0 in fence field being disassembled as fence , iorw.
Printing "unknown" to match GAS behavior.
This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.
Differential D51828
[RISCV] Fix disassembling of fence instruction with invalid field apazos on Sep 7 2018, 5:24 PM. Authored by
Details Instruction with 0 in fence field being disassembled as fence , iorw. This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
Diff Detail
Event TimelineComment Actions Looking at the current spec draft, it's not clear that a zero fence argument is actually invalid (though it may be non-sensical and impossible to generate from the assembler). I note that gas will emit "unknown" for the operand when disassembling. I'm not fully sure what the best solution is here, so first wanted to check if there was part of the spec I might have missed that discussed all-zero predecessor/successor fence arguments. Comment Actions The description of the instruction in RISC-V User-Level ISA V2.2 page 20 does not help much. Right now we disassemble it with no fence argument string: echo "0x0f 0x00 0xf0 0x00" | lvm-mc -disassemble -triple=riscv32 .text fence , iorw And if you take that string and re-assemble it, "fence , iorw" will fail to assemble. When fence argument is 0 GAS disassembles as unknown: But GAS will not reassemble this string: That is why I treated it as invalid. Comment Actions Hi Ana: Does your point is fence , iorw is accepted by GAS? If so, I've fixed that and empty rounding mode problem within same patch. [1] https://github.com/bminor/binutils-gdb/commit/bfb218e3e404a6168888df51c03827eacde9ceea Comment Actions Hi Ana, just some minor comments. With tweaks along the suggested lines, this looks good to me.
|