lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZruKrWWDtB+E3kwr@ls.amr.corp.intel.com>
Date: Tue, 13 Aug 2024 09:32:45 -0700
From: Isaku Yamahata <isaku.yamahata@...el.com>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
Cc: seanjc@...gle.com, pbonzini@...hat.com, kvm@...r.kernel.org,
	kai.huang@...el.com, isaku.yamahata@...il.com,
	tony.lindgren@...ux.intel.com, xiaoyao.li@...el.com,
	linux-kernel@...r.kernel.org,
	Isaku Yamahata <isaku.yamahata@...el.com>,
	Binbin Wu <binbin.wu@...ux.intel.com>,
	Yuan Yao <yuan.yao@...el.com>, isaku.yamahata@...ux.intel.com
Subject: Re: [PATCH 05/25] KVM: TDX: Add helper functions to print TDX
 SEAMCALL error

On Mon, Aug 12, 2024 at 03:48:00PM -0700,
Rick Edgecombe <rick.p.edgecombe@...el.com> wrote:

> From: Isaku Yamahata <isaku.yamahata@...el.com>
> 
> Add helper functions to print out errors from the TDX module in a uniform
> manner.
> 
> Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Reviewed-by: Binbin Wu <binbin.wu@...ux.intel.com>
> Reviewed-by: Yuan Yao <yuan.yao@...el.com>
> ---
> uAPI breakout v1:
> - Update for the wrapper functions for SEAMCALLs. (Sean)
> - Reorder header file include to adjust argument change of the C wrapper.
> - Fix bisectability issues in headers (Kai)
> - Updates from seamcall overhaul (Kai)
> 
> v19:
> - dropped unnecessary include <asm/tdx.h>
> 
> v18:
> - Added Reviewed-by Binbin.
> ---
>  arch/x86/kvm/vmx/tdx_ops.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/tdx_ops.h b/arch/x86/kvm/vmx/tdx_ops.h
> index a9b9ad15f6a8..3f64c871a3f2 100644
> --- a/arch/x86/kvm/vmx/tdx_ops.h
> +++ b/arch/x86/kvm/vmx/tdx_ops.h
> @@ -16,6 +16,21 @@
>  
>  #include "x86.h"
>  
> +#define pr_tdx_error(__fn, __err)	\
> +	pr_err_ratelimited("SEAMCALL %s failed: 0x%llx\n", #__fn, __err)
> +
> +#define pr_tdx_error_N(__fn, __err, __fmt, ...)		\
> +	pr_err_ratelimited("SEAMCALL %s failed: 0x%llx, " __fmt, #__fn, __err,  __VA_ARGS__)

Stringify in the inner macro results in expansion of __fn.  It means value
itself, not symbolic string.  Stringify should be in the outer macro.
"SEAMCALL 7 failed" vs "SEAMCALL TDH_MEM_RANGE_BLOCK failed"

#define __pr_tdx_error_N(__fn_str, __err, __fmt, ...)           \
        pr_err_ratelimited("SEAMCALL " __fn_str " failed: 0x%llx, " __fmt,  __err,  __VA_ARGS__)

#define pr_tdx_error_N(__fn, __err, __fmt, ...)         \
        __pr_tdx_error_N(#__fn, __err, __fmt, __VA_ARGS__)

#define pr_tdx_error_1(__fn, __err, __rcx)              \
        __pr_tdx_error_N(#__fn, __err, "rcx 0x%llx\n", __rcx)

#define pr_tdx_error_2(__fn, __err, __rcx, __rdx)       \
        __pr_tdx_error_N(#__fn, __err, "rcx 0x%llx, rdx 0x%llx\n", __rcx, __rdx)

#define pr_tdx_error_3(__fn, __err, __rcx, __rdx, __r8) \
        __pr_tdx_error_N(#__fn, __err, "rcx 0x%llx, rdx 0x%llx, r8 0x%llx\n", __rcx, __rdx, __r8)


> +
> +#define pr_tdx_error_1(__fn, __err, __rcx)		\
> +	pr_tdx_error_N(__fn, __err, "rcx 0x%llx\n", __rcx)
> +
> +#define pr_tdx_error_2(__fn, __err, __rcx, __rdx)	\
> +	pr_tdx_error_N(__fn, __err, "rcx 0x%llx, rdx 0x%llx\n", __rcx, __rdx)
> +
> +#define pr_tdx_error_3(__fn, __err, __rcx, __rdx, __r8)	\
> +	pr_tdx_error_N(__fn, __err, "rcx 0x%llx, rdx 0x%llx, r8 0x%llx\n", __rcx, __rdx, __r8)
> +
>  static inline u64 tdh_mng_addcx(struct kvm_tdx *kvm_tdx, hpa_t addr)
>  {
>  	struct tdx_module_args in = {
> -- 
> 2.34.1
> 
> 

-- 
Isaku Yamahata <isaku.yamahata@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ