ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.73k stars 267 forks source link

`BOX64_DYNAREC_TEST` on RISC-V is Failing #1649

Closed Coekjan closed 2 months ago

Coekjan commented 2 months ago

Description

I used BOX64_DYNAREC_TEST to test box64. And I saw that box64 must have some issues about this flag on RISC-V (it is good on ARM though). Many crashes I met, seems that RISC-V BOX64_DYNAREC_TEST cannot correctly handle the programs with PLT Callings. A hello-world program can reproduce the issue.

$ cat hello.c
#include <stdio.h>

int main() {
    puts("Hello World");
    return 0;
}
$ x86_64-linux-gnu-gcc hello.c -o hello
$ BOX64_DYNAREC_TEST=1 box64 ./hello  # here `box64` is running on risc-v.
(( !crash! ))

Due to this issue, I cannot move my work forward nearly at all. Hope we can solve this issue as soon as possible...

ksco commented 2 months ago

Maybe this is a regression. I haven't used BOX64_DYNAREC_TEST for a while now. Busy with other things for now, I can check this later if no one fixes it by then.

ksco commented 2 months ago

So I found the issue, submitted a PR above.

ksco commented 2 months ago

By the way, currently for RISC-V we don't run tests with cosim in CI, otherwise, this should be caught... The reason for that is some features of x87 are incomplete on RISC-V so cosim complains. And I totally forgot about this... Anyway will do it maybe tomorrow.

Coekjan commented 2 months ago

Thanks very very much!! You really save my life.

ksco commented 2 months ago

lol, happy to hear that. Out of curiosity, you're doing some research projects related to box64?

Coekjan commented 2 months ago

Out of curiosity, you're doing some research projects related to box64?

Yes. Something about dynamic binary translation.

Coekjan commented 2 months ago

Honestly, I have investigated this issue for 2 days. I saw something wrong about test pc, but could not find out how to solve it. Thanks again, you save my life!!