All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Andrew Perepechko <anserper@ya.ru>
Cc: linux-security-module@vger.kernel.org,
	andrew.perepechko@seagate.com, selinux@tycho.nsa.gov
Subject: Re: [PATCH] selinux: export validatetrans decisions
Date: Tue, 27 Oct 2015 14:46:29 -0400	[thread overview]
Message-ID: <562FC685.503@tycho.nsa.gov> (raw)
In-Reply-To: <3826370.MZ6nvm2ybe@panda-pc>

On 10/27/2015 02:27 PM, Andrew Perepechko wrote:
>>> +	if (rc)
>>> +		goto out;
>>> +
>>> +	rc = -ENOMEM;
>>> +	if (count >= PAGE_SIZE - 1)
>>> +		goto out;
>>
>> Why PAGE_SIZE-1?
>>
>
> This is to avoid allocation of more than a single page.

Yes, but you don't need PAGE_SIZE - 1 for that.  The check can just be 
 >= PAGE_SIZE, as used elsewhere in selinuxfs.c.

> kzalloc(count+1) will guarantee the string is zero-terminated.
>
> The code below can be slightly optimized by modifying the
> copied string in-place, but I tried to follow the style
> used in neighbouring functions.
>
>>
>> #next has security_context_str_to_sid() as a convenient helper for this.
>>
>
> OK.
>
>>
>> Hmm...in what situation don't you want it to reflect the kernel
>> enforcing mode (i.e. when won't you just have your userspace file server
>> end up checking security_getenforce() and ignore the error in that
>> situation)?  Userspace AVC is different since it is caching decisions
>> from the kernel but still ends up honoring the kernel's enforcing status
>> (unless you explicitly set it to use its own private one).
>
> We expected to have an option to be able to enforce the policy even
> if the server itself is running in permissive, but this is not a critical
> requirement, so I'll update this bit.
>
>>
>> Beyond that, the things that you don't want to happen when called from
>> userspace include not unmapping the class value and not printk'ing on an
>> unrecognized class.  See security_transition_sid_user() ->
>> security_compute_sid() for example.
>>
>
> Sorry, you are right, indeed. :( This part somehow did not get in the final
> patch.
>
> I'll update the patch according to your comments.

  reply	other threads:[~2015-10-27 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 17:07 [PATCH] selinux: export validatetrans decisions Andrew Perepechko
2015-10-27 18:15 ` Stephen Smalley
2015-10-27 18:27   ` Andrew Perepechko
2015-10-27 18:46     ` Stephen Smalley [this message]
2015-10-27 19:25       ` Andrew Perepechko
2015-10-27 19:33         ` Andrew Perepechko

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=562FC685.503@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=andrew.perepechko@seagate.com \
    --cc=anserper@ya.ru \
    --cc=linux-security-module@vger.kernel.org \
    --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.