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: <f0dc32ea-3b77-1e9e-42fd-3f115c001f7c@amd.com>
Date:   Fri, 8 Dec 2023 14:54:14 -0600
From:   "Kalra, Ashish" <ashish.kalra@....com>
To:     Borislav Petkov <bp@...en8.de>, Michael Roth <michael.roth@....com>
Cc:     kvm@...r.kernel.org, linux-coco@...ts.linux.dev,
        linux-mm@...ck.org, linux-crypto@...r.kernel.org, x86@...nel.org,
        linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
        jroedel@...e.de, thomas.lendacky@....com, hpa@...or.com,
        ardb@...nel.org, pbonzini@...hat.com, seanjc@...gle.com,
        vkuznets@...hat.com, jmattson@...gle.com, luto@...nel.org,
        dave.hansen@...ux.intel.com, slp@...hat.com, pgonda@...gle.com,
        peterz@...radead.org, srinivas.pandruvada@...ux.intel.com,
        rientjes@...gle.com, dovmurik@...ux.ibm.com, tobin@....com,
        vbabka@...e.cz, kirill@...temov.name, ak@...ux.intel.com,
        tony.luck@...el.com, marcorr@...gle.com,
        sathyanarayanan.kuppuswamy@...ux.intel.com, alpergun@...gle.com,
        jarkko@...nel.org, nikunj.dadhania@....com, pankaj.gupta@....com,
        liam.merwick@...cle.com, zhi.a.wang@...el.com
Subject: Re: [PATCH v10 16/50] x86/sev: Introduce snp leaked pages list

On 12/6/2023 2:42 PM, Borislav Petkov wrote:
> On Mon, Oct 16, 2023 at 08:27:45AM -0500, Michael Roth wrote:
>> +	spin_lock(&snp_leaked_pages_list_lock);
>> +	while (npages--) {
>> +		/*
>> +		 * Reuse the page's buddy list for chaining into the leaked
>> +		 * pages list. This page should not be on a free list currently
>> +		 * and is also unsafe to be added to a free list.
>> +		 */
>> +		list_add_tail(&page->buddy_list, &snp_leaked_pages_list);
>> +		sev_dump_rmpentry(pfn);
>> +		pfn++;
>> +	}
>> +	spin_unlock(&snp_leaked_pages_list_lock);
>> +	atomic_long_inc(&snp_nr_leaked_pages);
> 
> How is this supposed to count?
> 
> You're leaking @npages as the function's parameter but are incrementing
> snp_nr_leaked_pages only once?
> 
> Just make it a bog-normal unsigned long and increment it inside the
> locked section.
> 
> Or do at the beginning of the function:
> 
> 	atomic_long_add(npages, &snp_nr_leaked_pages);
> 

Yes will fix accordingly by incrementing it inside the locked section.

Thanks,
Ashish

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ