[xen master] xen/public: Correct the definition of GNTTAB_CACHE_SOURCE_GREF

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[xen master] xen/public: Correct the definition of GNTTAB_CACHE_SOURCE_GREF

commit 5dd3907a2af37060a675dd3bc5a02b7b38dac66c
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Tue Oct 17 15:11:23 2017 +0100
Commit:     Andrew Cooper <[hidden email]>
CommitDate: Thu Oct 19 14:10:45 2017 +0100

    xen/public: Correct the definition of GNTTAB_CACHE_SOURCE_GREF
    Discovered when running the XSA-232 PoC on a UBSAN-enabled hypervisor.
      (d79) XSA-232 PoC
      (XEN) ================================================================================
      (XEN) UBSAN: Undefined behaviour in grant_table.c:3217:25
      (XEN) left shift of 1 by 31 places cannot be represented in type 'int'
      (XEN) ----[ Xen-4.10.0-rc  x86_64  debug=y   Tainted:    H ]----
    Update all of the GNTTAB_CACHE_* constants to be unsigned integers.
    Signed-off-by: Andrew Cooper <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Reviewed-by: Konrad Rzeszutek Wilk <[hidden email]>
    Release-acked-by: Julien Grall <[hidden email]>
 xen/include/public/grant_table.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 018036e..180d62c 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -589,9 +589,9 @@ struct gnttab_cache_flush {
     } a;
     uint16_t offset; /* offset from start of grant */
     uint16_t length; /* size within the grant */
-#define GNTTAB_CACHE_CLEAN          (1<<0)
-#define GNTTAB_CACHE_INVAL          (1<<1)
-#define GNTTAB_CACHE_SOURCE_GREF    (1<<31)
+#define GNTTAB_CACHE_CLEAN          (1u<<0)
+#define GNTTAB_CACHE_INVAL          (1u<<1)
+#define GNTTAB_CACHE_SOURCE_GREF    (1u<<31)
     uint32_t op;
 typedef struct gnttab_cache_flush gnttab_cache_flush_t;
generated by git-patchbot for /home/xen/git/xen.git#master

Xen-changelog mailing list
[hidden email]