Re: [PATCH v2] x86/hyperv: Use __naked attribute to fix stackless C function

From: Andrew Cooper

Date: Sat Feb 28 2026 - 15:02:45 EST


On 28/02/2026 5:34 pm, Uros Bizjak wrote:
> On Sat, Feb 28, 2026 at 5:41 PM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>> So I don't see any reason for volatile on hv_msr(). However, I do see a potential issue with the compiler assuming that code after the final asm() block is reachable, and calling unreachable() is not permitted [by Clang] due to the __naked attribute.
> As far as the compiler is concerned, there is "nothing" after the last
> asm() block. It can be marked with noreturn attribute, but I don't
> know how it interacts with the naked attribute.

You can't use __builtin_unreachable() in a naked function.  I was going
to suggest it against v1, but alas.

~Andrew