From: Joe Perches <joe@perches.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>,
Andy Whitcroft <apw@canonical.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
linux-kernel@vger.kernel.org,
kernel-janitors <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/1] checkpatch: recognise NOKPROBE_SYMBOL for blank line detection after function/struct/union/enum
Date: Fri, 20 Jan 2023 08:10:52 -0800 [thread overview]
Message-ID: <e092f27243feeeec282ef8fdab57d8f9ee88a32d.camel@perches.com> (raw)
In-Reply-To: <20230120114649.117018-1-borntraeger@linux.ibm.com>
On Fri, 2023-01-20 at 12:46 +0100, Christian Borntraeger wrote:
> NOKPROBE_SYMBOL should be treated like EXPORT_SYMBOL to avoid
> false positives.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3995,6 +3995,7 @@ sub process {
> $line =~ /^\+/ &&
> !($line =~ /^\+\s*$/ ||
> $line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param)/ ||
> + $line =~ /^\+\s*NOKPROBE_SYMBOL/ ||
> $line =~ /^\+\s*MODULE_/i ||
> $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
> $line =~ /^\+[a-z_]*init/ ||
$ git grep -P -w -oh '\w*NOKPROBE_SYMBOL\w*' | sort | uniq -c
60 _ASM_NOKPROBE_SYMBOL
2 __NOKPROBE_SYMBOL
304 NOKPROBE_SYMBOL
Any issue with these other variants? (it doesn't seem so)
btw: __NOKPROBE_SYMBOL has a ; at the end of its definition.
include/asm-generic/kprobes.h:# define __NOKPROBE_SYMBOL(fname) \
include/asm-generic/kprobes.h-static unsigned long __used \
include/asm-generic/kprobes.h- __section("_kprobe_blacklist") \
include/asm-generic/kprobes.h- _kbl_addr_##fname = (unsigned long)fname;
And so there are extra ; uses after ever use of NOKPROBE_SYMBOL(foo);
$ git grep -w NOKPROBE_SYMBOL | grep ';' | wc -l
285
There are only 10 uses of NOKPROBE_SYMBOL(foo) without a semicolon
$ git grep -P '\bNOKPROBE_SYMBOL\s*\(\s*\w+\s*\)\s*(?:[^\;]|$)'
arch/arm/kernel/traps.c:NOKPROBE_SYMBOL(do_undefinstr)
arch/arm/probes/kprobes/opt-arm.c:NOKPROBE_SYMBOL(optimized_callback)
arch/arm64/kernel/kgdb.c:NOKPROBE_SYMBOL(kgdb_brk_fn)
arch/powerpc/mm/cacheflush.c:NOKPROBE_SYMBOL(flush_dcache_icache_phys)
arch/powerpc/platforms/82xx/pq2.c:NOKPROBE_SYMBOL(pq2_restart)
include/asm-generic/kprobes.h:# define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
include/asm-generic/kprobes.h:# define NOKPROBE_SYMBOL(fname)
kernel/fail_function.c:NOKPROBE_SYMBOL(fei_kprobe_handler)
kernel/kprobes.c:NOKPROBE_SYMBOL(__kretprobe_trampoline_handler)
kernel/trace/trace_eprobe.c:NOKPROBE_SYMBOL(process_fetch_insn)
kernel/trace/trace_kprobe.c:NOKPROBE_SYMBOL(process_fetch_insn)
kernel/trace/trace_uprobe.c:NOKPROBE_SYMBOL(process_fetch_insn)
The actual uses with NOKPROBE_SYMBOL(foo) should likely have semicolons added
and the __NOKPROBE_SYMBOL definition should have the semicolon removed.
next prev parent reply other threads:[~2023-01-20 16:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 11:46 Christian Borntraeger
2023-01-20 16:10 ` Joe Perches [this message]
2023-01-24 12:16 ` Christian Borntraeger
2023-08-18 14:36 ` Heiko Carstens
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=e092f27243feeeec282ef8fdab57d8f9ee88a32d.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=borntraeger@linux.ibm.com \
--cc=dwaipayanray1@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®