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]
Date:   Thu, 12 Oct 2023 09:56:27 -0700
From:   Linus Torvalds <>
To:     Uros Bizjak <>
Cc:     Nadav Amit <>,
        "the arch/x86 maintainers" <>,
        Linux Kernel Mailing List <>,
        Andy Lutomirski <>,
        Brian Gerst <>,
        Denys Vlasenko <>,
        "H . Peter Anvin" <>,
        Peter Zijlstra <>,
        Thomas Gleixner <>,
        Josh Poimboeuf <>,
        Nick Desaulniers <>
Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()

On Thu, 12 Oct 2023 at 09:33, Uros Bizjak <> wrote:
> For some reason existing percpu_stable_op asm uses %P operand
> modifier. This will drop all syntax-specific prefixes and issue the
> bare constant. It will also remove the (%rip) suffix. What we want
> here is a generic %a modifier (See Generic Operand Modifiers
> [1]) that will substitute a memory reference, with the actual operand
> treated as the address. In combination with "p" constraint will DTRT
> and will emit symbol with the (%rip) suffix when available, also when
> -fpie is in effect.

Well, I have to admit that I think the main reason we used "p" as a
constraint was simply that we knew about it, and I don't think I've
ever even realized "a" existed.

In fact, we historically didn't use a lot of operand modifiers, and
the only common ones (at least for x86) tend to be the "register size"
modifiers (b/w/q)

I just did

    git grep 'asm.*[^%]%[a-z][0-9]' arch/x86

and while that will only catch one-liner inline asm cases, all it
finds is indeed just the size ones.

A slightly smarter grep finds a couple of uses of '%c' for bare constants.

So I think the "we used P for percpu_stable_op" is really mostly a "we
are not actually very familiar with the operand modifiers".  We use
the constraints fairly wildly, but the operand modifiers are a
relative rarity.

I suspect - but it's much too long ago - that some gcc person just
told us that "solve this using 'P'" and we never went any further.

So changing it to use 'a' sounds like the right thing to do, and we
can only plead ignorance, not wilful stupidity.


Powered by blists - more mailing lists