]> git.baikalelectronics.ru Git - kernel.git/commit
xen/blkfront: don't trust the backend response data blindly
authorJuergen Gross <jgross@suse.com>
Fri, 30 Jul 2021 10:38:54 +0000 (12:38 +0200)
committerJuergen Gross <jgross@suse.com>
Mon, 30 Aug 2021 10:01:59 +0000 (12:01 +0200)
commitcf0fc4b6f5ecc443dd1685670fe402b5233440d5
treed66c5592e6e2ebc8d0cad6adaf260072f7d3731c
parent700106d8f88c72dd7581f1119c6921ec5c823af9
xen/blkfront: don't trust the backend response data blindly

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).

Make all warning messages issued due to valid error responses rate
limited in order to avoid message floods being triggered by a malicious
backend.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Link: https://lore.kernel.org/r/20210730103854.12681-4-jgross@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/block/xen-blkfront.c