Change in kernel exec transition behavior causes regression tests to fail

Bug #1628745 reported by Tyler Hicks on 2016-09-29
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
AppArmor
Low
Tyler Hicks
apparmor (Ubuntu)
Low
Tyler Hicks
Xenial
Undecided
Unassigned

Bug Description

[Impact]

 * The exec_stack.sh regression test fails due to a behavior change in 4.8 kernels from this patch:

   commit 9f834ec18defc369d73ccf9e87a2790bfa05bf46
   Author: Linus Torvalds <email address hidden>
   Date: Mon Aug 22 16:41:46 2016 -0700

       binfmt_elf: switch to new creds when switching to new mm

 * Adjusting the regression tests appropriately allows the kernel and security teams to use QRT's test-apparmor.py to test kernel and userspace AppArmor changes with confidence

[Test Case]

$ apt-get source apparmor # make sure this fetches the new apparmor source
$ sudo apt-get install libapparmor-dev
$ cd tests/regression/apparmor
$ make USE_SYSTEM=1
$ sudo bash exec_stack.sh
running exec_stack
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 608 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - file)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 610 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - otherfile)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 612 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - thirdfile)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 613 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - sharedfile)' was expected to 'pass'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 620 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - okcon)' was expected to 'pass'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 628 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - bad label)' was expected to 'fail'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 634 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (2 stacked - bad mode)' was expected to 'fail'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 741 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - file)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 745 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - otherfile)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 747 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - thirdfile)' was expected to 'fail'. Reason for failure expect errno 13 != 139
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 748 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - sharedfile)' was expected to 'pass'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 754 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - okcon)' was expected to 'pass'. Reason for failure 'killed by signal 11'
/tmp/testlibRpZj1Y/source/yakkety/apparmor-2.10.95/tests/regression/apparmor/prologue.inc: line 219: 833 Segmentation fault $testexec "$@" > $outfile 2>&1
Error: transition failed. Test 'EXEC_STACK (3 stacked - old AA WARN)' was expected to 'pass'. Reason for failure 'killed by signal 11'

The previous command should result in no output and return value of 0 once the regression test is properly updated.

[Regression Potential]

 * This is an extremely low risk change since it only touches regression testing code that is not user-facing.

[Other]

* Fixed in upstream lp:apparmor tree:

  https://bazaar.launchpad.net/~apparmor-dev/apparmor/master/revision/3509

Tyler Hicks (tyhicks) on 2016-09-29
description: updated
Changed in apparmor:
status: New → Fix Committed
importance: Undecided → Low
assignee: nobody → Tyler Hicks (tyhicks)
milestone: none → 2.11
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apparmor - 2.10.95-4ubuntu5

---------------
apparmor (2.10.95-4ubuntu5) yakkety; urgency=medium

  * debian/lib/apparmor/functions, debian/apparmor.init,
    debian/apparmor.service, debian/apparmor.upstart,
    debian/lib/apparmor/profile-load: Adjust the checks that previously kept
    AppArmor policy from being loaded while booting a container. Now we
    attempt to load policy if we're in a LXD or LXC managed container that is
    using profile stacking inside of a policy namespace. (LP: #1628285)
  * Fix regression tests so that the kernel SRU process is not interrupted by
    failing tests
    - debian/patches/r3505-tests-fix-stacking-mode-checks.patch: Fix the
      stackonexec.sh and stackprofile.sh tests (LP: #1628295)
    - debian/patches/r3509-tests-fix-exec_stack-errors.patch: Fix the
      exec_stack.sh test (LP: #1628745)

 -- Tyler Hicks <email address hidden> Thu, 29 Sep 2016 00:38:47 -0500

Changed in apparmor (Ubuntu):
status: In Progress → Fix Released
Tyler Hicks (tyhicks) on 2016-10-07
description: updated

Hello Tyler, or anyone else affected,

Accepted apparmor into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apparmor/2.10.95-0ubuntu2.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in apparmor (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed
Tyler Hicks (tyhicks) wrote :

I've completed the AppArmor test plan:

  https://wiki.ubuntu.com/Process/Merges/TestPlans/AppArmor

I've also manually verified the AppArmor portion of this SRU with the kernel currently in xenial-updates (4.4.0-45.66) and the kernel in xenial-proposed (4.4.0-46.67), which contains a number of AppArmor changes.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apparmor - 2.10.95-0ubuntu2.5

---------------
apparmor (2.10.95-0ubuntu2.5) xenial; urgency=medium

  * debian/lib/apparmor/functions, debian/apparmor.init,
    debian/apparmor.service, debian/apparmor.upstart,
    debian/lib/apparmor/profile-load: Adjust the checks that previously kept
    AppArmor policy from being loaded while booting a container. Now we
    attempt to load policy if we're in a LXD or LXC managed container that is
    using profile stacking inside of a policy namespace. (LP: #1628285)
  * Fix regression tests for stacking so that the kernel SRU process is not
    interrupted by failing tests whenever the AppArmor stacking features are
    backported from the 16.10 kernel or when the 16.04 LTS Enablement Stack
    receives a 4.8 or newer kernel
    - debian/patches/r3509-tests-fix-exec_stack-errors-1.patch: Fix the
      exec_stack.sh test when running on 4.8 or newer kernels (LP: #1628745)
    - debian/patches/r3558-tests-fix-exec_stack-errors-2.patch: Adjust the
      exec_stack.sh fix mentioned above to more accurately test kernels older
      than 4.8 (LP: #1630069)
    - debian/patches/allow-stacking-tests-to-use-system.patch: Apply this
      patch earlier in the series, as to match when it was committed upstream,
      so that the above two patches can be cherry-picked from lp:apparmor

 -- Tyler Hicks <email address hidden> Fri, 07 Oct 2016 05:21:44 +0000

Changed in apparmor (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for apparmor has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Christian Boltz (cboltz) on 2017-01-10
Changed in apparmor:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers