[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] io/ring.h: new macro to detect whether there are too many requests on the ring



commit a63c57093b610e8707653fb2320f48e2ad5acbc2
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jun 12 10:07:20 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jun 12 10:07:20 2013 +0200

    io/ring.h: new macro to detect whether there are too many requests on the 
ring
    
    Backends may need to protect themselves against an insane number of
    produced requests stored by a frontend, in case they iterate over
    requests until reaching the req_prod value. There can't be more
    requests on the ring than the difference between produced requests
    and produced (but possibly not yet published) responses.
    
    This is a more strict alternative to a patch previously posted by
    Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
---
 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 d9884f5..bdfb998 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -234,6 +234,10 @@ typedef struct __name##_back_ring __name##_back_ring_t
 #define RING_REQUEST_CONS_OVERFLOW(_r, _cons)                           \
     (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
 
+/* Ill-behaved frontend determination: Can there be this many requests? */
+#define RING_REQUEST_PROD_OVERFLOW(_r, _prod)                           \
+    (((_prod) - (_r)->rsp_prod_pvt) > 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;                         \
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.