Bug 1286339 - x86_32 ABI binaries don't work
x86_32 ABI binaries don't work
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-11-28 05:15 EST by David Novák
Modified: 2015-11-30 10:47 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-30 08:35:39 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Novák 2015-11-28 05:15:01 EST
Description of problem:

I have played around with ASM and discovered x32 ABI, that allows me to use x86_64 syscalls, registers and all the advantages with pointers still having size 4B (who needs more than 4GB of RAM for ordinary app?) and I wanted to try it out.

Here I have simple Hello World (hope I understood it correctly):

global _start

mov rax, 1 + 0x40000000  ; sys_write
mov rdi, 1               ; stdout
mov rsi, hello
mov rdx, len

mov rax, 60 + 0x40000000  ; sys_exit
mov rdi, 0                ; return value

hello db "Hello, world!", 0xA
len equ $ - hello

I compile it with these options to allow x86_32:

$ nasm -f elfx32 hello.asm -o hello.o
$ ld -m elf32_x86_64 hello.o -o hello

But it doesn't work:

$ ./hello
cannot execute binary file: Exec format error

$ file hello
hello: ELF 32-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

I read that it probably has something to do with CONFIG_X86_X32:

$ grep CONFIG_X86_X32 /boot/config-`uname -r`
# CONFIG_X86_X32 is not set

If I wanted to allow it, I would have to recompile kernel, right? Why isn't it allowed in default Fedora build? I don't ask for any big changes in Fedora - I just want to be able to create and run my own x86_32 apps.
Comment 1 Josh Boyer 2015-11-30 08:35:39 EST
Fedora is not targetting the x32 ABI.  If you wish to use this, you can rebuild the kernel with that support enabled.
Comment 2 David Novák 2015-11-30 10:29:48 EST
May I ask why?

I thought that you were targeting developers - at least your managers were claiming that on presentations of Fedora I've attended to.

I am not asking to include any new libraries or anything - just allow me to run x32 apps.. I don't want recompile kernel every time you include the new version.
Comment 3 Josh Boyer 2015-11-30 10:47:25 EST
The x32 support is an entirely new ABI.  To fully leverage it, you need a userspace stack that also supports it.  The usecases for this are not widely popular.  Enabling it in the kernel opens up more attack surface and requires more in terms of support when things don't work.

Fedora might, in some aspects, be targetting developers but that term is fairly ambiguous.  We are not targetting all possible things someone may wish to develop for.

Note You need to log in before you can comment on or make changes to this bug.