ptitSeb / box64

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

allocatestack.c:472: allocate_stack: Assertion `size != 0' failed #1368

Open iamsonderr opened 6 months ago

iamsonderr commented 6 months ago

When I used box64-0.2.6 to translate x86_64 programs on the loongarch system, allocatestack.c:472: allocate_stack: Assertion `size != 0' failed occurred.

[root@localhost bin]# /root/software/box64-0.2.6/bin/box64 ./gate_svr -y 0 -g 1 -p 18700 -i 127.0.0.1 -l 127.0.0.1,18082
Rolling log, showing last 16 function call on signals
Running on Unknown CPU with 32 Cores
Params database has 38 entries
Box64 v0.2.6  built on Mar 17 2024 15:08:28
BOX64: Didn't detect 48bits of address space, considering it's 39bits
BOX64 will force the used of emulated libs for libpthread.so.0 
Counted 32 Env var
BOX64 LIB PATH: /root/operating/oci_test/lib_box64_gate/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/root/software/box64-0.2.6/bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/root/bin/:/root/bin/
Looking for ./gate_svr
argv[1]="-y"
argv[2]="0"
argv[3]="-g"
argv[4]="1"
argv[5]="-p"
argv[6]="18700"
argv[7]="-i"
argv[8]="127.0.0.1"
argv[9]="-l"
argv[10]="127.0.0.1,18082"
Rename process to "gate_svr"
Using emulated /root/operating/oci_test/lib_box64_gate/libociei.so
Using emulated /root/operating/oci_test/lib_box64_gate/libncikdb.so
Using emulated /root/operating/oci_test/lib_box64_gate/libclntsh.so.12.1
Using emulated /root/operating/oci_test/lib_box64_gate/libssl.so.1.0.0
Using emulated /root/operating/oci_test/lib_box64_gate/libcrypto.so.1.0.0
Using emulated /root/operating/oci_test/lib_box64_gate/libmysqlclient.so.18
Using emulated /root/operating/oci_test/lib_box64_gate/libpq.so.5
Using native(wrapped) libevent-2.1.so.7
Using emulated /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Using native(wrapped) libutil.so.1
Using emulated /root/operating/oci_test/lib_box64_gate/libdmdci.so
Using emulated /root/operating/oci_test/lib_box64_gate/libodbc.so.2
Using native(wrapped) librt.so.1
Using native(wrapped) libdl.so.2
Using emulated /root/operating/oci_test/lib_box64_gate/libsql_engine.so.1
Using emulated /root/operating/oci_test/lib_box64_gate/libsql_engine_makesql.so.1
Using emulated /lib/x86_64-linux-gnu/libstdc++.so.6
Using native(wrapped) libm.so.6
Using emulated /lib/x86_64-linux-gnu/libgcc_s.so.1
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libbsd.so.0
Using native(wrapped) libc.so.6
Warning: Global Symbol _Jv_RegisterClasses not found, cannot apply R_X86_64_GLOB_DAT @0x3f11216f78 ((nil)) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Warning, cannot apply Global type: R_X86_64_TPOFF64 on errno @0x3f11216f80 (0), no elf_header found
Warning: Global Symbol __cxa_finalize not found, cannot apply R_X86_64_GLOB_DAT @0x3f11216f90 ((nil)) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Error: Global Symbol __vdso_clock_gettime not found, cannot apply R_X86_64_GLOB_DAT @0x3f11216f98 ((nil)) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Error: Symbol h_errno not found, cannot apply R_X86_64_DTPOFF64 @0x3f11216fb0 ((nil)) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Error: Global Symbol __libc_dl_error_tsd not found, cannot apply R_X86_64_GLOB_DAT @0x3f11216fb8 ((nil)) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Warning, cannot apply Global type: R_X86_64_TPOFF64 on __resp @0x3f11216fc8 (0), no elf_header found
Using emulated /root/operating/oci_test/lib_box64_gate/libclntshcore.so.12.1
Error initializing native libnsl.so.1 (last dlerror is libnsl.so.1: cannot open shared object file: No such file or directory)
Using emulated /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Using emulated /root/operating/oci_test/lib_box64_gate/libaio.so.1
Using native(wrapped) libresolv.so.2
Using emulated /root/operating/oci_test/lib_box64_gate/libmql1.so
Using emulated /root/operating/oci_test/lib_box64_gate/libipc1.so
Using emulated /root/operating/oci_test/lib_box64_gate/libnnz12.so
Using emulated /root/operating/oci_test/lib_box64_gate/libons.so
Warning: Global Symbol __pthread_key_create not found, cannot apply R_X86_64_GLOB_DAT @0x3f17022fc8 ((nil)) in /lib/x86_64-linux-gnu/libgcc_s.so.1
Error: Global Symbol rpc_createerr not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214f68 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol xdr_u_short not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214f70 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol _libc_intl_domainname not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214f78 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol xdr_bool not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214f80 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol xdr_netobj not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214f98 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol xdr_u_int not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214fa8 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Error: Global Symbol xdr_pmap not found, cannot apply R_X86_64_GLOB_DAT @0x3f19214fb0 ((nil)) in /root/operating/oci_test/lib_box64_gate/libnsl.so.1
Look for xdr_void in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d5110
Look for xdr_void in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d5110
Look for svc_getreq_poll in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d34c8
Look for clnt_pcreateerror in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74cf980
Look for __rpc_thread_svc_max_pollfd in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d2920
Look for key_secretkey_is_set in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d1918
Look for host2netname in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d2098
Look for __rpc_thread_svc_pollfd in loaded elfs
Found symbol with version GLIBC_2.27, value = 0xfff74d28e0
Using emulated /root/operating/oci_test/lib_box64_gate/./libodbcinst.so.2
Using emulated /root/operating/oci_test/lib_box64_gate/./libssl.so.10
Using emulated /root/operating/oci_test/lib_box64_gate/./libcrypto.so.10
Using native(wrapped) libcrypt.so.1
Using native(wrapped) libz.so.1
Warning: Global Symbol _ZN9__gnu_cxx21zoneinfo_dir_overrideEv not found, cannot apply R_X86_64_GLOB_DAT @0x3f1624e268 ((nil)) in /lib/x86_64-linux-gnu/libstdc++.so.6
Look for arc4random in loaded elfs
Warning, function arc4random not found in lib libbsd.so.0
Look for arc4random in loaded elfs
Warning, function arc4random not found in lib libbsd.so.0
Using emulated /root/operating/oci_test/lib_box64_gate/./libltdl.so.7
Error: PltResolver: Symbol _dl_get_tls_static_info(ver 11: _dl_get_tls_static_info@GLIBC_PRIVATE) not found, cannot apply R_X86_64_JUMP_SLOT 0x3f11217128 (0x3f110051ee) in /root/operating/oci_test/lib_box64_gate/libpthread.so.0
Error loading needed lib libgssapi_krb5.so
Warning: Cannot dlopen("libgssapi_krb5.so"/0x3f123d5ddc, 2)
Error loading needed lib libsnappy.so
Warning: Cannot dlopen("libsnappy.so"/0x3f1236a356, 2)
V4.3.20.1-build-20240126.210622
NdsGate : start
yan_lis:0
unix_domain_name=/tmp/test_1.ss
conf dir: /root/sql_proxy/gate/conf

indicate port:18700
indicate ipv6_support:0
indicate link-ctl:127.0.0.1,18082

directory:/root/operating/oci_test/bin
processname:gate_svr
model_path_in:/root/operating/oci_test/conf/in model_path_out:/root/operating/oci_test/conf/out
tr: 写入错误: 断开的管道
tr: 写入错误

----------------------------------------------------------------------

Create SGA, shmid = 51150900
----------------------------------------------------------------------

Attach SGA, shmid = 51150900, sga_address = 0xffd4d70000
----------------------------------------------------------------------

Init SGA, shmid = 51150900, sga_address = 0xffd4d70000,ret = 0
----------------------------------------------------------------------
tr: 写入错误: 断开的管道
tr: 写入错误
fc_shmid:50003996 
tr: 写入错误: 断开的管道
tr: 写入错误
ai_shmid:50036765 
i: allocatestack.c:472: allocate_stack: Assertion `size != 0' failed.
Last calls
14692|0x418e23: Calling shmget (/usr/lib64/libc.so.6)(0x2256, 0x7270E00, 0x3B6, ...) => return 0x2FB801D
14692|0x41e962: Calling my_printf (./gate_svr)(0x535605, 0x2FB801D, 0x3B6, ...) => return 0x13
14692|0x41e989: Calling shmat (/usr/lib64/libc.so.6)(0x2FB801D, 0x0, 0x0, ...) => return 0xFFCDAFC000
14692|0x41e9b7: Calling memset (/usr/lib64/libc.so.6)(0xFFCDAFC000, 0x0, 0x7270E00, ...) => return 0xFFCDAFC000
14692|0x41e9c3: Calling shmdt (/usr/lib64/libc.so.6)(0xFFCDAFC000, 0x0, 0x7270E00, ...) => return 0x0
14692|0x3f1100e8b0: Calling syscall 0x02 (2) 0x1007fe490 0x42 0x1ff 0x4 0xffe8d71060 (nil) => return 0x8
14692|0x41ea1d: Calling my_sprintf (./gate_svr)(0x1007FE690, 0x534E57, 0x2FB801D, ...) => return 0x8
14692|0x41ea2c: Calling strlen (/usr/lib64/libc.so.6)("50036765") => return 0x8
14692|0x41ea43: Calling __write (/usr/lib64/libc.so.6)(0x8, 0x1007FE690, 0x8, ...) => return 0x8
14692|0x3f1100e190: Calling syscall 0x03 (3) 0x8 0x1007fe690 0x8 0x4 0xffe8d71060 (nil) => return 0x0
14692|PltResolver "pthread_create" => return 0x1007FECA8
14692|PltResolver "__getpagesize" => return 0x1007FECA8
14692|0x3f11006c75: Calling getpagesize (/usr/lib64/libc.so.6)(0x1007FECA8, 0x0, 0x41E3AF, ...) => return 0x4000
14692|PltResolver "__assert_fail" => return 0x3FFF
14692|0x3f11007443: Calling __assert_fail (/usr/lib64/libc.so.6)(0x3F11010D01, 0x3F11010CBE, 0x1D8, ...) => return 
14692|0x41e914: Calling remove (/usr/lib64/libc.so.6)(0x1007FE490, 0x53725E, 0x53725E, ...) => return 0x0
NativeBT: ./gate_svr() [0x3485c394]
NativeBT: linux-vdso.so.1(+0x8a0) [0xfffd0788a0]
NativeBT: /usr/lib64/libc.so.6(gsignal+0xd0) [0xfff73f8688]
EmulatedBT: box64(__assert_fail+0) [0x903c0]
EmulatedBT: /root/operating/oci_test/lib_box64_gate/libpthread.so.0(__pthread_create_2_1+803) [0x3f11007443]
EmulatedBT: box64(__assert_fail+0) [0x903c0]
EmulatedBT: ??? [0x1007ff3b8]
EmulatedBT: ??? [0x30080]
EmulatedBT: /root/operating/oci_test/bin/gate_svr(_start+29) [0x40ed89]
14692|SIGABRT @0xfff73f8688 (gsignal (/usr/lib64/libc.so.6)) (x64pc=0x903d3/???:"???", rsp=0x1007fe728), for accessing 0x3964 (code=-6)
RAX:0x0000000000003fff RCX:0x0000003f11010d3c RDX:0x00000000000001d8 RBX:0x0000003f11010fc0 
RSP:0x00000001007fe728 RBP:0x0000000000000000 RSI:0x0000003f11010cbe RDI:0x0000003f11010d01 
 R8:0x000000ffe8d71060  R9:0x0000000000000000 R10:0x0000000000000004 R11:0x0000003f122c20b0 
R12:0x0000000000000000 R13:0x0000000000000000 R14:0x000000fff756c0c8 R15:0x0000000000000003 
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053

The configuration of box64 is as follows

BOX64_EMULATED_LIBS=libpthread.so.0
BOX64_ROLLING_LOG=1

The loongarch system configuration is as follows

架构:           loongarch64
字节序:         Little Endian
CPU:             32
在线 CPU 列表:  0-31
每个核的线程数: 1
每个座的核数:   16
座:             2
NUMA 节点:      2
CPU 系列:       Loongson-64bit
型号名称:       Loongson-3C5000
CPU MHz:        2200.00
BogoMIPS:       4400.00
L1d 缓存:       2 MiB
L1i 缓存:       2 MiB
L2 缓存:        8 MiB
L3 缓存:        16 MiB
NUMA 节点0 CPU: 0-15
NUMA 节点1 CPU: 16-31
标记:           cpucfg lam ual fpu lsx lasx complex crypto lvz lbt_x86 lbt_arm lbt_mip
iamsonderr commented 6 months ago

Can you help me? This is very important to me @ptitSeb

ptitSeb commented 6 months ago

Sory, I'm not home and quite bsy this whole week, so expect slow update;

I notice you are using latest stable. YOu should switch to current version (v0.2.7, lastest main), you will have much better loongarch support (and the beggining of a dynarec).