All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Paul Moore <paul@paul-moore.com>, Jeff Vander Stoep <jeffv@google.com>
Cc: linux-security-module@vger.kernel.org, james.l.morris@oracle.com,
	selinux@tycho.nsa.gov
Subject: Re: [PATCH 2/2 v4] SELinux: per-command whitelisting of ioctls
Date: Thu, 21 May 2015 08:33:21 -0400	[thread overview]
Message-ID: <555DD091.8060307@tycho.nsa.gov> (raw)
In-Reply-To: <3147722.RboehMiu35@sifl>

On 05/20/2015 05:22 PM, Paul Moore wrote:
>> @@ -64,6 +66,16 @@ struct avc_cache {
>>  	u32			latest_notif;	/* latest revocation notification */
>>  };
>>
>> +struct avc_operation_decision_node {
>> +	struct operation_decision od;
>> +	struct list_head od_list;
>> +};
> 
> Making this more generic may mean adding an extra field here to specify the 
> type of extension, e.g. ioctl commands.
> 
>> +struct avc_operation_node {
>> +	struct operation ops;
>> +	struct list_head od_head; /* list of operation_decision_node */
>> +};
> 
> As mentioned earlier, I think "operation" needs a name change; I tend to like 
> "extop" better, e.g. "avc_extop_decision_node" and "avc_extop_node".  Feel 
> free to suggest others.
> 
> The "operation" struct is named poorly as well; even if we stick with 
> "operation" elsewhere we really need to name this one better, it's way too 
> generic.

Don't want to bikeshed here, but I think "operation" is more readable
then "extop" (not evident what that means or even whether it is supposed
to be read as "ex-top" or "ext-op" or what).  "operation" at least is
meaningful and is a suitable generalization of "ioctl command".

>> @@ -429,11 +456,15 @@ int avtab_read_item(struct avtab *a, void *fp, struct
>> policydb *pol, printk(KERN_ERR "SELinux: avtab: entry has both access
>> vectors and types\n"); return -EINVAL;
>>  		}
>> +		if (val & AVTAB_OP) {
>> +			printk(KERN_ERR "SELinux: avtab: entry has operations\n");
>> +			return -EINVAL;
>> +		}
> 
> Another "operations" vs. "extop" or similar.  If we generalize, it would also 
> be nice to know what kind of extended operations, e.g. ioctl commands.
> 
> Further, beyond the extension type (ioctl), I think it would be nice to 
> include a size value in the binary policy.  With the current ioctl code it 
> would be 8/256, but we might want to make this variable in the future and it 
> would be nice not to have to bump the policy format again.

Not sure we can avoid changing the format version again regardless.
Note that we didn't even strictly need to increment the version this
time, as the new structure is only included in the binary policy if one
of the newly defined AVTAB_OP flag bits is set for the entry, but it was
still useful to define a new version so that userspace can tell whether
the kernel supports the extension and decide how to handle it if the
policy defined these operations but the kernel doesn't support enforcing
them. The same would be true of any future extension that used this
facility.

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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:56 [PATCH 2/2 v4] SELinux: per-command whitelisting of ioctls Jeff Vander Stoep
2015-04-29 20:00 ` Nick Kralevich
2015-04-29 20:21 ` Stephen Smalley
2015-05-20 21:22 ` Paul Moore
2015-05-21 12:33   ` Stephen Smalley [this message]
2015-05-21 14:11     ` Paul Moore
2015-05-21 14:16     ` Paul Moore
2015-05-21 14:22       ` Stephen Smalley
2015-05-21 14:39         ` Paul Moore
2015-05-21 15:14           ` Jeffrey Vander Stoep
2015-05-22 18:03             ` Paul Moore
2015-06-03 18:40               ` Jeffrey Vander Stoep
2015-06-03 21:01                 ` Paul Moore
2015-06-09 17:36                   ` Nick Kralevich
2015-06-09 18:45                     ` Paul Moore

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=555DD091.8060307@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=james.l.morris@oracle.com \
    --cc=jeffv@google.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.