lkml.org 
[lkml]   [2020]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -v2] checkpatch: Check for .byte-spelled insn opcodes documentation on x86
--
From: Borislav Petkov <bp@suse.de>

Instruction opcode bytes spelled using the gas directive .byte should
carry a comment above them stating which binutils version has added
support for the instruction mnemonic so that they can be replaced with
the mnemonic when that binutils version is equal or less than the
minimum-supported version by the kernel.

Add a check for that.

Requested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
scripts/checkpatch.pl | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 504d2e431c60..d9065ef5d4fe 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6858,6 +6858,20 @@ sub process {
WARN("DUPLICATED_SYSCTL_CONST",
"duplicated sysctl range checking value '$1', consider using the shared one in include/linux/sysctl.h\n" . $herecurr);
}
+
+# document which binutils version supports the actual insn mnemonic so that the naked opcode bytes can be replaced.
+# x86-only.
+ if ($realfile =~ m@^arch/x86/@ &&
+ $rawline =~ /\.byte[\s0-9a-fx,]+/) {
+
+ my $comment = ctx_locate_comment($file ? 0 : $first_line, $linenr);
+ if ($comment !~ /binutils version [0-9.]+/ms) {
+ WARN("MISSING_BINUTILS_VERSION",
+ "Please document which binutils version supports these .byte-spelled\n" .
+ "\tinsn opcodes by adding \"binutils version <num>\" in a comment" .
+ " above them.\n" . $herecurr);
+ }
+ }
}

# If we have no input at all, then there is nothing to report on
--
2.21.0

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2020-10-11 01:08    [W:0.070 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site