|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 3/3] xen/blkfront: don't trust the backend response data blindly
On 09.07.21 11:42, Roger Pau Monné wrote: On Thu, Jul 08, 2021 at 02:43:45PM +0200, Juergen Gross wrote:Today blkfront will trust the backend to send only sane response data. In order to avoid privilege escalations or crashes in case of malicious backends verify the data to be within expected limits. Especially make sure that the response always references an outstanding request. Introduce a new state of the ring BLKIF_STATE_ERROR which will be switched to in case an inconsistency is being detected. Recovering from this state is possible only via removing and adding the virtual device again (e.g. via a suspend/resume cycle). Signed-off-by: Juergen Gross <jgross@xxxxxxxx>Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> @@ -1555,11 +1561,17 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)spin_lock_irqsave(&rinfo->ring_lock, flags);again: - rp = rinfo->ring.sring->rsp_prod; - rmb(); /* Ensure we see queued responses up to 'rp'. */ + rp = READ_ONCE(rinfo->ring.sring->rsp_prod); + virt_rmb(); /* Ensure we see queued responses up to 'rp'. */Is the READ_ONCE strictly needed? Doesn't the barrier prevent rp from not being loaded at this point? I asked Jan the same and he didn't want to rule that out. Additionally the READ_ONCE() helps against (rather improbable) load tearing of the compiler.
This case shouldn't happen normally, so having the numerical value is enough and will help for hiding any undefined op.
Fine with me. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |