mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"hpa@zytor.com" <hpa@zytor.com>
Cc: "samitolvanen@google.com" <samitolvanen@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions
Date: Thu, 5 Jun 2025 13:12:39 +0000	[thread overview]
Message-ID: <e9e6e0c1e99c00022c96d2832c7c4e6342dd39c2.camel@intel.com> (raw)
In-Reply-To: <55e5b3f8-3e17-4962-af2f-75c98ccd414f@intel.com>

On Wed, 2025-06-04 at 12:46 -0700, Dave Hansen wrote:
> Circling back around now that I've divined out what is happening here...
> Is this even really about ENDBR at all? I thought that clang has some
> CFI checking that's completely independent from CET/IBT and thus ENDBR.
> Wouldn't this also break with that?

Hi Dave,

With your reminder on clang and CFI, I did more test on this patch, and
unfortunately I found building with clang and CONFIG_CFI_CLANG=y generates
below build error:

  ld.lld: error: undefined symbol: __kcfi_typeid___seamcall_saved_ret
  >>> referenced by usercopy_64.c
  >>>               vmlinux.o:(__cfi___seamcall_saved_ret)

It is because currently __seaamcall_saved_ret() is only called and is
directly called by tdh_vp_enter(), but not via sc_retry().

Making tdh_vp_enter() call __seamcall_saved_ret() via sc_retry() fixes
the error, but I am not sure it's a good idea since tdh_vp_enter() is in
performance critical path (although the additional cost of sc_retry() is
minor comparing to the SEAMCALL itself).

I think we can keep using SYM_FUNC_START for __seamcall_saved_ret() but only
change to using SYM_TYPED_FUNC_START for the other two.

I've sent out v2 based on above by replying to this v1 patch.  Appreciate if
you can review.  Thanks for your time.

  parent reply	other threads:[~2025-06-05 13:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04  0:38 Kai Huang
2025-06-04 19:46 ` Dave Hansen
2025-06-04 23:16   ` Huang, Kai
2025-06-04 23:23     ` Dave Hansen
2025-06-04 23:27       ` Huang, Kai
2025-06-04 23:57         ` Huang, Kai
2025-06-05 13:12   ` Huang, Kai [this message]
2025-06-05 13:10 ` [PATCH v2] x86/virt/tdx: Annotate TDX assembly to allow indirect calls Kai Huang
2025-06-05 14:07 ` [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions Peter Zijlstra
2025-06-05 14:21   ` Peter Zijlstra
2025-06-05 14:54     ` Dave Hansen
2025-06-05 14:59       ` Peter Zijlstra
2025-06-05 23:20         ` Huang, Kai
2025-06-05 23:23           ` Dave Hansen

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=e9e6e0c1e99c00022c96d2832c7c4e6342dd39c2.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=samitolvanen@google.com \
    --cc=tglx@linutronix.de \
    --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®