Merge lp:~lool/unity8/unity8-setcap into lp:unity8

Proposed by Loïc Minier
Status: Merged
Approved by: Michał Sawicz
Approved revision: 464
Merged at revision: 464
Proposed branch: lp:~lool/unity8/unity8-setcap
Merge into: lp:unity8
Diff against target: 58 lines (+35/-0)
3 files modified
data/unity8-setcap.conf (+32/-0)
debian/control (+2/-0)
debian/unity8.install (+1/-0)
To merge this branch: bzr merge lp:~lool/unity8/unity8-setcap
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michał Sawicz Approve
Review via email: mp+191191@code.launchpad.net

Commit message

Add upstart job to copy unity8 to a new tmpfs, setcap it, and bind-mount it back; this is an ugly hack to set CAP_SYS_RESOURCE until we have a root-helper for it.

Description of the change

Add upstart job to copy unity8 to a new tmpfs, setcap it, and bind-mount it back; this is an ugly hack to set CAP_SYS_RESOURCE until we have a root-helper for it.

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

Ohkay... if we have to... :/

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:464
http://jenkins.qa.ubuntu.com/job/unity8-ci/1412/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5017
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2943
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/435
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1412
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1412/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1411
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1186
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/892
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/892/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2945
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2945/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2452
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2495

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1412/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/unity8-setcap.conf'
2--- data/unity8-setcap.conf 1970-01-01 00:00:00 +0000
3+++ data/unity8-setcap.conf 2013-10-15 14:16:12 +0000
4@@ -0,0 +1,32 @@
5+# unity8-setcap - ugly hacks to arrange for /usr/bin/unity8 to have CAP_SYS_RESOURCE
6+
7+# XXX replace me with some root-helper to gain CAP_SYS_RESOURCE XXX
8+
9+author "Loïc Minier <loic.minier@ubuntu.com>"
10+description "Ugly hacks to arrange for /usr/bin/unity8 to have CAP_SYS_RESOURCE"
11+
12+# start when first boot-hooks event is emitted and before lightdm (lightdm
13+# starts ubuntu-touch-session which starts unity8); note that /run is
14+# guaranteeds to be be there because lightdm starts on filesystem
15+start on boot-hooks and starting lightdm
16+
17+# NOT a task as otherwise this would block restarting lightdm
18+
19+env RUNDIR=/run/unity8-setcap
20+
21+# work needs to be done in pre-start as this really is a job with nothing to
22+# start
23+pre-start script
24+ if [ ! -e "$RUNDIR" ]; then
25+ mkdir "$RUNDIR"
26+ # /run is noexec, hence mounting another tmpfs exec
27+ # NB: unity8 is 35K; 512K should be enough for everyone
28+ mount -o rw,nosuid,nodev,exec,relatime,mode=755,size=512k -t tmpfs tmpfs "$RUNDIR"
29+ cp -a /usr/bin/unity8 "$RUNDIR"
30+ setcap CAP_SYS_RESOURCE=+ep "$RUNDIR/unity8"
31+ # bind-mount this back as unity8 checks dirname(argv[0]'s) == /usr to
32+ # decide whether it's installed or not
33+ mount --bind "$RUNDIR/unity8" /usr/bin/unity8
34+ fi
35+end script
36+
37
38=== modified file 'debian/control'
39--- debian/control 2013-10-14 23:17:21 +0000
40+++ debian/control 2013-10-15 14:16:12 +0000
41@@ -78,6 +78,8 @@
42 unity8-fake-env | qtubuntu-shell,
43 unity8-private (= ${binary:Version}),
44 unity8-private | unity-launcher-impl,
45+# for setcap:
46+ libcap2-bin,
47 ${misc:Depends},
48 ${shlibs:Depends},
49 Recommends: ${unity-default-masterscopes},
50
51=== modified file 'debian/unity8.install'
52--- debian/unity8.install 2013-10-14 08:31:39 +0000
53+++ debian/unity8.install 2013-10-15 14:16:12 +0000
54@@ -14,3 +14,4 @@
55 usr/share/unity8/SideStage
56 usr/share/unity8/graphics
57 data/unity8.conf usr/share/upstart/sessions/
58+data/unity8-setcap.conf etc/init/boot-hooks/

Subscribers

People subscribed via source and target branches