Re: [PATCH v2 2/3] xen/blkfront: don't take local copy of a request from the ring page

From: Juergen Gross
Date: Fri Jul 09 2021 - 09:54:24 EST


On 09.07.21 10:55, Roger Pau Monné wrote:
On Thu, Jul 08, 2021 at 02:43:44PM +0200, Juergen Gross wrote:
In order to avoid a malicious backend being able to influence the local
copy of a request build the request locally first and then copy it to
the ring page instead of doing it the other way round as today.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxx>

Thanks!

One unrelated comment below.


...

@@ -798,7 +801,9 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
ring_req->u.rw.nr_segments = num_grant;
if (unlikely(require_extra_req)) {
extra_id = blkif_ring_get_request(rinfo, req,
- &extra_ring_req);
+ &final_extra_ring_req);
+ extra_ring_req = &rinfo->shadow[extra_id].req;

I'm slightly confused about this extra request stuff because I cannot
find any check that asserts we have two empty slots on the ring before
getting here (I only see a RING_FULL check in blkif_queue_rq).

This is AFAIK only used on Arm when guest page size > 4KB.

I agree that this is a bug and should be fixed.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature