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: <Zrv649ijpYchVlyL@ls.amr.corp.intel.com>
Date: Tue, 13 Aug 2024 17:31:31 -0700
From: Isaku Yamahata <isaku.yamahata@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>
Cc: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
	"Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
	"seanjc@...gle.com" <seanjc@...gle.com>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
	"tony.lindgren@...ux.intel.com" <tony.lindgren@...ux.intel.com>,
	"Li, Xiaoyao" <Xiaoyao.Li@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Binbin Wu <binbin.wu@...ux.intel.com>,
	"Yao, Yuan" <yuan.yao@...el.com>,
	"isaku.yamahata@...ux.intel.com" <isaku.yamahata@...ux.intel.com>
Subject: Re: [PATCH 05/25] KVM: TDX: Add helper functions to print TDX
 SEAMCALL error

On Wed, Aug 14, 2024 at 10:34:11AM +1200,
"Huang, Kai" <kai.huang@...el.com> wrote:

> 
> > > +#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)
> > 
> 
> You are right.  Thanks for catching this!
> 
> The above code looks good to me, except we don't need pr_tdx_error_N()
> anymore.
> 
> I think we can just replace the old pr_tdx_error_N() with your
> __pr_tdx_error_N().

Agreed, we don't have the direct user of pr_tdx_error_N().
-- 
Isaku Yamahata <isaku.yamahata@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ