public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	"x86@kernel.org" <x86@kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"jarkko@kernel.org" <jarkko@kernel.org>,
	"seanjc@google.com" <seanjc@google.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] x86/sgx: Add kernel-doc descriptions for params passed to vDSO user handler
Date: Thu, 13 Nov 2025 01:59:08 +0000	[thread overview]
Message-ID: <9adc3a5437cf7d9af99642a0df837bbd0237bb58.camel@intel.com> (raw)
In-Reply-To: <20251112160708.1343355-3-seanjc@google.com>

On Wed, 2025-11-12 at 08:07 -0800, Sean Christopherson wrote:
> Add kernel-doc markup for the register parameters passed by the vDSO blob
> to the user handler to suppress build warnings, e.g.
> 
>   WARNING: arch/x86/include/uapi/asm/sgx.h:157 function parameter 'r8' not
>            described in 'sgx_enclave_user_handler_t'
> 
> Call out that except for RSP, the registers are undefined on asynchronous
> exits as far as the vDSO ABI is concerned.  E.g. the vDSO's exception
> handler clobbers RDX, RDI, and RSI, and the kernel doesn't guarantee that
> R8 or R9 will be zero (the synthetic value loaded by the CPU).

Perhaps a nit:

I am not that familiar with this part, but AFAICT the kernel always sets
RDI/RSI/RDX to exception vector/error code/addr before invoking the user
handler, after the vDSO's exception handler clobbers them.

Since you are adding description to them, should we somehow call this out in
the comment, if I didn't miss anything?

> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://lore.kernel.org/all/20251106145506.145fc620@canb.auug.org.au
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  arch/x86/include/uapi/asm/sgx.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/include/uapi/asm/sgx.h b/arch/x86/include/uapi/asm/sgx.h
> index a438ea43bfd1..0d408f001ac6 100644
> --- a/arch/x86/include/uapi/asm/sgx.h
> +++ b/arch/x86/include/uapi/asm/sgx.h
> @@ -143,6 +143,12 @@ struct sgx_enclave_run;
>  /**
>   * typedef sgx_enclave_user_handler_t - Exit handler function accepted by
>   *					__vdso_sgx_enter_enclave()
> + * @rdi:	RDI at the time of EEXIT, undefined on AEX
> + * @rsi:	RSI at the time of EEXIT, undefined on AEX
> + * @rdx:	RDX at the time of EEXIT, undefined on AEX
> + * @rsp:	RSP (untrusted) at the time of EEXIT or AEX
> + * @r8:		R8 at the time of EEXIT, undefined on AEX
> + * @r9:		R9 at the time of EEXIT, undefined on AEX
>   * @run:	The run instance given by the caller
>   *
>   * The register parameters contain the snapshot of their values at enclave

  reply	other threads:[~2025-11-13  1:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 16:07 [PATCH 0/5] x86/sgx: Fix kernel-doc warnings Sean Christopherson
2025-11-12 16:07 ` [PATCH 1/5] x86/sgx: Add a missing colon in kernel-doc markup for "struct sgx_enclave_run" Sean Christopherson
2025-11-19  2:27   ` Jarkko Sakkinen
2025-11-12 16:07 ` [PATCH 2/5] x86/sgx: Add kernel-doc descriptions for params passed to vDSO user handler Sean Christopherson
2025-11-13  1:59   ` Huang, Kai [this message]
2025-11-13 15:09     ` Sean Christopherson
2025-11-13 19:57       ` Huang, Kai
2025-11-19  2:28   ` Jarkko Sakkinen
2025-11-12 16:07 ` [PATCH 3/5] x86/sgx: Document structs and enums with '@', not '%' Sean Christopherson
2025-11-12 16:07 ` [PATCH 4/5] x86/sgx: Remove superfluous asterisk from copyright comment in asm/sgx.h Sean Christopherson
2025-11-13  1:21   ` Huang, Kai
2025-11-19  2:28   ` Jarkko Sakkinen
2025-11-12 16:07 ` [PATCH 5/5] x86/sgx: Fix a typo in the kernel-doc comment for enum sgx_attribute Sean Christopherson
2025-11-19  2:28   ` Jarkko Sakkinen
2025-11-13  1:59 ` [PATCH 0/5] x86/sgx: Fix kernel-doc warnings Huang, Kai
2025-11-14 23:31 ` 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=9adc3a5437cf7d9af99642a0df837bbd0237bb58.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=seanjc@google.com \
    --cc=sfr@canb.auug.org.au \
    --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