[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <278182af-044a-9445-bbdb-fdbb65d0da7c@suse.com>
Date: Mon, 17 May 2021 16:11:08 +0200
From: Juergen Gross <jgross@...e.com>
To: Jan Beulich <jbeulich@...e.com>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Roger Pau Monné <roger.pau@...rix.com>,
Jens Axboe <axboe@...nel.dk>, xen-devel@...ts.xenproject.org,
linux-kernel@...r.kernel.org, linux-block@...r.kernel.org
Subject: Re: [PATCH 3/8] xen/blkfront: don't take local copy of a request from
the ring page
On 17.05.21 16:01, Jan Beulich wrote:
> On 13.05.2021 12:02, 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@...e.com>
>
> Reviewed-by: Jan Beulich <jbeulich@...e.com>
> with one remark/question:
>
>> @@ -703,6 +704,7 @@ static int blkif_queue_rw_req(struct request *req,
struct blkfront_ring_info *ri
>> {
>> struct blkfront_info *info = rinfo->dev_info;
>> struct blkif_request *ring_req, *extra_ring_req = NULL;
>> + struct blkif_request *final_ring_req, *final_extra_ring_req;
>
> Without setting final_extra_ring_req to NULL just like is done for
> extra_ring_req, ...
>
>> @@ -840,10 +845,10 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
>> if (setup.segments)
>> kunmap_atomic(setup.segments);
>>
>> - /* Keep a private copy so we can reissue requests when recovering. */
>> - rinfo->shadow[id].req = *ring_req;
>> + /* Copy request(s) to the ring page. */
>> + *final_ring_req = *ring_req;
>> if (unlikely(require_extra_req))
>> - rinfo->shadow[extra_id].req = *extra_ring_req;
>> + *final_extra_ring_req = *extra_ring_req;
>
> ... are you sure all supported compilers will recognize the
> conditional use and not warn about use of a possibly uninitialized
> variable?
Hmm, probably better safe than sorry. Will change it.
Juergen
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3092 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists