Bug 1286339 - x86_32 ABI binaries don't work
Summary: x86_32 ABI binaries don't work
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 23
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-28 10:15 UTC by David Novák
Modified: 2015-11-30 15:47 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-30 13:35:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description David Novák 2015-11-28 10:15:01 UTC
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):

hello.asm
----------------------------------------------------
SECTION .text
global _start

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

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

SECTION .data
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 13:35:39 UTC
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 15:29:48 UTC
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 15:47:25 UTC
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.