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]
Message-Id: <c28486a2-dc12-4613-abda-bdeace783d40@app.fastmail.com>
Date:   Tue, 18 Apr 2023 14:28:55 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Marco Elver" <elver@...gle.com>,
        "Nathan Chancellor" <nathan@...nel.org>
Cc:     "Arnd Bergmann" <arnd@...nel.org>,
        "Andrey Ryabinin" <ryabinin.a.a@...il.com>,
        "Masahiro Yamada" <masahiroy@...nel.org>,
        "Nick Desaulniers" <ndesaulniers@...gle.com>,
        "Nicolas Schier" <nicolas@...sle.eu>,
        "Alexander Potapenko" <glider@...gle.com>,
        "Andrey Konovalov" <andreyknvl@...il.com>,
        "Dmitry Vyukov" <dvyukov@...gle.com>,
        "Vincenzo Frascino" <vincenzo.frascino@....com>,
        "Tom Rix" <trix@...hat.com>,
        "Andrew Morton" <akpm@...ux-foundation.org>,
        "Michael Ellerman" <mpe@...erman.id.au>,
        "Peter Zijlstra" <peterz@...radead.org>,
        linux-kbuild@...r.kernel.org, kasan-dev@...glegroups.com,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] kasan: remove hwasan-kernel-mem-intrinsic-prefix=1 for clang-14

On Tue, Apr 18, 2023, at 14:06, Marco Elver wrote:
> On Fri, 14 Apr 2023 at 18:26, Nathan Chancellor <nathan@...nel.org> wrote:
>> On Fri, Apr 14, 2023 at 10:29:27AM +0200, Arnd Bergmann wrote:
> It errors as expected. But with:
>
>> clang -Werror -mllvm -hwasan-does-not-exist -c -x c /dev/null -o /dev/null
>
> It ends up printing _help_ text, because anything "-h..." (if it
> doesn't recognize it as a long-form argument), will make it produce
> the help text.

Ah, that explains a lot. I think I actually tried a few other options, but
probably only edited part of the option name, and not the beginning, so
I always saw the help text.

>> >  # Instrument memcpy/memset/memmove calls by using instrumented __hwasan_mem*().
>> > +ifeq ($(call clang-min-version, 150000),y)
>> >  CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1)
>> > +endif
>> > +ifeq ($(call gcc-min-version, 130000),y)
>> > +CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1)
>> > +endif
>>
>> I do not think you need to duplicate this block, I think
>>
>>   ifeq ($(call clang-min-version, 150000)$(call gcc-min-version, 130000),y)
>>   CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1)
>>   endif
>
> We just need the clang version check. If the compiler is gcc, it'll do
> the "right thing" (i.e. not print help text). So at a minimum, we need
> if "clang version >= 15 or gcc". Checking if gcc is 13 or later
> doesn't hurt though, so I don't mind either way.

I've sent a v2 now, with an updated help text and the simplified
version check.

It might be possible to change the cc-option check in a way that
parses the output, this variant should do that, if we care:

echo "char *str = \"check that assembler works\";" | clang -Werror -mllvm -hwasan-does-not-exist  -S -x c - -o - | grep -q "check that assembler works"

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ