diff options
author | Juergen Gross <jgross@suse.com> | 2021-05-17 15:43:04 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-05-17 15:43:04 +0200 |
commit | d1f6296053f464c9da6f6fa5f1ece864130718ce (patch) | |
tree | 70411f40694d65697ab85643f04a71af2e495053 /xen/include/public | |
parent | 599bca58849effbac4ef03a5986d20e38e26a854 (diff) |
include/public: add RING_RESPONSE_PROD_OVERFLOW macro
Add a new RING_RESPONSE_PROD_OVERFLOW() macro for being able to
detect an ill-behaved backend tampering with the response producer
index.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/include/public')
-rw-r--r-- | xen/include/public/io/ring.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h index 0b08b2697e..c486c457e0 100644 --- a/xen/include/public/io/ring.h +++ b/xen/include/public/io/ring.h @@ -259,6 +259,10 @@ typedef struct __name##_back_ring __name##_back_ring_t #define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \ (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r)) +/* Ill-behaved backend determination: Can there be this many responses? */ +#define RING_RESPONSE_PROD_OVERFLOW(_r, _prod) \ + (((_prod) - (_r)->rsp_cons) > RING_SIZE(_r)) + #define RING_PUSH_REQUESTS(_r) do { \ xen_wmb(); /* back sees requests /before/ updated producer index */ \ (_r)->sring->req_prod = (_r)->req_prod_pvt; \ |