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

[PATCH] xsm/flask: Fix build with Clang 13


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 25 Apr 2022 19:07:56 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "George Dunlap" <George.Dunlap@xxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 25 Apr 2022 18:08:30 +0000
  • Ironport-data: A9a23:W4Lu5aln1A9UgjP5ZA5VsNHo5gxSJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIWX2HSM/fZZmDzeI8lYd7j901SuJWBx4I2TlE6+Sg2RSMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EoLd9IR2NYy24DlWV7V4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYdhslboDigvwnCxxSEy9FAKlN4aeEGC3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3k3ds1zzGS90hRojOWf7i7t5ExjYgwMtJGJ4yY uJHOGUxNUSfMnWjPH8pIrNkxbqwhEC4egdopUy5mLoJuC/cmVkZPL/Fb4OOJ43iqd9utl2Du mvM8mD9AxcbHN+S0zyI9jSrnOCntTz/cJIfEvu/7PECqF+Owm0eDjUGWF39puO24maccd9CL 00f+gI1sLM/skesS7HVTxC+5XKJoBMYc95RCPEhrhGAzLLO5ASUDXRCSSROAPQqu8M7SiYj/ kOYlNPuQzp0ufuaTmz13ruMtjazJSg9JHcPfzMZVhAC58T/oYY1lVTESdMLLUKupoSrQ3eqm WnM9XVgweVI5SIW60ml1W/bj2KBiILRdFYw7AXZZV+h5RphJ7fwMuRE9mPnxfpHKY+YSHyIs 34Fh9WS4YgyMH2dqMCeaL5TRe/0vp5pJBWZ2AcyRMd5q1xB7lb5JehtDCdCyFCF2yruURvge wfttAxY//e/11P6PPYsM+pd5ynHpJUM9OgJtNiJNLKigbArLWdrGR2CgmbKggjQfLAEy/1XB HtiWZ/E4YwmIapm1iGqYOwWzKUmwCszrUuKG82jkEn+ieDPOSTLIVvgDLdoRrpghE9jiF+Lm +uzyuPQk0kPOAEASnS/HXEvwaAiciFgWMGeRz1/fe+fOAt2cFzN+NeKqY7Nj7dNxvwP/s+Rp ynVchYBmDLX2C2WQS3XOysLQO6+Av5CQYcTYHVE0aCAgCN4P+5CLc43KvMKQFXQ3LE9naMsE 6lZKq1twJ1nE1z6xtjUVrGlxKQKSfhhrVvm0/aNCNTnQ6Ndeg==
  • Ironport-hdrordr: A9a23:Q60ka65cJJIcj/OCSgPXwMTXdLJyesId70hD6qhwISY6TiX+rb HIoB17726RtN9/YhEdcLy7VJVoIkmskKKdg7NhXotKNTOO0ADDQb2KhbGSpQEIcBeeygcy78 hdmtBFeb/NMWQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Clang 13 chokes with:

  In file included from xsm/flask/flask_op.c:780:
  xsm/flask/flask_op.c:698:33: error: passing 4-byte aligned argument to
  8-byte aligned parameter 1 of 'flask_ocontext_add' may result in an
  unaligned pointer access [-Werror,-Walign-mismatch]
          rv = flask_ocontext_add(&op.u.ocontext);
                                  ^

and the same for flask_ocontext_del().  It isn't a problem in practice,
because the union always starts 8 bytes into {xen,compat}_flask_op_t, but the
diagnostic is based on type alignment alone.

struct xen_flask_ocontext has the same layout between native and compat, but
does change alignment because of uint64_t, and there is only a native
implementation of flask_ocontext_add().

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
CC: Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Slightly RFC because there don't appear to be any good options here.
---
 xen/include/public/xsm/flask_op.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/public/xsm/flask_op.h 
b/xen/include/public/xsm/flask_op.h
index b41dd6dac894..80dc35122320 100644
--- a/xen/include/public/xsm/flask_op.h
+++ b/xen/include/public/xsm/flask_op.h
@@ -146,7 +146,7 @@ struct xen_flask_ocontext {
     uint32_t ocon;
     uint32_t sid;
     uint64_t low, high;
-};
+} __attribute__((__aligned__(8)));
 typedef struct xen_flask_ocontext xen_flask_ocontext_t;
 
 struct xen_flask_peersid {
-- 
2.11.0




 


Rackspace

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