Skip to contentSkip to conversation

x86/tools: Use a longer buffer for insn_decoder_test

PATCH In review Mitchell Levy 2 participants 2 messages Nov 20, 2024 – Nov 21, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/tools: Use a longer buffer for insn_decoder_test

Use a 1024 byte buffer for parsing objdump output lines to accommodate long symbols created by rust doctests.

The number 1024 is based on giving a healthy margin above KSYM_NAME_LEN to accommodate angle brackets, addresses, and whitespace.

---
Rust doctests can result in very long symbol names, which results in
very long lines in objdump output, such as:
<__pfx__RINvNtCshBBT4i9RzFA_4core3ptr13drop_in_placeINtNtNtCskPkSD4WGMmy_6kernel4sync3arc3ArcINtNtNtNtBN_5block2mq7tag_set6TagSetNtNvNvNvCs8MySzWyGC07_25doctests_kernel_generated33rust_doctest_kernel_block_mq_rs_04main42__doctest_main_rust_kernel_block_mq_rs_58_011MyBlkDeviceEEEB23_>:ffffffff818bb250

Currently, fgets will truncate on the first read of this line (but this is fine since we see it starts with '<' and continue the loop), but on the second we get "rs_58_011MyBlkDeviceEEEB23_>:ffffffff818bb250", which is treated as malformed.

---
 arch/x86/tools/insn_decoder_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/tools/insn_decoder_test.c +1 -1
index 472540aeabc2..18601b3c5037 100644
@@ -106,7 +106,7 @@ static void parse_args(int argc, char **argv)
 	}
 }
 
-#define BUFSIZE 256
+#define BUFSIZE 1024
 
 int main(int argc, char **argv)
 {

---
base-commit: 37c5695cb37a20403947062be8cb7e00f6bed353
change-id: 20241118-insn-decoder-test-len-fix-0a8c622e79d4

Best regards,

Signature · 1 line
Mitchell Levy <[email protected]>
#1 lore raw
Quoted 12 lines · Mitchell Levy

Use a 1024 byte buffer for parsing objdump output lines to accommodate long symbols created by rust doctests.

The number 1024 is based on giving a healthy margin above KSYM_NAME_LEN to accommodate angle brackets, addresses, and whitespace.

---
Rust doctests can result in very long symbol names, which results in
very long lines in objdump output, such as:
<__pfx__RINvNtCshBBT4i9RzFA_4core3ptr13drop_in_placeINtNtNtCskPkSD4WGMmy_6kernel4sync3arc3ArcINtNtNtNtBN_5block2mq7tag_set6TagSetNtNvNvNvCs8MySzWyGC07_25doctests_kernel_generated33rust_doctest_kernel_block_mq_rs_04main42__doctest_main_rust_kernel_block_mq_rs_58_011MyBlkDeviceEEEB23_>:ffffffff818bb250

Quoted 6 lines

Currently, fgets will truncate on the first read of this line (but this is fine since we see it starts with '<' and continue the loop), but on the second we get "rs_58_011MyBlkDeviceEEEB23_>:ffffffff818bb250", which is treated as malformed.

Thanks Mitchell -- this is:

    https://lore.kernel.org/rust-for-linux/[email protected]/

as well as:

    https://lore.kernel.org/rust-for-linux/[email protected]/

It would be nice to get something like this finally in.

Cheers,
Miguel