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] [day] [month] [year] [list]
Message-ID:
 <SJ0PR21MB1324C3F886F318C3A3561792BFD02@SJ0PR21MB1324.namprd21.prod.outlook.com>
Date: Fri, 28 Jun 2024 19:24:10 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
CC: "x86@...nel.org" <x86@...nel.org>, "linux-coco@...ts.linux.dev"
	<linux-coco@...ts.linux.dev>, "ak@...ux.intel.com" <ak@...ux.intel.com>,
	"arnd@...db.de" <arnd@...db.de>, "bp@...en8.de" <bp@...en8.de>,
	"brijesh.singh@....com" <brijesh.singh@....com>, "dan.j.williams@...el.com"
	<dan.j.williams@...el.com>, "dave.hansen@...el.com" <dave.hansen@...el.com>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, Haiyang Zhang
	<haiyangz@...rosoft.com>, "hpa@...or.com" <hpa@...or.com>,
	"jane.chu@...cle.com" <jane.chu@...cle.com>, KY Srinivasan
	<kys@...rosoft.com>, "luto@...nel.org" <luto@...nel.org>, "mingo@...hat.com"
	<mingo@...hat.com>, "peterz@...radead.org" <peterz@...radead.org>,
	"rostedt@...dmis.org" <rostedt@...dmis.org>,
	"sathyanarayanan.kuppuswamy@...ux.intel.com"
	<sathyanarayanan.kuppuswamy@...ux.intel.com>, "seanjc@...gle.com"
	<seanjc@...gle.com>, "tglx@...utronix.de" <tglx@...utronix.de>,
	"tony.luck@...el.com" <tony.luck@...el.com>, "wei.liu@...nel.org"
	<wei.liu@...nel.org>, jason <jason@...c4.com>, "nik.borisov@...e.com"
	<nik.borisov@...e.com>, mhklinux <mhklinux@...look.com>,
	"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Tianyu Lan
	<Tianyu.Lan@...rosoft.com>, "rick.p.edgecombe@...el.com"
	<rick.p.edgecombe@...el.com>, "andavis@...hat.com" <andavis@...hat.com>, Mark
 Heslin <mheslin@...hat.com>, vkuznets <vkuznets@...hat.com>,
	"xiaoyao.li@...el.com" <xiaoyao.li@...el.com>, "stable@...r.kernel.org"
	<stable@...r.kernel.org>
Subject: RE: [PATCH] x86/tdx: Support vmalloc() for tdx_enc_status_changed()

> From: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Sent: Friday, June 28, 2024 3:05 AM
> To: Dexuan Cui <decui@...rosoft.com>
> >   [...]
> >  static bool tdx_enc_status_changed(unsigned long vaddr, int numpages,
>  [...]
> This patch collied with kexec changes. tdx_kexec_finish() calls
> tdx_enc_status_changed() after clearing pte, so slow_virt_to_phys()
> crashes on in.
> 
> Daxuan, could you check if the fixup below works for you on vmalloc
> addresses?
> 
> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> index ef8ec2425998..5e455c883bcc 100644
> --- a/arch/x86/coco/tdx/tdx.c
> +++ b/arch/x86/coco/tdx/tdx.c
> @@ -813,8 +813,15 @@ static bool tdx_enc_status_changed(unsigned
> long vaddr, int numpages, bool enc)
>  		step = PAGE_SIZE;
> 
>  	for (addr = start; addr < end; addr += step) {
> -		phys_addr_t start_pa = slow_virt_to_phys((void *)addr);
> -		phys_addr_t end_pa   = start_pa + step;
> +		phys_addr_t start_pa;
> +		phys_addr_t end_pa;
> +
> +		if (virt_addr_valid(addr))
> +			start_pa = __pa(addr);
> +		else
> +			start_pa = slow_virt_to_phys((void *)addr);
> +
> +		end_pa = start_pa + step;
> 
>  		if (!tdx_enc_status_changed_phys(start_pa, end_pa, enc))
>  			return false;
> --
>   Kiryl Shutsemau / Kirill A. Shutemov

Hi Kirill, your fixup works for me.

BTW, I just realized that virt_addr_valid() returns false for a vmalloc'd address.

Thanks,
Dexuan



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ