From patchwork Fri Feb 20 15:58:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 44863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 309A721554 for ; Fri, 20 Feb 2015 16:00:47 +0000 (UTC) Received: by lbiz11 with SMTP id z11sf4714792lbi.2 for ; Fri, 20 Feb 2015 08:00:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-post:list-help :list-subscribe:mime-version:content-type:content-transfer-encoding :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=4/2Yjgdo+2Yrtn4tH+wSUowgvW+AQHiEQzuK6jb/pP4=; b=iIaIocDb3AXxg/5YPqpIWjrspcg1LoIh9H4lRVU+vGwi3fkDSz0Je2szi+bTA5ywIz YWUxmR9Us7hOWNGMsa8YJ8ah1mwpq1LqaTMmhusc8AnAkhYv/q2EIO+HnxnXeXyQ+wmR 2MC4ZBaeCbKir4iV5p87uDQelfQbrry15TWAuC57hDJ4AhcusBCJKdgf6W1XOM4JETTA VXHeqg1xyMSPwHPEG/IRrVoZqCyPOWMuGLJNMqwHLLbjR926AwMQtjn7Qkz0BynhE+2Q HU+eNwWTATBWMoUQawKiUi3yD+99IA1DR1emUiO7C+cbSW84wf5I9sBRtZPYcG6F/zcX JTZQ== X-Gm-Message-State: ALoCoQkuBzDp6EObZkey4ej74FiylIe3GFdXj+YuHaKq/LDj19wI6gmGBeVbiyMmtx9CxJVTw+L0 X-Received: by 10.112.50.106 with SMTP id b10mr1381710lbo.8.1424448046159; Fri, 20 Feb 2015 08:00:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.164.193 with SMTP id ys1ls303392lab.39.gmail; Fri, 20 Feb 2015 08:00:46 -0800 (PST) X-Received: by 10.152.3.42 with SMTP id 10mr9113488laz.84.1424448046007; Fri, 20 Feb 2015 08:00:46 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id rb6si17940202lbb.8.2015.02.20.08.00.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Feb 2015 08:00:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lamq1 with SMTP id q1so6967267lam.5 for ; Fri, 20 Feb 2015 08:00:45 -0800 (PST) X-Received: by 10.152.26.199 with SMTP id n7mr8966167lag.29.1424448045855; Fri, 20 Feb 2015 08:00:45 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1247324lbj; Fri, 20 Feb 2015 08:00:45 -0800 (PST) X-Received: by 10.141.23.208 with SMTP id z199mr15976666qhd.27.1424448044400; Fri, 20 Feb 2015 08:00:44 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 66si20078013qhf.47.2015.02.20.08.00.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Feb 2015 08:00:44 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YOpyp-0001rg-Mv; Fri, 20 Feb 2015 15:59:03 +0000 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: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id F4/65-02758-5C957E45; Fri, 20 Feb 2015 15:59:01 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-6.tower-206.messagelabs.com!1424447938!11033832!1 X-Originating-IP: [74.125.82.169] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12320 invoked from network); 20 Feb 2015 15:58:58 -0000 Received: from mail-we0-f169.google.com (HELO mail-we0-f169.google.com) (74.125.82.169) by server-6.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 20 Feb 2015 15:58:58 -0000 Received: by wesw62 with SMTP id w62so6358604wes.9 for ; Fri, 20 Feb 2015 07:58:57 -0800 (PST) X-Received: by 10.180.80.9 with SMTP id n9mr20860866wix.34.1424447937739; Fri, 20 Feb 2015 07:58:57 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id d10sm42618901wjn.45.2015.02.20.07.58.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Feb 2015 07:58:57 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 20 Feb 2015 15:58:28 +0000 Message-Id: <1424447908-8689-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 Cc: ian.jackson@eu.citrix.com, dgdegra@tycho.nsa.gov, Julien Grall , wei.liu2@citrix.com, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH] xen/xsm: Generate the permission in a spec-compliant way X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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" &&