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] [day] [month] [year] [list]
Date:   Mon, 12 Aug 2019 12:41:21 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Joe Perches <joe@...ches.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Sedat Dilek <sedat.dilek@...il.com>,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: checkpatch.pl should suggest __section

On Mon, Aug 12, 2019 at 11:27 AM Joe Perches <joe@...ches.com> wrote:
>
> On Mon, 2019-08-12 at 11:20 -0700, Nick Desaulniers wrote:
> > On Fri, Aug 9, 2019 at 4:17 PM Joe Perches <joe@...ches.com> wrote:
> > > On Fri, 2019-08-09 at 16:04 -0700, Nick Desaulniers wrote:
> > > > > how about:
> > > > > ---
> > > > >  scripts/checkpatch.pl | 9 +++++++++
> > > > >  1 file changed, 9 insertions(+)
> > > > >
> > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > > index 1cdacb4fd207..8e6693ca772c 100755
> > > > > --- a/scripts/checkpatch.pl
> > > > > +++ b/scripts/checkpatch.pl
> > > > > @@ -5901,6 +5901,15 @@ sub process {
> > > > >                              "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
> > > > >                 }
> > > > >
> > > > > +# Check for __attribute__ section, prefer __section (without quotes)
> > > > > +               if ($realfile !~ m@\binclude/uapi/@ &&
> > > > > +                   $line =~ /\b__attribute__\s*\(\s*\(.*_*section_*\s*\(\s*("[^"]*")/) {
> > > > > +                       my $old = substr($rawline, $-[1], $+[1] - $-[1]);
> > > > > +                       my $new = substr($old, 1, -1);
> > > > > +                       WARN("PREFER_SECTION",
> > > > > +                            "__section($new) is preferred over __attribute__((section($old)))\n" . $herecurr);
> > > > > +               }
> > > > > +
> > > >
> > > > I can't read Perl, but this looks pretty good.
> > > > Acked-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > >
> > > I'll add a Suggested-by: for you.
> > >
> > > But a Tested-by would be more valuable than an Acked-by if you
> > > don't actually know how it works.
> >
> > $ git am joes.patch
> > $ echo "int foo __attribute__((section(.hello)));" >> arch/x86/boot/a20.c
>
> Does this compile?
>
> checkpatch is not a compiler.
>
> I think you need
>
> __attribute__((section(".hello")))

PEBKAC
➜  kernel-all git:(section_escaping) ✗ ./scripts/checkpatch.pl
0001-x86-boot-hello.patch
WARNING: __section(.hello) is preferred over __attribute__((section(".hello")))
#20: FILE: arch/x86/boot/a20.c:164:
+int foo __attribute__((section(".hello")));

total: 0 errors, 1 warnings, 4 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

0001-x86-boot-hello.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Tested-by: Nick Desaulniers <ndesaulniers@...gle.com>
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ