public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/insn_decoder_test: allow longer symbol-names
@ 2023-01-24 11:04 David Rheinsberg
  2023-01-25 11:30 ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: David Rheinsberg @ 2023-01-24 11:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rust-for-linux, H. Peter Anvin, x86, Dave Hansen, Borislav Petkov,
	Ingo Molnar, Thomas Gleixner

Increase the allowed line-length of the insn-decoder-test to 4k to allow
for symbol-names longer than 256 characters.

The insn-decoder-test takes objdump output as input, which may contain
symbol-names as instruction arguments. With rust-code entering the
kernel, those symbol-names will include mangled-symbols which might
exceed the current line-length-limit of the tool.

By bumping the line-length-limit of the tool to 4k, we get a reasonable
buffer for all objdump outputs I have seen so far. Unfortunately, ELF
symbol-names are not restricted in length, so technically this might
still end up failing if we encounter longer names in the future.

My compile-failure looks like this:

    arch/x86/tools/insn_decoder_test: error: malformed line 1152000:
    tBb_+0xf2>

..which overflowed by 10 characters reading this line:

    ffffffff81458193:   74 3d                   je     ffffffff814581d2 <_RNvXse_NtNtNtCshGpAVYOtgW1_4core4iter8adapters7flattenINtB5_13FlattenCompatINtNtB7_3map3MapNtNtNtBb_3str4iter5CharsNtB1v_17CharEscapeDefaultENtNtBb_4char13EscapeDefaultENtNtBb_3fmt5Debug3fmtBb_+0xf2>

Signed-off-by: David Rheinsberg <david@readahead.eu>
---
 arch/x86/tools/insn_decoder_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/tools/insn_decoder_test.c b/arch/x86/tools/insn_decoder_test.c
index 472540aeabc2..366e07546344 100644
--- a/arch/x86/tools/insn_decoder_test.c
+++ b/arch/x86/tools/insn_decoder_test.c
@@ -106,7 +106,7 @@ static void parse_args(int argc, char **argv)
 	}
 }
 
-#define BUFSIZE 256
+#define BUFSIZE 4096
 
 int main(int argc, char **argv)
 {
-- 
2.39.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [PATCH] x86/insn_decoder_test: allow longer symbol-names
@ 2024-11-29 15:40 Richard W.M. Jones
  2024-12-24 15:24 ` Andrew Halaney
  0 siblings, 1 reply; 9+ messages in thread
From: Richard W.M. Jones @ 2024-11-29 15:40 UTC (permalink / raw)
  To: David Rheinsberg, linux-kernel, H. Peter Anvin, Dave Hansen,
	Borislav Petkov, Ingo Molnar, Thomas Gleixner

[Sorry for possible mail threading errors, I don't have the original
email in my archive.]

We're hitting the bug mentioned in this old patch:

[https://lore.kernel.org/lkml/Y9ES4UKl%2F+DtvAVS@gmail.com/T/]

> Increase the allowed line-length of the insn-decoder-test to 4k to allow
> for symbol-names longer than 256 characters.
> 
> The insn-decoder-test takes objdump output as input, which may contain
> symbol-names as instruction arguments. With rust-code entering the
> kernel, those symbol-names will include mangled-symbols which might
> exceed the current line-length-limit of the tool.
> 
> By bumping the line-length-limit of the tool to 4k, we get a reasonable
> buffer for all objdump outputs I have seen so far. Unfortunately, ELF
> symbol-names are not restricted in length, so technically this might
> still end up failing if we encounter longer names in the future.
> 
> My compile-failure looks like this:
> 
>     arch/x86/tools/insn_decoder_test: error: malformed line 1152000:
>     tBb_+0xf2>
> 
> ..which overflowed by 10 characters reading this line:
> 
>     ffffffff81458193:   74 3d                   je     ffffffff814581d2 <_RNvXse_NtNtNtCshGpAVYOtgW1_4core4iter8adapters7flattenINtB5_13FlattenCompatINtNtB7_3map3MapNtNtNtBb_3str4iter5CharsNtB1v_17CharEscapeDefaultENtNtBb_4char13EscapeDefaultENtNtBb_3fmt5Debug3fmtBb_+0xf2>

in Fedora:

  https://bugzilla.redhat.com/show_bug.cgi?id=2329496

I notice that BUFSIZE is still set to 256.  Setting it to 512 fixed
the problem for me, although I understand that this is just a hack.

Was there any further effort to get this patch upstream?

Unfortunately I don't know what exact symbol is overflowing in the
Fedora case, but we do have a very full-featured kernel, including
Rust enabled (if that is relevant).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-12-24 15:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 11:04 [PATCH] x86/insn_decoder_test: allow longer symbol-names David Rheinsberg
2023-01-25 11:30 ` Ingo Molnar
2023-01-27 10:27   ` David Rheinsberg
2024-02-20 17:07     ` Miguel Ojeda
2024-04-08 12:51       ` Danilo Krummrich
2024-04-08 15:22         ` Sergio González Collado
2024-04-08 15:30           ` Sergio González Collado
  -- strict thread matches above, loose matches on Subject: below --
2024-11-29 15:40 Richard W.M. Jones
2024-12-24 15:24 ` Andrew Halaney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox