linux: Support setting execution domain via linux personality

carry #3126

Co-authored-by: Aditya R <arajan@redhat.com>
Signed-off-by: Zheao.Li <me@manjusaka.me>
This commit is contained in:
Zheao.Li
2023-10-20 20:25:10 +08:00
parent edd00eb3cb
commit 98511bb40e
9 changed files with 129 additions and 1 deletions
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bats
load helpers
function setup() {
requires arch_x86_64
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "runc run personality for i686" {
update_config '
.process.args = ["/bin/sh", "-c", "uname -a"]
| .linux.personality = {
"domain": "LINUX32",
"flags": []
}'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "$output" == *"i686"* ]]
}
@test "runc run personality with exec for i686" {
update_config '
.linux.personality = {
"domain": "LINUX32",
}'
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]
runc exec test_busybox /bin/sh -c "uname -a"
[ "$status" -eq 0 ]
[[ "$output" == *"i686"* ]]
}
@test "runc run personality for x86_64" {
update_config '
.process.args = ["/bin/sh", "-c", "uname -a"]
| .linux.personality = {
"domain": "LINUX",
"flags": []
}'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "$output" == *"x86_64"* ]]
}
@test "runc run personality with exec for x86_64" {
update_config '
.linux.personality = {
"domain": "LINUX",
}'
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]
runc exec test_busybox /bin/sh -c "uname -a"
[ "$status" -eq 0 ]
[[ "$output" == *"x86_64"* ]]
}