Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB1A7E9DE65 for ; Thu, 9 Apr 2026 08:13:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1276811.1562118 (Exim 4.92) (envelope-from ) id 1wAkWD-00015K-Nj; Thu, 09 Apr 2026 08:13:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1276811.1562118; Thu, 09 Apr 2026 08:13:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wAkWD-00015B-L0; Thu, 09 Apr 2026 08:13:41 +0000 Received: by outflank-mailman (input) for mailman id 1276811; Thu, 09 Apr 2026 08:13:40 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wAkWC-00014z-F9 for xen-devel@lists.xenproject.org; Thu, 09 Apr 2026 08:13:40 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wAkWB-007qqT-Qn for xen-devel@lists.xenproject.org; Thu, 09 Apr 2026 10:13:39 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69d75fa5-e002-0a2a0a5209dd-0a2a450ab8c8-42 for ; Thu, 09 Apr 2026 10:13:39 +0200 Received: from [209.85.128.53] (helo=mail-wm1-f53.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69d75fb3-ee98-0a2a450a0019-d1558035cd80-3 for ; Thu, 09 Apr 2026 10:13:39 +0200 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-48896199cbaso5919695e9.1 for ; Thu, 09 Apr 2026 01:13:39 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488cf8612cfsm36737435e9.0.2026.04.09.01.13.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2026 01:13:38 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775722419; x=1776327219; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=1zMaVsJ4Hj1ZbtlXWmCHXeHvDSKfKckbsVZ1TE2y4TY=; b=fCJec9o0bT35mQaKNwF3hcQ+SU+zF0txbWOo9IiujJfvj72LvxTC9R5ZfpR9GV7Afb GkibDjG5uis0K6vdEkQinChfjwefHzNsbuwfYDqJaa3gFlaKyyqE6wF+oDOZXlCOP0LN m4z5BNSkPfNJkopyhc1wk0o8yxKfB25jUM66aS6/2+mFekX/sCCdpl7QbCYRukml5JwA bAzA7gnd8q2/aMHv7JOTvM3f4VFTJBDCEuVF2Y6B6b7eiBUEhSrITb8VEJIedtbbKYEp tx7gGmm/oSYX1q5P14N7qJ0izGRnztWdjZqrI3ZS9SCqQaPngBV4ZyrB3rwF8VIUjEGV 4fHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775722419; x=1776327219; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1zMaVsJ4Hj1ZbtlXWmCHXeHvDSKfKckbsVZ1TE2y4TY=; b=R/GvDwkFdEiezi6NWBoZHi9uDrg/gVgzQ4YNo06/ajRXAAQm3xs74FVsRkOiJwuFuO zzlXmdl/MfQ/jM3SOtu9TnQ/pA/22IE0ZabfrY0PpQrJf/eSqoEcZXSfDCIMwPYhJQJU rE5a9eqZyma91sFbbcpI3xEe/G4g5UaxWgxTYit5PtbdCrUwHzhrsFqujfN6YmYfleaC k2yA3q9IaU5r+ML4JxuTaUjqUxHcieY2Ox5Y0uOm5OL/Mt+A3GfvLv6KD/0cN5T/SHv0 +l8Z/Yj8dILdmIdZvV1acDTYT79xXYX0yjZql1G2O536VEUWwlcr5MdH1GoxmrwDOJAX szTw== X-Forwarded-Encrypted: i=1; AJvYcCXxPAojhwRC+wNpE7jFLOFmdSHOfZHQ8AHRI81/LYwE4n+Q2KyOtO6jjoPbBiKevap7zRb0nbJF298=@lists.xenproject.org X-Gm-Message-State: AOJu0YxJ6czQzA6UntZyvxxx2Ly4lK74wa7weFRllAdJcp8ecuezzb0W asAGli7sa5Z9y6d+9UOYpYQx/oNioJqks7Zze9L7edR4rtronzsImjBjy4XUxcQv/g== X-Gm-Gg: AeBDievFqW5uaTXLCsbN/HzOsXRHreksPbiUDPgUyE7q0C17eH7dGd+VqCr3tPABdah Wgdi0vgWQXJ9dWLr89LR1I8iuqN4KnG/NNjfkTJHkCnkax4dIsQ08y2JH5dWrh1Fz24+Kkv4hFt qwLaB0bpawd9PMWd16QhGfkweXTcYotlREy3IA/j3dqPyqiIWv0k1BASIXnNp2ORktyeW0PqGie uMqDfWgA8/b//lczQ9ipFnCYi5ZB8eFkFpvyhuyHVtKJwK6A2DCHIW52/7Bwj+w9w7DXQYHivP0 zzMS32ofN5W+wBWAxFFfSr+czRqgvXLdWYbB0NuOVKumn0/Wjdt84oW28i3JZRIeowtzvYXYiaA DU9XhPifD4DsEYY6ikO6mCDdDCriMYgY+I8bK/5AfXzaux73H6wuJKl9Jp1pGjMJuAOypp37lYX a/K2CnaaJVQjlqZSzK14JunFPLQOE2Ij4B+B0FqdRKyDE9tEzZx5bBx7j5E5tsDJcXfvDW2r2eW Jux3QfAbYD7K78= X-Received: by 2002:a05:600c:c0dc:b0:486:fdba:f5db with SMTP id 5b1f17b1804b1-488cce7760dmr27209015e9.0.1775722418725; Thu, 09 Apr 2026 01:13:38 -0700 (PDT) Message-ID: <868b63e6-c551-49b6-b177-cfadb29a69b1@suse.com> Date: Thu, 9 Apr 2026 10:13:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] x86: record SSP at non-guest entry points To: Andrew Cooper Cc: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Teddy Astie , "xen-devel@lists.xenproject.org" References: Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH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5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-4011c0/1775722419-BF9440B1-192369C3/0/0 X-purgate-type: clean X-purgate-size: 2564 On 08.04.2026 18:58, Andrew Cooper wrote: > On 08/04/2026 1:22 pm, Jan Beulich wrote: >> We will want to use that value for call trace generation, and likely >> also to eliminate the somewhat fragile shadow stack searching done in >> fixup_exception_return(). For those purposes, guest-only entry points do >> not need to record that value. >> >> To keep the saving code simple, record our own SSP that corresponds to >> an exception frame, pointing to the top of the shadow stack counterpart >> of what the CPU has saved on the regular stack. Consuming code can then >> work its way from there. >> >> Signed-off-by: Jan Beulich >> --- >> For PUSH_AND_CLEAR_GPRS and POP_GPRS, putting the new field right next to >> the error code isn't entirely nice; putting it ahead of %r15 would entail >> other changes, though. An option may be to not make SSP handling part of >> the macros in the first place. Thoughts? > > I have a firm dislike for SAVE/RESTORE_ALL, both for their substantial > complexity/inefficiency, and mixing of unrelated tasks. > > I have several series trying to purge them.  I suppose I really ought to > try and finish this off properly. > > While classing SSP as a "register" is probably fine, the ssp= parameter > (and particular it's asymmetric nature) is on the wrong side of the > "complex" argument IMO. > >> For POP_GPRS, does it really matter that it doesn't alter EFLAGS? > > Yes.  The SYSCALL fix for one (reviewed, but waiting on final testing > before I commit). > > Then the VT-x code when swapped to use POP_GPRS. > > > To take a step back, you say that putting it ahead of %r15 would entail > other changes.  What changes? SAVE_ALL's initial ADD, RESTORE_ALL's final SUB, and then the hunt for anything which may simply assume UREGS_r15 to be 0. If UREGS_r were ordered by register number, I would have considered putting it where %rsp nominally would go, but without that putting it somewhere in the middle feels rather arbitrary. > The resulting asm would be far cleaner. I agree. >  It would be an rdssp;push on > one side, and a pop into any register on the other side.  Furthermore, > given that the ssp= doesn't exclude storing it for some user frames, > just store it for all.  It's one push/pop into a hot cacheline, and > makes a substantial reduction in complexity. I'm having significant reservations against that. I use the 0 put there in subsequent patches, to identify absence of that data being available. Jan