[PATCH v2] ARM: fix Thumb2 regression with Spectre BHB

Linus Torvalds torvalds at linux-foundation.org
Fri Mar 11 12:41:22 PST 2022


On Fri, Mar 11, 2022 at 11:59 AM Russell King (Oracle)
<linux at armlinux.org.uk> wrote:
>
> I don't like them, but in a macro, I don't think there's much choice.
> I don't think choosing some other starting number works either, because
> then one ends up always starting at some other number and it's just the
> same problem, just with a different starting number.

In some x86 code, people use labels like "99:" etc because they simply
stand out more visually.

Also, you can simply use *real* label names in macros, and just append
'\@' to them (which is basically a macro counter value).

IOW, I think that loop could have been written as

  bhbloop_\@:
        b       . + 4
        subs    r0, r0, #1
        bne     bhbloop_\@

and it should work, and also be more legible than using a random small integer.

> I've already mentioned to Nathan that I really wish gas etc would
> allow local labels which are not purely numerical (so we can make
> them more descriptive.) However, I can see why it isn't permitted,
> because of the 'b' and 'f' suffix.

Yeah, I don't think we can get away from numerical names for these
local (repeated) uses in inline asms at least.

But I do think that making them a bit more unique by using bigger
numbers can be at least a visual clue.

And in actual assembler macros, maybe that "use a named variable with
\@" approach would be something we can move towards?

              Linue



More information about the linux-arm-kernel mailing list