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]
Message-ID: <CAHk-=wiDDkik_ZnQsHJjZUNzH+XZvwPN-8ddW-0XOpF-sXcV2Q@mail.gmail.com>
Date:   Thu, 19 Oct 2023 10:08:59 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Uros Bizjak <ubizjak@...il.com>
Cc:     Nadav Amit <namit@...are.com>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andy Lutomirski <luto@...nel.org>,
        Brian Gerst <brgerst@...il.com>,
        Denys Vlasenko <dvlasenk@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()

On Thu, 19 Oct 2023 at 09:32, Uros Bizjak <ubizjak@...il.com> wrote:
>
> Perhaps you will be interested in chapter 6.47.2.1, "Volatile" of GCC
> manual that says:
>
> " Under certain circumstances, GCC may duplicate (or remove duplicates
> of) your assembly code when optimizing."
>
> The compiler may re-materialize non-volatile asm in the same way it
> may re-materialize arguments from non-volatile memory. To avoid this,
> volatile asm is necessary when unstable memory arguments are accessed
> using this_* variants.

That's disgusting. The whole (and only) point of rematerialization is
as an optimization. When gcc doesn't know how expensive an inline asm
is (and they can be very expensive indeed), doing remat on it would be
an obvious mistake.

I think what you say is "we're technically allowed to do it, but we'd
be crazy to *actually* do it".

The kernel does require a sane compiler. We will turn off options that
make it do insane things - even when said insane things are allowed by
a bad standard.

Do you actually have gcc code that rematerializes an inline asm?

                   Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ