From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Uros Bizjak" <ubizjak@gmail.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
"Mukesh Rathor" <mrathor@linux.microsoft.com>,
"Wei Liu" <wei.liu@kernel.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2] x86/hyperv: Use __naked attribute to fix stackless C function
Date: Sat, 28 Feb 2026 17:37:06 +0100 [thread overview]
Message-ID: <a80879c4-10d4-41a7-8043-290b92a0d9fc@app.fastmail.com> (raw)
In-Reply-To: <CAFULd4ZYiSWciqo94yaLvB43z_+jqgXa2gy8DOEQQp1W8yFF0w@mail.gmail.com>
On Sat, 28 Feb 2026, at 10:38, Uros Bizjak wrote:
> On Fri, Feb 27, 2026 at 11:40 PM Ard Biesheuvel <ardb@kernel.org> wrote:
...
>> - asm volatile("movw %%ax, %%ss" : : "a"(ctxt->ss));
>> - asm volatile("movq %0, %%rsp" : : "m"(ctxt->rsp));
>> + asm volatile("movw %0, %%ss" : : "m"(hv_crash_ctxt.ss));
>> + asm volatile("movq %0, %%rsp" : : "m"(hv_crash_ctxt.rsp));
>
> Maybe this part should be written together as:
>
> asm volatile("movw %0, %%ss\n\t"
> "movq %1, %%rsp"
> :: "m"(hv_crash_ctxt.ss), "m"(hv_crash_ctxt,rsp));
>
> This way, the stack register update is guaranteed to execute in the
> stack segment shadow. Otherwise, the compiler is free to insert some
> unrelated instruction in between. It probably won't happen in practice
> in this case, but the compiler can be quite creative with moving asm
> arguments around.
>
It also doesn't matter: setting the SS segment is not needed when running in 64-bit mode, so whether or not the RSP update occurs immediately after is irrelevant.
next prev parent reply other threads:[~2026-02-28 16:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 22:40 Ard Biesheuvel
2026-02-27 23:03 ` Mukesh R
2026-02-28 3:36 ` Mukesh R
2026-02-27 23:07 ` Andrew Cooper
2026-02-28 6:46 ` Uros Bizjak
2026-02-28 9:38 ` Uros Bizjak
2026-02-28 16:37 ` Ard Biesheuvel [this message]
2026-02-28 17:15 ` Uros Bizjak
2026-02-28 10:17 ` Uros Bizjak
2026-02-28 16:40 ` Ard Biesheuvel
2026-02-28 17:34 ` Uros Bizjak
2026-02-28 17:38 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a80879c4-10d4-41a7-8043-290b92a0d9fc@app.fastmail.com \
--to=ardb@kernel.org \
--cc=andrew.cooper3@citrix.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mrathor@linux.microsoft.com \
--cc=ubizjak@gmail.com \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®