Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
add compatibility architectures for supported architectures (LP: #1592022) #181
Conversation
jdstrand
added some commits
Nov 10, 2016
|
The testsuite failure is unrelated: 2016/11/14 16:38:24 Cannot allocate linode:ubuntu-16.04-64-grub: authentication failed |
|
Ok, added spread test but I can't test it. Sending up to linode or qemu locally results in an issue unrelated to this patch:
|
|
I've fixed the packaging tree to allow testing now. I'll ensure this is green and land it. |
|
This now correctly passes tests in linode |
| @@ -500,6 +501,71 @@ static void preprocess_filter(FILE * f, struct preprocess *p) | ||
| return; | ||
| } | ||
| +uint32_t get_hostarch(void) |
zyga
Nov 18, 2016
Collaborator
This should be static IMHO, I'll add a quick patch that corrects this.
| + if (uname(&uts) < 0) | ||
| + die("uname() failed"); | ||
| + | ||
| + if (strcmp(uts.machine, "i686") == 0) |
zyga
Nov 18, 2016
Collaborator
This block can be a small dedicated function that could be unit tested for sanity. I can gladly patch this.
jdstrand
Nov 18, 2016
Contributor
If you are keen on doing this, you have my blessing. If you want me to do it, I can look at it next week (I'm working on something else atm).
| + } else | ||
| + compat_arch = host_arch; | ||
| + | ||
| + if (compat_arch > 0 && seccomp_arch_exist(ctx, compat_arch) == -EEXIST) { |
jdstrand
Nov 18, 2016
Contributor
To expand on that, SCMP_ARCH_NATIVE is 0 and the others are >0. We don't ever set compat_arch to SCMP_ARCH_NATIVE because the SCMP_ARCH_NATIVE is there by default.
zyga
approved these changes
Nov 18, 2016
Looks good, I'll merge it and update with a few unit tests.
jdstrand commentedNov 10, 2016
Add get_hostarch() (inspired by lxc codebase) to determine the host (kernel) architecture. For architectures that support it, then add the compatibility arch using seccomp_arch_add(). Account for 64 bit kernel/userspace, 32 bit kernel/usespace and 64 bit kernel with 32 bit userspace. When syscalls are
added later, they will be added for each added architecture. Eg: