It was just several years ago that the open-source ecosystem began supporting the x32 ABI, but already kernel developers are talking of potentially deprecating the support and for it to be ultimately removed.
The Linux x32 ABI as a reminder requires x86_64 processors and is engineered to support the modern x86_64 features but with using 32-bit pointers rather than 64-bit pointers. The x32 ABI allows for making use of the additional registers and other features of x86_64 but with just 32-bit pointers in order to provide faster performance when 64-bit pointers are unnecessary.
This headline confused me for a second, because at first I thought the Linux team was removing 32 bit support – which obviously made little sense to me. As the quoted blurb explains, that’s not the case.
x32 is a really decent idea, but I think it has been hurt by a lack of promotion from distros.
I also kind of think that it’s time has passed, as increasing memory requirements have made the 64-bit pointer size more pervasively important.
Edited 2018-12-12 23:49 UTC
It’s time hasn’t passed at all. The primary use WASN’T programs that only needed 32-bit pointers, it was programs that assumed all pointers were 32 bits that were also a bitch to clean up. A good example of that would be Gens/GS, the Sega Genesis emulator. This emulator was such a bitch to clean that the authors gave up trying and are now rewriting the 64-bit version from scratch. x32 would allow a “64 bit” version without needing to change the pointer code, which would tide people over until the rewrite was done.
Also I wonder if it might make sense on some embedded platforms? Or what processors are common there?
I am quite sure keeping x32 makes the move from 32 Bit ARM to AARCH64 easier for many embedded systems.
x32 is x86-only. It’s completely independent from the AArch64-IPL32 support, just like it’s completely unrelated to the MIPS n32 support.
According to the LKML post, this is absolutely not the case.
How is the existing x86-on-amd64 layer not sufficient for that?
Depending on how old it is, you may need libs that are no longer supported. I ran into that with Gens/GS – you’d need to compile it on a 32-bit system with the latest libraries to get a newer 32-bit version to run under the 32-bit libs. And compiling 32-bit is a pain – they simply tell you to chroot to a 32-bit install, or use a 32-bit VM. x32 would allow you to compile as 64-bit on a 64-bit OS with the latest libs and bypass all that hassle.
You can still have 64-bits (or rather, at least 48-bits) of storage available. You just need to page memory in and out of your 32-bit address space. Really, only a select few processes on any system needs a truly flat 64-bit address space.
I mean, we’re talking about 32-bit address space per application on a 64-bit system, not at all like a 32-bit space on a 32-bit system. Even a memory hungry process like a Firefox browsing context is only taking up 1GB at most on my system. You’d only really hit the limit with a badly designed small Java program.
Interestingly, one of my previous jobs was on mainframe software that had to capture memory dumps really quickly. That involved being hooked into a running/crashing process via a 24-bit address space – 16MB – and trawl through potentially 64-bit address spaces for writing out process state relevant memory to disk, all under one second on a production machine.
You can definitely address 64-bits of address space without 64-bit pointers.
Do you have anything in particular in mind? ( http://www.osnews.com/thread?665828 ? )
I guess it was waiting for some industry endorsement (in the embedded) and that haven’t happened. Specifically if Intel wasn’t interested what can you do.
Not every decent idea catches on.
The issue isn’t so much lack of support from distros as how buggy it was and how software has to quite often be rewritten to the same level that is seen for porting to real 64-bit just to support it. The lack of support from distros is a direct consequence of those two facts.
It really comes down to the fact that the approach x32 takes is problematic in and of itself (compare this for example to AArch64 IPL32 support (not merged yet) and MIPS64 n32 ABI support, both of which are exponentially cleaner).
ahferroin7,
Can you elaborate on what was buggy? It shouldn’t require much more than a recompile (assuming the distros support it). I’d like to understand what you are referring to, however my current impression is that the main motivation for removing it is simply that it’s an extraneous mode that doesn’t get used very much.
Anything that calls system calls directly (which is actually more than most people think) may need manual changes to work correctly, as does anything that makes assumptions about the sizes of types.
strace and other tools that trace system calls from userspace have consistently had issues with x32 because of how it handles the system calls.
Almost everything in the kernel that cares about syscall numbers (for example, the auditing infrastructure and seccomp) has issues too, and anything that uses those interfaces needs special care to work properly.
Pretty much, the bugs and code comparability issues arise from the x32 ABI not matching either 64-bit or 32-bit x86 for structure sizes consistently, as well as having a whole slew of it’s own independent syscall numbers.
ahferroin7,
I’ll grant you data type sizes can be problematic when it comes to data structures, although we should recognize that it’s not really specific to x32. C has a long history of ambiguity in this area, which is why programmers should not assume on types having specific sizes.
https://stackoverflow.com/questions/18901080/why-is-the-sizeofint-si…
Arguably this exposes improper data type usage by programmers. The best advice is for programmers to learn to use size specific data types as needed since this will allow their code to be more portable in general.
http://www.cplusplus.com/reference/cstdint/
This is great advice in theory, except size-specific types aren’t reliably portable. Using them is perfectly fine if you’re only ever running on one platform, but the moment you care about portability, things get complicated, because not everyone uses the same C or C++ standard revision.
Even aside from all of this, there have been numerous other bugs over the years. There’s at least two extant ones I know of, a buffer overrun in the select() API on x32 (which has a proposed fix submitted but not yet committed), and the fact that glibc’s get_phys_pages() function doesn’t work correctly on x32 (because it assumes that certain structure fields aren’t longer than the `long` type). There are probably others I don’t know of right now, I stopped caring actively about x32 a few years back because it was just too much of a pain to keep a system working with it that did anything more complicated than building software.
ahferroin7,
These are exactly the kinds of bugs I was initially inquiring about
I do understand that there just isn’t much motivation for developers to use x32 over full x86_64. Only someone who cares an awful lot about memory/cache efficiency would care about the difference to not use x86_64. That’s not many people these days, haha.
Edited 2018-12-13 21:58 UTC
The problem is that x32 is a distinct ABI. Using all of the x86_64 syscalls isn’t an option because it forces use of 64-bit pointers and wide integers in many places, which x32 is trying to avoid.
Note that I’m not saying that it’s a bad thing that x32 reuses code from the x86_64 syscalls, I’m saying it’s a bad thing that it uses the exact same syscall numbers directly for some of it’s syscalls. IOW, certain syscalls don’t have a dedicated syscall number for x32, because they get called using the x86_64 syscall number instead. This makes maintenance of the ABI a serious pain in the arse because it means that the syscall numbers are sparse instead of just being a linear array.
ahferroin7,
I think this is incorrect. Just because the userspace process is using 32bit pointers doesn’t mean that the 64bit ABI can’t be used setting the high bits to zero. I’m looking at all of the syscalls you’ve mentioned and it looks like they share the same syscalls between x86_64 and x32. I don’t see a problem.
Edited 2018-12-14 17:15 UTC
That headline gave me a heart attack!