All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Zeter <samuelzeter@gmail.com>
Cc: samuelzeter@gmail.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 1/2] arch/x86/tools/objdump_reformat.awk: Ensure regex matches fwait
Date: Thu,  6 Jan 2022 13:36:04 +1100	[thread overview]
Message-ID: <20220106023606.283953-2-samuelzeter@gmail.com> (raw)
In-Reply-To: <20220106023606.283953-1-samuelzeter@gmail.com>

If there is "wait" mnemonic in the line being parsed, it is incorrectly
handled by the script, and an extra line of "fwait" in
objdump_reformat's output is inserted. As insn_decoder_test relies
upon the formatted output, the test fails.

This is reproducible when disassembling with llvm-objdump:

Pre-processed lines:
ffffffff81033e72: 9b                    wait
ffffffff81033e73: 48 c7 c7 89 50 42 82  movq

After objdump_reformat.awk:
ffffffff81033e72:       9b      fwait
ffffffff81033e72:                               wait
ffffffff81033e73:       48 c7 c7 89 50 42 82    movq

This patch fixes the issue by requiring spaces, or tabs, along with the
"fwait" instruction in the regex match.

Signed-off-by: Samuel Zeter <samuelzeter@gmail.com>
---
 arch/x86/tools/objdump_reformat.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/tools/objdump_reformat.awk b/arch/x86/tools/objdump_reformat.awk
index f418c91b71f0..276e572a6f60 100644
--- a/arch/x86/tools/objdump_reformat.awk
+++ b/arch/x86/tools/objdump_reformat.awk
@@ -12,7 +12,7 @@ BEGIN {
 	prev_hex = ""
 	prev_mnemonic = ""
 	bad_expr = "(\\(bad\\)|^rex|^.byte|^rep(z|nz)$|^lock$|^es$|^cs$|^ss$|^ds$|^fs$|^gs$|^data(16|32)$|^addr(16|32|64))"
-	fwait_expr = "^9b "
+	fwait_expr = "^9b[ \t]*fwait"
 	fwait_str="9b\tfwait"
 }
 
-- 
2.32.0


WARNING: multiple messages have this Message-ID (diff)
From: Samuel Zeter <samuelzeter@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: samuelzeter@gmail.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 1/2] arch/x86/tools/objdump_reformat.awk: Ensure regex matches fwait
Date: Thu,  6 Jan 2022 13:36:04 +1100	[thread overview]
Message-ID: <20220106023606.283953-2-samuelzeter@gmail.com> (raw)
In-Reply-To: <20220106023606.283953-1-samuelzeter@gmail.com>

If there is "wait" mnemonic in the line being parsed, it is incorrectly
handled by the script, and an extra line of "fwait" in
objdump_reformat's output is inserted. As insn_decoder_test relies
upon the formatted output, the test fails.

This is reproducible when disassembling with llvm-objdump:

Pre-processed lines:
ffffffff81033e72: 9b                    wait
ffffffff81033e73: 48 c7 c7 89 50 42 82  movq

After objdump_reformat.awk:
ffffffff81033e72:       9b      fwait
ffffffff81033e72:                               wait
ffffffff81033e73:       48 c7 c7 89 50 42 82    movq

This patch fixes the issue by requiring spaces, or tabs, along with the
"fwait" instruction in the regex match.

Signed-off-by: Samuel Zeter <samuelzeter@gmail.com>
---
 arch/x86/tools/objdump_reformat.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/tools/objdump_reformat.awk b/arch/x86/tools/objdump_reformat.awk
index f418c91b71f0..276e572a6f60 100644
--- a/arch/x86/tools/objdump_reformat.awk
+++ b/arch/x86/tools/objdump_reformat.awk
@@ -12,7 +12,7 @@ BEGIN {
 	prev_hex = ""
 	prev_mnemonic = ""
 	bad_expr = "(\\(bad\\)|^rex|^.byte|^rep(z|nz)$|^lock$|^es$|^cs$|^ss$|^ds$|^fs$|^gs$|^data(16|32)$|^addr(16|32|64))"
-	fwait_expr = "^9b "
+	fwait_expr = "^9b[ \t]*fwait"
 	fwait_str="9b\tfwait"
 }
 
-- 
2.32.0


  reply	other threads:[~2022-01-06  2:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  2:36 [PATCH 0/2] *** Fix reformat_objdump.awk *** Samuel Zeter
2022-01-06  2:36 ` Samuel Zeter
2022-01-06  2:36 ` Samuel Zeter [this message]
2022-01-06  2:36   ` [PATCH 1/2] arch/x86/tools/objdump_reformat.awk: Ensure regex matches fwait Samuel Zeter
2022-01-06  2:36 ` [PATCH 2/2] arch/x86/tools/objdump_reformat.awk: Allow for spaces Samuel Zeter
2022-01-06  2:36   ` Samuel Zeter
2022-01-06 19:02 ` [PATCH 0/2] *** Fix reformat_objdump.awk *** Nathan Chancellor
2022-01-06 23:23   ` Samuel Zeter
2022-01-07  0:16     ` Nathan Chancellor
2022-03-04  3:16       ` [PATCH v2 " Sam Zeter
2022-03-04  3:16         ` [PATCH v2 1/2] arch/x86/tools/objdump_reformat.awk: Ensure regex matches fwait Sam Zeter
2022-03-04  3:16         ` [PATCH v2 2/2] arch/x86/tools/objdump_reformat.awk: Allow for spaces Sam Zeter
2022-03-04 17:20         ` [PATCH v2 0/2] *** Fix reformat_objdump.awk *** Nathan Chancellor
2022-01-07 11:52   ` [PATCH " Masami Hiramatsu

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=20220106023606.283953-2-samuelzeter@gmail.com \
    --to=samuelzeter@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.