Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
snap-seccomp: link libseccomp statically to snap-seccomp #3579
Conversation
jdstrand
reviewed
Jul 11, 2017
Assuming this fixes the issues, +1 (this approach was discussed in the forum)
codecov-io
commented
Jul 11, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3579 +/- ##
==========================================
- Coverage 76.82% 76.82% -0.01%
==========================================
Files 379 379
Lines 26314 26314
==========================================
- Hits 20216 20215 -1
Misses 4304 4304
- Partials 1794 1795 +1
Continue to review full report at Codecov.
|
zyga
reviewed
Jul 11, 2017
Just one comment, +1 on the idea, may need 0.001 adjustments.
| @@ -19,6 +19,10 @@ | ||
| package main | ||
| +//#cgo pkg-config: --static --libs libseccomp |
zyga
Jul 11, 2017
Contributor
Ironically this is incorrect as you'd actually link with libseccomp dynamically. This outputs -lseccomp which is added to the compiler. The line below hard-codes that same (effective) library between two linker options that switch link mode. I think we should drop the pkg-config line and just keep the LDFLAGS line below.
I'll test this locally and push if you agree.
| @@ -21,7 +21,7 @@ Build-Depends: autoconf, | ||
| init-system-helpers, | ||
| libapparmor-dev, | ||
| libglib2.0-dev, | ||
| - libseccomp-dev (>= 2.1.1-1ubuntu1~trusty3), | ||
| + libseccomp-dev (>= 2.1.1-1ubuntu1~trusty4), |
mvo5
Jul 11, 2017
Collaborator
libseccomp-dev in trusty does not have a static library. I added it for trusty and uploaded a new SRU to unblock this, see https://launchpad.net/ubuntu/+source/libseccomp/2.1.1-1ubuntu1~trusty4
niemeyer
approved these changes
Jul 11, 2017
Looks good-enough to me. Ideally we'll embed the specific bits of libseccomp that we need into the binary proper, as we discussed, but if this works we can push it forward for now and figure the embedding later.
| echo "Install test-snapd-tools and verify it works" | ||
| snap install test-snapd-tools | ||
| test-snapd-tools.echo hello | MATCH hello | ||
| + # FIXME: use dirs.sh in 2.27+ | ||
| + echo "Ensure snap-seccomp is statically linked" | ||
| + if ldd /usr/lib/snapd/snap-seccomp | MATCH libseccomp ; then |
mvo5 commentedJul 11, 2017
This ensures we do not run into library version mismatches when
snap-seccomp is run from the core snap.
This also needs to be pushed to the release/2.26 branch