Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: support loading 32 bit binaries #8

Closed
saljam opened this issue Nov 7, 2015 · 5 comments
Closed

kernel: support loading 32 bit binaries #8

saljam opened this issue Nov 7, 2015 · 5 comments

Comments

@saljam
Copy link
Contributor

saljam commented Nov 7, 2015

The current kernel can't run 32 bit binaries, which are still sometimes useful. (e.g. they're used in the boot2gecko toolchain.)

CONFIG_IA32_EMULATION enables this.

@ailispaw
Copy link
Owner

ailispaw commented Nov 7, 2015

Hi @saljam ,
Thank you for opening an issue.

Could you tell me more detail of your use case?
I would like to check and test it here.

@saljam
Copy link
Contributor Author

saljam commented Nov 7, 2015

Hi @ailispaw, thanks for answering quickly!

With the current docker-root kernel, if I try to run a 32-bit i386 binary (e.g. clang from the Android repository, or any Go program compiled with GOARCH=386 GOOS=linux go build) I get the following error:

$ ./clang
bash: ./clang: cannot execute binary file: Exec format error

The binary is a normal 32-bit ELF file:

$ file ./clang
clang: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=69ba21a03efb7f2bc4a26cb83613bc4a111e5ad7, stripped

The docker-root kernel itself is 64-bit:

$ uname -a
Linux 9c2fb505bced 4.1.6-docker-root #1 SMP Tue Sep 1 02:25:14 UTC 2015 x86_64 GNU/Linux

In order to be able to run 32-bit binaries, CONFIG_IA32_EMULATION needs to be enabled in the kernel config. It's enabled on the default Debian kernels. I've not tested enabling this yet in docker-root, but I'm 99% sure it's the culprit. :-)

I can send a PR with the new config once I build a kernel to test this out, if you'd like.

Edit: Oh and in my case I need to run that clang because it's part of the Android/FirefoxOS build process.

@ailispaw
Copy link
Owner

ailispaw commented Nov 7, 2015

I understand that.
Is this situation in the docker-root VM and a container in it as well?

Yes, please send a PR and let me test it, too.

@saljam
Copy link
Contributor Author

saljam commented Nov 7, 2015

Yep, same error message on both docker containers and the VM directly.

$ GOARCH=386 GOOS=linux go build hello.go
$ scp hello docker@$(make ip):
$ make ssh
[docker@docker-root ~]$ ./hello 
-bash: ./hello: cannot execute binary file: Exec format error

@saljam
Copy link
Contributor Author

saljam commented Nov 14, 2015

Fixed by #9.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants