5 ms·
Guess they finally saw sense and realized that the when platforms say the syscall ABI is unstable, it really is unstable…
by saagarjha 6y ago
Guess they finally saw sense and realized that the when platforms say the syscall ABI is unstable, it really is unstable…
- chungy 6y agoOpenBSD has never really cared about backwards compatibility with binaries. It often works, but then suddenly they break. The OpenBSD developers really prefer fixing bugs instead of working around them.
- segfaultbuserr 6y agoIt's also the advantage you have when you officially maintain a complete operating system, not just a kernel.
- anthk 6y agoAs long as you can (cross) compile go source easily, I don't see it as a problem.
- jart 6y agoThere's no good reason for a Unix system to have an unstable system call ABI. I'm sorry but companies like Apple (who broke every Go binary a few years ago) don't get to copy syscall definitions from Bell System V and then declare it their own internal API. Usually the only time the SYSCALL ABI breaks, it's because kernel authors intentionally chose to do it for no apparent reason. For example, OpenBSD at some point changed how mmap() was defined so that it takes seven arguments: void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); The sixth argument doesn't do anything. It just breaks binary compatibility. It's also noncompliant with the System V ABI specification, which says system calls have six arguments max. I work on a project called Cosmopolitan Libc which lets you create static binaries that just work on Linux + Mac + Windows + FreeBSD + OpenBSD. It was only possible to do this because Unix systems generally agree on definitions. I worked really hard to support OpenBSD since I believe in the project. I just hope they keep the ABI stable going forward. For example, I'm really happy that this restriction only applies to dynamic binaries. It seems perfectly reasonable that they'd want to make the assumption that if a program chooses to link OpenBSD's Libc that it intends to use it. That's fine just so long as we continue having the ability to build static binaries with an alternative cross-platform Libc like Cosmopolitan. Speaking of which, I think I might actually implement some of OpenBSD's ideas in Cosmopolitan. I could probably track down all the functions that need raw SYSCALL and use __section__ so they're all linked to the same part of the binary and then call the msyscall() function to limit it just to that page. That way as a guest libc author I'm upholding the spirit of the intent. When in Rome do as the Romans.
- tedunangst 6y agoYou should perhaps look into the history of the mmap syscall arguments.
- jart 6y ago4.2BSD System Manual specifies it as mmap(addr, len, prot, share, fd, pos). There are six arguments. My best guess is something went horribly wrong with off_t on big endian systems and that it somehow leaked into x86_64 system call abi. Do you know?
- tedunangst 6y agooff_t needs 64bit alignment so registers get copied to the stack argument structure correctly on kernel entry. This is ancient voodoo.
- josefx 6y ago> The sixth argument doesn't do anything. It just breaks binary compatibility. As far as I can tell it might be used to align the memory layout of the following 64 bit arguments to 64 bits. Or at least ensure that there is no auto generated padding that might contain random values. Edit: The link provided by ainar-g 3 mentions that the way gcc handled padding of the offset field changed between gcc 1 and 2.
- ainar-g 6y ago> For example, OpenBSD at some point changed how mmap() was defined so that it takes seven arguments: It seems like that was the case from day one, when a copy of the NetBSD code was imported to later become OpenBSD[1]. And if my reasoning is correct, saying that OpenBSD “changed it at some point” is not quite correct. https://github.com/openbsd/src/blob/df930be708d50e9715f173caa26ffe1b7599b157/lib/libc/sys/mmap.c https://github.com/openbsd/src/blob/df930be708d50e9715f173ca...
- comfydragon 6y agoBut, that link shows mmap taking 6 arguments?