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]
Date:   Sun, 6 Nov 2022 13:45:16 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Dave Hansen <dave.hansen@...ux.intel.com>
Cc:     linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        x86@...nel.org
Subject: Re: [tip: x86/urgent] x86/tdx: Prepare for using "INFO" call for a
 second purpose

On Tue, Nov 01, 2022 at 11:25:36PM -0000, tip-bot2 for Dave Hansen wrote:
> @@ -121,7 +121,7 @@ static u64 get_cc_mask(void)
>  	 * The highest bit of a guest physical address is the "sharing" bit.
>  	 * Set it for shared pages and clear it for private pages.
>  	 */
> -	return BIT_ULL(gpa_width - 1);
> +	*cc_mask = BIT_ULL(gpa_width - 1);
>  }

I'm looking at the next patch too and I still don't see what the point
is of making it a void?

IOW, what's wrong with doing this?

---
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index b8998cf0508a..0421cb7f3b86 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -100,11 +100,11 @@ static inline void tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
 		panic("TDCALL %lld failed (Buggy TDX module!)\n", fn);
 }
 
-static void tdx_parse_tdinfo(u64 *cc_mask)
+static u64 tdx_parse_tdinfo(void)
 {
 	struct tdx_module_output out;
 	unsigned int gpa_width;
-	u64 td_attr;
+	u64 td_attr, ret;
 
 	/*
 	 * TDINFO TDX module call is used to get the TD execution environment
@@ -123,7 +123,7 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
 	 * can not meaningfully run without it.
 	 */
 	gpa_width = out.rcx & GENMASK(5, 0);
-	*cc_mask = BIT_ULL(gpa_width - 1);
+	ret = BIT_ULL(gpa_width - 1);
 
 	/*
 	 * The kernel can not handle #VE's when accessing normal kernel
@@ -133,6 +133,8 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
 	td_attr = out.rdx;
 	if (!(td_attr & ATTR_SEPT_VE_DISABLE))
 		panic("TD misconfiguration: SEPT_VE_DISABLE attibute must be set.\n");
+
+	return ret;
 }
 
 /*
@@ -769,7 +771,7 @@ void __init tdx_early_init(void)
 	setup_force_cpu_cap(X86_FEATURE_TDX_GUEST);
 
 	cc_set_vendor(CC_VENDOR_INTEL);
-	tdx_parse_tdinfo(&cc_mask);
+	cc_mask = tdx_parse_tdinfo();
 	cc_set_mask(cc_mask);
 
 	/*

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ