File xsa313-1.patch of Package xen.21119

Subject: xenoprof: clear buffer intended to be shared with guests
From: Jan Beulich jbeulich@suse.com Tue Apr 14 15:08:26 2020 +0200
Date: Tue Apr 14 15:08:26 2020 +0200:
Git: 3e0c3163a0171914afb8d1fba44afafeac4b2267

alloc_xenheap_pages() making use of MEMF_no_scrub is fine for Xen
internally used allocations, but buffers allocated to be shared with
(unpriviliged) guests need to be zapped of their prior content.

This is part of XSA-313.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wl@xen.org>
master commit: 0763a7ebfcdad66cf9e5475a1301eefb29bae9ed
master date: 2020-04-14 14:32:33 +0200

diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c
index 5acdde5691..e4a3a0702f 100644
--- a/xen/common/xenoprof.c
+++ b/xen/common/xenoprof.c
@@ -257,6 +257,9 @@ static int alloc_xenoprof_struct(
         return -ENOMEM;
     }
 
+    for ( i = 0; i < npages; ++i )
+        clear_page(d->xenoprof->rawbuf + i * PAGE_SIZE);
+
     d->xenoprof->npages = npages;
     d->xenoprof->nbuf = nvcpu;
     d->xenoprof->bufsize = bufsize;
openSUSE Build Service is sponsored by