From: Julien Grall Subject: [PATCH] xen/xsm: Generate the permission in a spec-compliant way Date: Fri, 20 Feb 2015 15:58:28 +0000 Message-ID: <1424447908-8689-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YOpyo-0001rE-C7 for xen-devel@lists.xenproject.org; Fri, 20 Feb 2015 15:59:02 +0000 Received: by wesw62 with SMTP id w62so6358604wes.9 for ; Fri, 20 Feb 2015 07:58:57 -0800 (PST) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: ian.jackson@eu.citrix.com, dgdegra@tycho.nsa.gov, Julien Grall , wei.liu2@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Each class can contains 32 permisions which are encoded on a word (one bit per permission). Currently the awk script will generate an hexadecimal value for each permission. This may result to generate an invalid value on some version of awk. For instance debian jessie is using a version of mawk where (1 << 31) will result to 0x7fffffff. This is because the awk specification requires to do the arithmetic with float. So the resulting integer may vary following the implementation. As the generated headers are only used by C code, generate the permission define via "1UL << n". Signed-off-by: Julien Grall --- https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/1159933 This bug impacts every version of Xen built on Debian Jessie when XSM is enabled. It would be interesting to backport it. --- xen/xsm/flask/policy/mkaccess_vector.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh index 8ec87f7..7fa4aaf 100644 --- a/xen/xsm/flask/policy/mkaccess_vector.sh +++ b/xen/xsm/flask/policy/mkaccess_vector.sh @@ -42,7 +42,7 @@ $1 == "class" { } av_defined[tclass] = 1; - permission = 1; + permission = 0; nextstate = "INHERITS_OR_CLASS-OPENBRACKET"; next; @@ -108,8 +108,8 @@ $1 == "{" { for (i = 0; i < spaces; i++) printf(" ") > outfile; - printf("0x%08xUL\n", permission) > outfile; - permission = permission * 2; + printf("(1UL << %u)\n", permission) > outfile; + permission = permission + 1; } $1 == "}" { if (nextstate != "CLASS-CLOSEBRACKET" && -- 2.1.4