-
Notifications
You must be signed in to change notification settings - Fork 273
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
nsjail/kafel for other architectures #52
Comments
Hm.. the whole syscall table is architecture-specific, I don't think these should be ignored, but simply added to the array?
Or, am I misunderstanding here? If you did mips syscall table on the basis of aarch64 or some other syscall table, then the way to go is to simply add them (at the end, or sorted, I guess it doesn't matter). We don't have any canonical syscall tables. |
I was (still am) a bit confused about few differences between naming in this table and the one used in the nsjail. Which one is correct ? or does it even matter!? |
I just noticed that my method will not work as the size of input arguments for the same syscall is different in different architectures:
accept4 in amd64_syscall.c
I also noticed that some syscalls that are available on all architecture are missing in kafel such as statx and pkey_mprotect. Please take a look at this: https://fedora.juszkiewicz.com.pl/syscalls.html |
Here's import for aarch64 - google/kafel@2ae8e11 But generally, yes, argument sizes might be different between architectures - but generally the same for the same size of bitness, so it should be technically ok to use existing arm template for mips32 syscalls, and aarch64 template for mips64 sysacalls. The argument sizes are typically the same (e.g. integers, masks), just things like addresses have different bitness. |
In other words, if you're trying to create syscall table for mips32, please use arm_syscall template, if for mips64 please try to use aarch64 template. Then please try to remove syscalls which are not present in mips, and add syscalls which are specific to mips. |
The number of undefined syscalls in the templates are high. I should think about a better solution to generate this list!
|
What about manually checking (at least some rudumentaty check) with https://github.com/torvalds/linux/blob/master/arch/mips/kernel/scall64-64.S and https://github.com/torvalds/linux/blob/master/arch/mips/kernel/scall32-o32.S Given that we don't have tables for mips yet, I think we could marge your tables as-is, given that it passes this rudimentary/manual check (total number of syscalls, a few examples of syscalls and their numbers in your table), and fix any eventual problems later on? |
I cleaned up my code here and did a quick check to make sure that syscall numbers match with the links you provided. Please take a look at the result |
I'm trying to cross compile nsjail for running it on OpenWRT/LEDE and I ended up with unsupported architecture error from Kafel:
https://travis-ci.org/openwrt/packages/builds/282223552#L2385
I found this instructive commit by @rlc2 for adding a new architecture to kafel:
google/kafel@47cfef4
I tried to follow a similar method by creating a template with all (possible) syscall prototypes with the TEMPLATE_NUM as the placeholder for the syscall number. I fixed names for few syscalls by finding the variation of the syscall name in other architecture and adding them to the template. (e.g adding newX, _X, X2 for syscall X) but what are we supposed to do with the syscalls that unique to the architecture. Can we simply ignore them?
Please also take a look at these files if my explanations are not clear:
https://github.com/ebadi/syscalls-table/blob/master/mips64_syscalls.c
https://github.com/ebadi/syscalls-table/blob/master/template_syscalls.c
The text was updated successfully, but these errors were encountered: