[PATCH 7/8] ARM: Add hwcap for Speculation Barrier(SB)

Amit Daniel Kachhap amit.kachhap at arm.com
Thu Nov 17 02:19:59 PST 2022



On 11/16/22 19:36, Linus Walleij wrote:
> On Wed, Oct 26, 2022 at 7:53 AM Amit Daniel Kachhap
> <amit.kachhap at arm.com> wrote:
> 
>> Speculation Barrier(FEAT_SB) is a feature present in AArch32 state for
>> Armv8 and is represented by ISAR6.SB identification register.
>>
>> This feature denotes the presence of SB instruction and hence adding a
>> hwcap will enable the userspace to check it before trying to use this
>> instruction.
>>
>> This commit adds the ID feature bit detection, and uses elf_hwcap2
>> accordingly.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.kachhap at arm.com>
> 
> The patch is fine, the following is a question.
> 
> I see that the aarch64 kernel is using this instruction in the kernel
> for speculation barriers, and after this the aarch32 userspace can
> use it too.
> 
> Does it make sense to ask the question whether this could be
> compiled into and used by a aarch32 kernel, provided it is
> configured for a core known to support it? (This is assuming that
> the compiler also knows about it.)

I think you have a valid point to use sb in the kernel also. Besides the
compiler support, aarch32 kernel might need feature based dynamic
instruction patching framework like aarch64. So as you said it is too
much to do here.

Thanks,
Amit Daniel
> 
> I'm asking because speculation barriers is something we have a
> lot of due to the constant security problems so it might be something
> handy to have in the toolbox.
> 
> It might be just adding too much complexity... I know.
> 
> Yours,
> Linus Walleij



More information about the linux-arm-kernel mailing list