← Back to context

Comment by nanolith

2 years ago

This is interesting. Although, I think it's always useful to point out that runtimes that directly make system calls will have portability issues in other *nix systems. For instance, OpenBSD has recently restricted system calls to a single offset of their libc in order to reduce ROP attacks.

If Lone wishes to be portable, it will need to consider a libc dependency as an option. If not, it can probably get away with direct syscalls on Linux unless Linux kernel developers decide to add support for pinning system calls. I doubt that this would ever be a hard requirement in the kernel, as it would break userland all over, but I could see this being an option for certain distributions as a ROP mitigation. Many features like these flow from OpenBSD to other OSes.

You're absolutely right, it is not portable to other operating systems. I have written about this portability and system call stability here on HN a few times, at some point I decided to compile all the information into a post on my website.

https://www.matheusmoreira.com/articles/linux-system-calls

I started lone (and previously a liblinux library) in order to make applications directly targeting the Linux system call binary interface. I chose Linux precisely because it's the only one with a stable interface.

I currently have no plans to make lone a portable programming language.

Considering the title and use case it seems to be intentionally pretty specific to Linux

  • Many projects start this way. But, as per my comment, the assumption that direct syscall support will be maintained in future Linux distros is also risky.

I think this decision from OpenBSD will more likely discourage developers from even considering it a supportable platform for software that originates in Linux land.

  • Direct syscall access is not something that is guaranteed in Unix derivatives. Linux is rare in that it provides a stable syscall API. Source compatibility is often only guaranteed when linked against libc or an equivalent low-level runtime library.

    • And this is generally a bad pattern unless those libc equivalents are services you call (like syscalls) and not a library you have to import or FFI. Requiring importing a library, probably from another language, is not a good alternative to syscalls.

      9 replies →

  • What decision from OpenBSD?

    Note that Linux is the odd one here. Every other relevant system out there is not like Linux on this.