Re: [PATCH v10 16/50] x86/sev: Introduce snp leaked pages list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux