-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lxd: enable security.syscalls.intercept.mknod if supported to allow snaps to create some device nodes #3218
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b06592c
tests: add a spread test to build a snap that uses mknod under LXD
jhenstridge bcc11e9
build_providers: create LXD containers with security.syscalls.interce…
jhenstridge 6cf0654
build_providers: only enable syscall interception if supported by kernel
jhenstridge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
summary: Verify LXD builds can make (some) device nodes | ||
|
||
systems: | ||
- -ubuntu-16.04* # kernel does not support syscall interception | ||
|
||
environment: | ||
SNAP_DIR: ../snaps/devices | ||
|
||
prepare: | | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
set_base "$SNAP_DIR/snap/snapcraft.yaml" | ||
|
||
restore: | | ||
cd "$SNAP_DIR" | ||
|
||
# Unset SNAPCRAFT_BUILD_ENVIRONMENT=host. | ||
unset SNAPCRAFT_BUILD_ENVIRONMENT | ||
|
||
snapcraft clean --use-lxd | ||
rm -f ./*.snap | ||
|
||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
restore_yaml "snap/snapcraft.yaml" | ||
|
||
execute: | | ||
cd "$SNAP_DIR" | ||
|
||
# Unset SNAPCRAFT_BUILD_ENVIRONMENT=host. | ||
unset SNAPCRAFT_BUILD_ENVIRONMENT | ||
|
||
snapcraft --use-lxd | ||
sudo snap install devices_*.snap --dangerous | ||
|
||
# Check that the snap includes the expected character device files | ||
[ -c /snap/devices/current/dev/null ] | ||
[ -c /snap/devices/current/dev/zero ] | ||
[ -c /snap/devices/current/dev/random ] | ||
[ -c /snap/devices/current/dev/urandom ] |
20 changes: 20 additions & 0 deletions
20
tests/spread/build-providers/snaps/devices/snap/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: devices | ||
version: '0.1' | ||
summary: Help verify (some) device files can be created in LXD builds | ||
description: ... | ||
|
||
grade: devel | ||
base: core18 | ||
confinement: strict | ||
|
||
parts: | ||
test: | ||
plugin: nil | ||
build-packages: | ||
- coreutils | ||
override-build: | | ||
mkdir -p $SNAPCRAFT_PART_INSTALL/dev | ||
mknod $SNAPCRAFT_PART_INSTALL/dev/null c 1 3 | ||
mknod $SNAPCRAFT_PART_INSTALL/dev/zero c 1 5 | ||
mknod $SNAPCRAFT_PART_INSTALL/dev/random c 1 8 | ||
mknod $SNAPCRAFT_PART_INSTALL/dev/urandom c 1 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL you can filter out systems :D