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-=wgycD7=dtGwHEBi8dVyv3Fy2yWzv_bGe9zY0QwTn2BWTA@mail.gmail.com>
Date:   Sun, 1 Oct 2023 13:30:05 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Uros Bizjak <ubizjak@...il.com>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org,
        Andy Lutomirski <luto@...nel.org>,
        Ingo Molnar <mingo@...nel.org>, Nadav Amit <namit@...are.com>,
        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>,
        Borislav Petkov <bp@...en8.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [RFC PATCH 0/4] x86/percpu: Use segment qualifiers

On Sun, 1 Oct 2023 at 13:21, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Sun, 1 Oct 2023 at 12:53, Uros Bizjak <ubizjak@...il.com> wrote:
> >
> > Regarding x86 target specific code, the same functionality used for
> > explicit address space is used internally to handle __thread
> > qualifier.
>
> Ok, that's interesting, in that __thread is certainly widely used so
> it will have seen testing.

.. but I just checked that the __thread case *does* work with my
stupid test-case, so clearly the "__thread" coverage ends up being
very different from something like __seg_fs.

The difference? For __thread, gcc and clang know how to get the
beginning of the thread area (the equivalent of our kernel
this_cpu_ptr() macro), so now the compiler knows how to turn a
__thread pointer into a "normal" pointer, and can just do memcpy.

But for __seg_fs and __seg_gs, the compiler doesn't know how to do
that, and then ends up just flailing wildly.

If the structure is small enough to be done as individual moves, both
gcc and clang do ok. But anything else is just a complete shit-show.

If they both errored out reliably and legibly, that would be one
thing. But gcc just silently generates garbage, and clang errors out
with 60+ lines of internal compiler backtrace.

             Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ