All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: omosnace@redhat.com
Cc: selinux@vger.kernel.org, Stephen Smalley <sds@tycho.nsa.gov>,
	selinux@tycho.nsa.gov, danielj@mellanox.com, eli@mellanox.com,
	James Morris <jmorris@namei.org>,
	dledford@redhat.com, stable@vger.kernel.org
Subject: Re: [PATCH v6] selinux: policydb - fix byte order and alignment issues
Date: Mon, 5 Nov 2018 15:33:24 -0500	[thread overview]
Message-ID: <CAHC9VhRPuH3qdwOPstMNqwsmiua=avqTHdkm-YdU-8cbbjwHiQ@mail.gmail.com> (raw)
In-Reply-To: <20181023070217.17015-1-omosnace@redhat.com>

On Tue, Oct 23, 2018 at 3:02 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> Do the LE conversions before doing the Infiniband-related range checks.
> The incorrect checks are otherwise causing a failure to load any policy
> with an ibendportcon rule on BE systems. This can be reproduced by
> running (on e.g. ppc64):
>
> cat >my_module.cil <<EOF
> (type test_ibendport_t)
> (roletype object_r test_ibendport_t)
> (ibendportcon mlx4_0 1 (system_u object_r test_ibendport_t ((s0) (s0))))
> EOF
> semodule -i my_module.cil
>
> Also, fix loading/storing the 64-bit subnet prefix for OCON_IBPKEY to
> use a correctly aligned buffer.
>
> Finally, do not use the 'nodebuf' (u32) buffer where 'buf' (__le32)
> should be used instead.
>
> Tested internally on a ppc64 machine with a RHEL 7 kernel with this
> patch applied.
>
> Cc: Daniel Jurgens <danielj@mellanox.com>
> Cc: Eli Cohen <eli@mellanox.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: <stable@vger.kernel.org> # 4.13+
> Fixes: a806f7a1616f ("selinux: Create policydb version for Infiniband support")
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  security/selinux/ss/policydb.c | 51 ++++++++++++++++++++++++----------
>  1 file changed, 36 insertions(+), 15 deletions(-)
>
> Changes in v6:
>  - use U8_MAX as the limit for ibendport.port value to emphasize that it
>    is an 8-bit value
>
> Changes in v5:
>  - defer also assignment to 8-bit ibendport.port
>
> Changes in v4:
>  - defer assignment to 16-bit struct fields to after the range check
>
> Changes in v3:
>  - use separate buffer for the 64-bit subnet_prefix
>  - add comments on the byte ordering of subnet_prefix
>  - deduplicate the le32_to_cpu() calls from checks
>
> Changes in v2:
>  - add reproducer to commit message
>  - update e-mail address of James Morris
>  - better Cc also the old SELinux ML

You know what they say: sixth time is the charm :)

Merged into selinux/next, thanks all.

-- 
paul moore
www.paul-moore.com

      parent reply	other threads:[~2018-11-05 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  7:02 [PATCH v6] selinux: policydb - fix byte order and alignment issues Ondrej Mosnacek
2018-10-23 14:01 ` Stephen Smalley
2018-11-05 20:33 ` Paul Moore [this message]

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='CAHC9VhRPuH3qdwOPstMNqwsmiua=avqTHdkm-YdU-8cbbjwHiQ@mail.gmail.com' \
    --to=paul@paul-moore.com \
    --cc=danielj@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=eli@mellanox.com \
    --cc=jmorris@namei.org \
    --cc=omosnace@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=stable@vger.kernel.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.