From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BE092F83AE for ; Sat, 28 Feb 2026 16:37:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772296649; cv=none; b=Nv6n5WTuUaGWnG6xiIMrLzNtj5acjKrP00ZZqOLe1MLbLJqSBdmRfKncPK57ZPZbuV+9ySS2BUs/7eNvlnylSwxk/BLYM9YYOmFADwk0/7ipRJRonslNXl9qEgolYgtF449AaapK1JhLWflYaqlOcks9UpillQCpdRQO7qmxoIU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772296649; c=relaxed/simple; bh=pTmiIW1/CUNAQAC760N/p+JDf8FmonEhErCxgRbvBoY=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=I0D5AcyoVhgL8l1FzBOPIFPQQgIIiiKTxN6EapANkFQeaXWJUGCp+M9p0IjWLuQ4CWtKL4SJ8s0ELAEsA9vnNsOkicJIZDsC5wQiGqMhftXF8GWUGWaJWb4JzEnOqMzfMxITrCTkPLTlCM5An2bUmAu6WmM12BUZVrTWnKCdCQ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BB32jaYS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BB32jaYS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FF3BC116D0; Sat, 28 Feb 2026 16:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772296648; bh=pTmiIW1/CUNAQAC760N/p+JDf8FmonEhErCxgRbvBoY=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=BB32jaYSh5CO6mMATePA3Rtl/whOTwvye+bKZwUoKwKV6iptgOgCXGH1Ye3Ogy3oQ AB4xFNr9uxchMWUcDlaU3Pg5qVj3eApat1jbBO5P4DyqIW+vuRImfo0IfOClADu13I jQ3dYaIKbrsdpYuj23BihvjadG6q7YkW7HfeKMSC1gVPUQQDz5+g5Q5sHY+yoHIcsK 3MeAxoNGeVDsyCJkRFGTbTRG/KvWoBkb3X0WDxJHryTSlxCVCHZzrEYpnHlD3dDI6s IEWw2MJ8Zs2EcuhiFkn7VgdmDc8ggSrSWySCLbDetx3C2VslQHKt5rNMczH8choFHm 6ZjpiSA8v4lXQ== Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfauth.phl.internal (Postfix) with ESMTP id 495B2F40084; Sat, 28 Feb 2026 11:37:27 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-01.internal (MEProxy); Sat, 28 Feb 2026 11:37:27 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvhedvfeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedftehrugcu uehivghshhgvuhhvvghlfdcuoegrrhgusgeskhgvrhhnvghlrdhorhhgqeenucggtffrrg htthgvrhhnpeeuteeiudeigeekjedvheduieehteetgfdtuefghfejgffhfedtleehvdeh fffhvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhguodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduieejtdehtddtjeel qdeffedvudeigeduhedqrghruggspeepkhgvrhhnvghlrdhorhhgseifohhrkhhofhgrrh gurdgtohhmpdhnsggprhgtphhtthhopeejpdhmohguvgepshhmthhpohhuthdprhgtphht thhopegrnhgurhgvfidrtghoohhpvghrfeestghithhrihigrdgtohhmpdhrtghpthhtoh epuhgsihiijhgrkhesghhmrghilhdrtghomhdprhgtphhtthhopeifvghirdhlihhusehk vghrnhgvlhdrohhrghdprhgtphhtthhopeigkeeisehkvghrnhgvlhdrohhrghdprhgtph htthhopehmrhgrthhhohhrsehlihhnuhigrdhmihgtrhhoshhofhhtrdgtohhmpdhrtghp thhtoheplhhinhhugidqhhihphgvrhhvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: ice86485a:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 2758A700065; Sat, 28 Feb 2026 11:37:27 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ThreadId: A_ejbntDxbYw Date: Sat, 28 Feb 2026 17:37:06 +0100 From: "Ard Biesheuvel" To: "Uros Bizjak" Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "Mukesh Rathor" , "Wei Liu" , "Andrew Cooper" , linux-hyperv@vger.kernel.org Message-Id: In-Reply-To: References: <20260227224030.299993-2-ardb@kernel.org> Subject: Re: [PATCH v2] x86/hyperv: Use __naked attribute to fix stackless C function Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, 28 Feb 2026, at 10:38, Uros Bizjak wrote: > On Fri, Feb 27, 2026 at 11:40=E2=80=AFPM Ard Biesheuvel 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 runnin= g in 64-bit mode, so whether or not the RSP update occurs immediately af= ter is irrelevant.