child Cx transition to grandchild transition silently fails, and child Px to sibling transition silently fails

Bug #1045081 reported by Jamie Strandboge
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apparmor (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

I noticed that apparmor does not transition from a child to a grandchild. Eg:

/tmp/foo {
  /tmp/bar Cx -> bar, # works

  profile bar {
    /tmp/baz Cx -> baz, # does not work

    profile baz {
    }
  }
}

The following child to a sibling also fails:
/tmp/foo {
  /tmp/bar Cx -> bar, # works

  profile bar {
    /tmp/baz Px -> baz, # does not work
  }
  profile baz {
  }
}

Attached is a tarball that shows how transitions work for ix, px, px to an uncle, px to a sibling, and cx to a grandchild. Run it with:
$ tar -zxf ./apparmor.tar.gz
$ cd ./apparmor
$ ./poc.sh
= profile-ix =
start
foo
bar
baz
pass

= profile-px =
start
foo
bar
baz
pass

= profile-px-sibling =
start
foo
/tmp/bug/bar: /tmp/bug/baz: /bin/sh: bad interpreter: No such file or directory
FAIL

= profile-px-uncle =
start
foo
bar
baz
pass

= profile-cx-grandchild =
apparmor_parser: Unable to replace "baz". Profile doesn't exist
start
foo
/tmp/bug/bar: /tmp/bug/baz: /bin/sh: bad interpreter: No such file or directory
FAIL

Cleaning up
  removing profile-cx-grandchild
  removing profile-ix
  removing profile-px
  removing profile-px-sibling
  removing profile-px-uncle
[1]
$

Also, these transitions fail silently (both at compile and runtime), which might be related to bug #1045074

Tags: aa-parser
Revision history for this message
Jamie Strandboge (jdstrand) wrote :
summary: child Cx transition to grandchild transition silently fails, and child
- Px to sibling transition fails
+ Px to sibling transition silently fails
description: updated
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

1042771 might be related.

Changed in apparmor (Ubuntu):
assignee: nobody → John Johansen (jjohansen)
Revision history for this message
John Johansen (jjohansen) wrote :
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Per IRC, sibling profiles are not yet supported (though one can use /tmp/baz Px -> /tmp/foo//baz). Grand children are only supported in the kernel.

Changed in apparmor (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
John Johansen (jjohansen) wrote :

The apparmor userspace does not currently properly support grand children profiles and sibling transitions
  px is a namespace relative transition
  cx is a child transition

  a sibling transition can be currently be done manually by providing the fully quallified profile path, for the bug example that would require being reworked as

  /tmp/foo {
      /tmp/bar Cx -> bar, # works

      profile bar {
          /tmp/baz Px -> /tmp/foo//baz, # does not work
      }
      profile baz {
      }
  }

this example failed because Px -> baz was trying to transition to a sibling of /tmp/foo (namespace relative) not a sibling of profile bar. Changing the Px to use /tmp/foo//baz clarifies that baz is a child of /tmp/foo

The compiler should be warning when transitions to non-existent profiles are used.

Marking this a wish list bug because it is going to require extension to support siblings transitions, grand children, and interprofile analysis none of which are currently supported. Note: the language has been speced to support these but the user space tools do not yet.

The failure to log the failed transition is covered by Bug #1045074

Changed in apparmor (Ubuntu):
assignee: John Johansen (jjohansen) → nobody
tags: added: aa-parser
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.