Closed shenki closed 5 years ago
Using /bin/sh
(which is busybox) works fine. Running bash from the shell crashes:
/ # bash
[ 31.910485] traps: bash[1186] trap invalid opcode ip:47ed19 sp:7ffcf2da20b0 error:0 in bash[400000+d0000]
[ 31.916172] bash (1186) used greatest stack depth: 12432 bytes left
Illegal instruction
Perhaps we should do a re-build of the rootfs?
Whoa... Don't know why I turned on bash. I wonder whose bug this is (buildroot, QEMU, the kernel)? I don't think there's any point to using a different shell other than the busybox one since we're almost never going to be in it.
There I was assuming bash was in there for something special. Lets remove bash and we can close this one.
Although, we should try executing a non-trivial program under clang. I will build a gcc kernel and see if the same thing happens.
Userspace should never be able to panic the kernel. On Android, that's considered a DoS.
We only panic as it's PID 1. When running it from a shell we get the "usual" SIGILL behaviour.
bash is being run as pid 1? isn't init or w/e supposed to be pid 1?
How would bash contain an invalid opcode? Unless it was compiled with extensions like avx and the qemu machine variant you're running doesn't support those ISA extensions? Or maybe it jumped to the middle of the instruction stream.
On Tue, Jan 29, 2019, 12:28 AM Nathan Chancellor <notifications@github.com wrote:
Well isn't that what init= means?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ClangBuiltLinux/continuous-integration/issues/120#issuecomment-458450533, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvUX6IJl5_mLqXpg50j8H8EGCkmVzzMks5vIAYqgaJpZM4aXX5N .
Unless it was compiled with extensions like avx and the qemu machine variant you're running doesn't support those ISA extensions?
Exactly what happened. When I initially created these images for myself, I selected BR2_x86_corei7=y
(as that's what I was using at the time), which selects a bunch of ISA extensions: https://github.com/buildroot/buildroot/blob/master/arch/Config.in.x86
config BR2_x86_corei7
bool "corei7"
select BR2_X86_CPU_HAS_MMX
select BR2_X86_CPU_HAS_SSE
select BR2_X86_CPU_HAS_SSE2
select BR2_X86_CPU_HAS_SSE3
select BR2_X86_CPU_HAS_SSSE3
select BR2_X86_CPU_HAS_SSE4
select BR2_X86_CPU_HAS_SSE42
I have never noticed a problem because I always use the -cpu host -enable-kvm
options, which makes QEMU's CPU emulate the host's. QEMU's default cpu qemu64
only supports SSE3, which Buildroot's default target variant nocona
supports. I just rebuilt the images with that variant and now Joel's command succeeds, with and without -cpu host -enable-kvm
. I'm running it through CI then I'll pull request: https://github.com/nathanchance/continuous-integration/commit/3c30d0f30865e56928a722a5fceed021459c87bd
I used the container and driver.sh to build locally on my amd64 laptop, and then ran qemu manually with
init=/bin/bash
added to the command line. Unexpectedly it crashed: