All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: William Roberts <bill.c.roberts@gmail.com>,
	Paul Moore <paul@paul-moore.com>
Cc: linux-security-module@vger.kernel.org,
	"selinux@tycho.nsa.gov" <selinux@tycho.nsa.gov>,
	james.l.morris@oracle.com
Subject: Re: [PATCH 0/2] selinux: add targeted whitelisting of ioctl commands.
Date: Thu, 21 May 2015 08:34:23 -0400	[thread overview]
Message-ID: <555DD0CF.8070000@tycho.nsa.gov> (raw)
In-Reply-To: <CAFftDdqfcMGht2JWHzPcBUauD-7RTXio=aTHHNMUKcJPPNLeRg@mail.gmail.com>

On 05/20/2015 08:39 PM, William Roberts wrote:
> 
> 
> On Wed, May 20, 2015 at 1:04 PM, Paul Moore <paul@paul-moore.com
> <mailto:paul@paul-moore.com>> wrote:
> 
>     First off, my apologies for such a long delay in providing
>     feedback.  The
>     delay wasn't due to any fault of yours, rather just a backlog on my
>     todo list.
> 
>     Comments below ...
> 
>     On Thursday, April 09, 2015 02:48:50 PM Jeff Vander Stoep wrote:
>     > ---- motivation ----
>     > Ioctls provide many of the operations necessary for device
>     control. The
>     > typical driver supports a device specific set of operations
>     accessible by
>     > the ioctl system call and specified by the command argument. SELinux
>     > provides per operation access control to many system operations
>     e.g. chown,
>     > kill, setuid, ipc_lock, etc. Ioclts on the other hand are granted
>     on a per
>     > file descriptor basis using the ioctl permission, meaning that the
>     set of
>     > operations provided by the driver are granted on an all-or-nothing
>     basis.
> 
>     ...
> 
>     > ---- Design constraints ----
>     > Policy: Support existing policy, targeted whitelisting. The ioctls
>     commands
>     > used on a system may not be completely known to a
>     sysadmin/policywriter. It
>     > is not reasonable to enforce that all needed commands be known in
>     order to
>     > use this feature in a targeted manner. Existing policy using the ioctl
>     > permission will continue to work as-is. Policy targeting a specific
>     > source/target/class will only be enforced on that particular
>     > source/target/class. E.g. continue to allow init to access all ioctls
>     > provided by a driver, but only allow the browser to access a subset.
>     >
>     > Performance: Many ioctl calls are performance sensitive, and some
>     ioctls
>     > have a large command set (e.g. sockets support hundreds of commands).
>     > Execution time on a filtered ioctl should be similar to execution
>     time on
>     > an unfiltered one and not related to the number of commands being
>     filtered.
>     > Performance numbers will be included in a separate document.
>     >
>     > Command space: The ioctl command is a 32 bit number comprised of four
>     > fields, number - sequence number of the command. 8 bits
>     > type - magic number assigned to the driver. 8 bits
>     > size - size of the user data involved. typically 14 bits (arch
>     dependent)
>     > direction - The direction of data transfer. typically 2 bits (arch
>     > dependent) The command is uniquely identified by the type and
>     number, size
>     > and direction are considered to be arguments and are not
>     considered for
>     > SELinux whitelisting.
>     >
>     > ---- Policy format ----
>     > allow <source> <target>:<class> { 0x8910-0x8926 0x892A-0x8935 }
>     > auditallow <source> <target>:<class> 0x892A
> 
>     I agree with only specifying the lower 16 bits (command,type) when
>     specifying
>     the individual ioctls, I even like the '-' shortcut, but I'm a little
>     concerned about specifying a number directly in the permission field
>     without
>     any sort of qualifier.  Specifically I'm worried that it hurts the
>     readability
>     of the policy and could pose problems with future work.
> 
>     I'd be much happier if we could add some sort of syntax which would
>     qualify
>     the numbers as ioctls, for example:
> 
>       allow <source> <target>:<class> { ioctl(0x8910-0x8926) ioctl(0x892A) }
> 
> 
> If you want additional syntax couldn't we move that burden to m4 rather
> then making it a part of the compiler core?

It has to be handled by checkpolicy and encoded in the kernel binary
policy as an additional field if we want to support other uses of these
operation structures for purposes other than just ioctl.

  parent reply	other threads:[~2015-05-21 12:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 21:48 [PATCH 0/2] selinux: add targeted whitelisting of ioctl commands Jeff Vander Stoep
2015-04-09 23:03 ` Jeffrey Vander Stoep
2015-04-22 22:18   ` Jeffrey Vander Stoep
2015-04-23 22:28 ` Paul Moore
2015-04-24 15:02   ` Jeffrey Vander Stoep
2015-05-20 20:04 ` Paul Moore
2015-05-20 21:56   ` Jeffrey Vander Stoep
2015-05-21  0:39   ` William Roberts
2015-05-21  2:08     ` Joshua Brindle
2015-05-21  4:17       ` Jeffrey Vander Stoep
2015-05-21 11:21         ` Paul Moore
2015-05-21 13:35           ` Joshua Brindle
2015-05-21 14:10             ` Paul Moore
2015-05-21 14:16               ` Joshua Brindle
2015-05-21 14:19                 ` Paul Moore
2015-05-21 14:23                   ` Joshua Brindle
2015-05-21 14:37                     ` Paul Moore
2015-05-21 14:41                       ` Joshua Brindle
2015-05-21 14:44         ` William Roberts
2015-05-21 14:53           ` Joshua Brindle
2015-05-21 14:56             ` William Roberts
2015-05-21 14:57               ` Joshua Brindle
2015-05-21 15:09                 ` Stephen Smalley
2015-05-21 15:27                   ` Joshua Brindle
2015-05-21 18:05                     ` Jeffrey Vander Stoep
2015-05-22 18:12                       ` Paul Moore
2015-05-21 12:37       ` Stephen Smalley
2015-05-21 12:34     ` Stephen Smalley [this message]
2015-05-21 13:43       ` James Carter
2015-05-21 13:50         ` Stephen Smalley
2015-05-21 13:54           ` Stephen Smalley
2015-05-21 14:04             ` Paul Moore
2015-05-21 14:10               ` James Carter
2015-05-21 14:11                 ` Stephen Smalley
2015-05-21 14:13                 ` Paul Moore
2015-05-21 14:14               ` Joshua Brindle

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=555DD0CF.8070000@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=bill.c.roberts@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=selinux@tycho.nsa.gov \
    /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.