All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Julien Grall <julien.grall@linaro.org>, xen-devel@lists.xenproject.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, ian.campbell@citrix.com
Subject: Re: [PATCH] xen/xsm: Generate the permission in a spec-compliant way
Date: Fri, 20 Feb 2015 18:01:00 -0500	[thread overview]
Message-ID: <54E7BCAC.5000806@tycho.nsa.gov> (raw)
In-Reply-To: <1424447908-8689-1-git-send-email-julien.grall@linaro.org>

On 02/20/2015 10:58 AM, Julien Grall wrote:
> 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 <julien.grall@linaro.org>

The fix looks correct.  For backporting: this is only a problem since the
auto-generation was moved into the hypervisor build (between 4.2 and 4.3).
Prior to this, the headers were manually generated, and apparently nobody
ran the script on a system with this bug - in part because nobody ran

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Wow, that's quite an annoying bug.  Thankfully, it's more likely to make a
broken system than an insecure one, since doing an access check on the
permission 0x7fffffff will result in checking for access to all 31 other
permissions instead of the one you intended to check for.  For Xen, it
looks like this is unlikely to succeed, and also won't do something like
prevent the system from booting:

class xen: setscheduler would check kexec & others

class domain: set_virq_handler would check transition & destroy
  - in the example policy, transition is only allowed for *_building -> *
  - in any other policy, transition is unlikely to be allowed at the same
    time as destroy

There are no other uses of permission bit 32.

-- 
Daniel De Graaf
National Security Agency

  reply	other threads:[~2015-02-20 23:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 15:58 [PATCH] xen/xsm: Generate the permission in a spec-compliant way Julien Grall
2015-02-20 23:01 ` Daniel De Graaf [this message]
2015-02-23  9:44   ` Ian Campbell
2015-02-23 15:04   ` Julien Grall
2015-02-23 16:11     ` Daniel De Graaf
2015-02-24 16:45   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E7BCAC.5000806@tycho.nsa.gov \
    --to=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.