All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Eric Paris <eparis@redhat.com>,
	Daniel J Walsh <dwalsh@redhat.com>,
	pmoore@redhat.com, mgrepl@redhat.com
Cc: selinux@tycho.nsa.gov
Subject: Re: Strange AVC with latest rawhide kernel.
Date: Thu, 25 Feb 2016 14:47:32 -0500	[thread overview]
Message-ID: <56CF5A54.7020600@tycho.nsa.gov> (raw)
In-Reply-To: <1456429021.31341.34.camel@redhat.com>

On 02/25/2016 02:37 PM, Eric Paris wrote:
> You added a type bounds right before this broke...  Does the parent
> type have entrypoint? If not, maybe that's where it got stripped...

That would match the behavior he described (although he should get an 
audit message of the form op=security_compute_av reason=bounds.. in 
audit.log or dmesg in that case).  The kernel automatically reduces 
permissions as required by typebounds.  The corresponding logic never 
made its way into the libsepol compute_av code, so audit2why wouldn't 
know about it, and sesearch merely searches for TE rules; it doesn't do 
anything about typebounds.  We should probably update libsepol 
compute_av (for that, and eventually for xperms).

>
> -Eric
>
> On Thu, 2016-02-25 at 14:12 -0500, Stephen Smalley wrote:
>> On 02/25/2016 01:59 PM, Daniel J Walsh wrote:
>>>
>>> On Thu, 2016-02-25 at 13:18 -0500, Stephen Smalley wrote:
>>>>
>>>> On 02/25/2016 01:02 PM, Daniel J Walsh wrote:
>>>>>
>>>>>
>>>>> audit2allow -wla
>>>>> type=AVC msg=audit(1456422969.279:1434): avc:  denied  {
>>>>> entrypoint
>>>>> }
>>>>> for  pid=23847 comm="exe" path="/usr/bin/bash" dev="dm-2"
>>>>> ino=25165968
>>>>> scontext=system_u:system_r:svirt_lxc_net_t:s0:c337,c895
>>>>> tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c337,c895
>>>>> tclass=file permissive=0
>>>>> 	Was caused by:
>>>>> 		Unknown - would be allowed by active policy
>>>>> 		Possible mismatch between this policy and the
>>>>> one under
>>>>> which the audit message was generated.
>>>>>
>>>>> 		Possible mismatch between current in-memory
>>>>> boolean
>>>>> settings vs. permanent ones.
>>>>>
>>>>> When trying to run a docker container on Rawhide, I am seeing
>>>>> this
>>>>> AVC.
>>>>> The policy as audit2allow -w shows allows svirt_sandbox_file_t
>>>>> as
>>>>> an
>>>>> entrypoint for svirt_lxc_net_t.
>>>>>
>>>>> # sesearch -A -s svirt_lxc_net_t -t svirt_sandbox_file_t -c
>>>>> file -p
>>>>> entrypoint
>>>>> Found 1 semantic av rules:
>>>>>       allow svirt_sandbox_domain file_type : file entrypoint ;
>>>>>
>>>>> But when I run try to start the container, docker blocks the
>>>>> access.  I
>>>>> don't see any constraints that would block this, and don't
>>>>> think
>>>>> NO_NEW_PRIV is enabled any way, and I don't think it would be
>>>>> involved
>>>>> here.
>>>>>
>>>>> Any idea why SELinux is blocking the access?
>>>> Also, what does compute_av report for that (scontext, tcontext,
>>>> tclass)
>>>> triple?
>>>>
>>>>
>>> uname -r
>>> 4.5.0-0.rc5.git0.1.fc24.x86_64
>>>
>>> ./compute_av system_u:system_r:svirt_lxc_net_t:s0:c337,c895
>>> system_u:object_r:svirt_sandbox_file_t:s0:c337,c895 file
>>> allowed= { ioctl read write create getattr setattr lock relabelfrom
>>> relabelto append unlink link rename execute execute_no_trans
>>> execmod
>>> open }
>>> auditdeny { ioctl read write create setattr lock relabelfrom
>>> relabelto
>>> append unlink link rename execute swapon quotaon mounton
>>> execute_no_trans entrypoint execmod open audit_access 0xffc00000 }
>>>
>>> Looks like it is auditdeny, but I have no idea why.
>> No, auditdeny is fine (default is to audit all denials, so all-bits-
>> set,
>> even for undefined permissions).  The question is why isn't
>> entrypoint
>> listed in allowed - that shows that your kernel is indeed saying
>> that
>> entrypoint isn't allowed.
>>
>> Running the same kernel, with selinux-policy-3.13.1.171.fc24, when I
>> run
>> the same compute_av command as above, entrypoint is listed in
>> allowed
>> (in between execute_no_trans and execmod).  Your policy is what?
>>
>>
>

  reply	other threads:[~2016-02-25 19:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 18:02 Strange AVC with latest rawhide kernel Daniel J Walsh
2016-02-25 18:06 ` Stephen Smalley
2016-02-25 18:18 ` Stephen Smalley
2016-02-25 18:59   ` Daniel J Walsh
2016-02-25 19:12     ` Stephen Smalley
2016-02-25 19:36       ` Daniel J Walsh
2016-02-25 19:37       ` Eric Paris
2016-02-25 19:47         ` Stephen Smalley [this message]
2016-02-25 20:28           ` Daniel J Walsh
2016-02-25 20:54             ` Stephen Smalley
2016-02-26 12:54               ` Daniel J Walsh
2016-02-26 15:46                 ` Paul Moore
2016-02-26 15:49                   ` Stephen Smalley
2016-02-26 16:33                     ` Daniel J Walsh
2016-02-26 19:50                       ` James Carter
2016-02-26 20:30                         ` Daniel J Walsh
2016-02-29 16:27                           ` James Carter
2016-02-29 17:27                             ` Daniel J Walsh
2016-02-26 17:13                     ` Paul Moore
2016-02-26 19:41                       ` Daniel J Walsh
2016-02-26 16:31                   ` Daniel J Walsh
2016-02-26 17:15                     ` Paul Moore
2016-02-26 19:42                       ` Daniel J Walsh
2016-02-25 20:36           ` Daniel J Walsh
2016-02-29 10:10             ` Miroslav Grepl
2016-02-25 19:25   ` Daniel J Walsh
2016-02-25 19:05 ` 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=56CF5A54.7020600@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=dwalsh@redhat.com \
    --cc=eparis@redhat.com \
    --cc=mgrepl@redhat.com \
    --cc=pmoore@redhat.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.