lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 10 Oct 2020 12:54:21 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Joe Perches <joe@...ches.com>
Cc:     X86 ML <x86@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
        Andy Whitcroft <apw@...onical.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes
 documentation on x86

On Fri, Oct 09, 2020 at 11:01:18AM -0700, Joe Perches wrote:
> Given the location, this only works on .c and .h files.
> It does not work on .S files.  Should it?

Probably not because there will be too many false positives. .byte is
used not only to spell instruction opcodes in .S files. And the main
case we're addressing here is using those .byte spelled opcodes in asm
volatile constructs so...

> No need for a capture group.

Debugging leftover, gone now.

> Please use @ not " as all the other $realfile comparisons
> use that form when expecting a /

Done.

> So it looks like the regex would be more complete as:
> 
> 	if ($realfile =~ m@...ch/x86/@ &&
> 	    $rawline =~ /\.byte\s+(?:$Constant|(?:\\)?$Ident|"\s*$Ident)\b/) {

This is much less readable than what I have now (yes, realfile test
should come first):

	if ($realfile =~ m@...ch/x86/@ && $rawline =~ /\.byte[\s0-9a-fx,]+/) {

Also, this

	$rawline =~ /\.byte\s+(?:$Constant|(?:\\)?$Ident|"\s*$Ident)\b/) {

matches

	".byte 0x66"

This

	$rawline =~ /\.byte[\s0-9a-fx,]+)) {

matches

	".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"

which is what it needs to match.

> A patch can modify any number of files.
> 
> This should use ctx_locate_comment($file ? 0 : $first_line, $linenr)
> as checkpatch tests work on patch contexts not the entire
> file before this line.

Done.

> No need for the $!comment test

Done.

> checkpatch uses only a single line output only before $herecurr
> Output line length doesn't matter.

Well, this:

WARNING: Please document which binutils version supports these .byte-spelled
        insn opcodes by adding "binutils version <num>" in a comment above them.
#90: FILE: arch/x86/include/asm/special_insns.h:254:
+       asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"


is easier readable than this:

WARNING: Please document which binutils version supports these .byte-spelledinsn opcodes by adding "binutils version <num>" in a comment above them.
#90: FILE: arch/x86/include/asm/special_insns.h:254:
+       asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"

Thx.

-- 
Regards/Gruss,
    Boris.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ