0

I'm trying to run an ARM64 binary on my Kali Linux machine using Qemu user mode. This is the binary

~$ file arm_binary
arm_binary: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, Go BuildID=kuiME-kEtOrjYr0NtuSC/F9nT4PAOBdJwNF6rCoCc/7l0D-CmOuZoubD_SqInN/JtxNTIAPCIxt045aNaaC, not stripped

I can see that it's a Go program and was compiled using musl so I installed musl-cross-make and musl:arm64, libc6-dev-arm64-cross, and gcc-aarch64-linux-gnu from apt.

However, every time I try to run it, I get all these Error relocating: symbol not found errors.

~$ unset LD_LIBRARY_PATH; LD_DEBUG=libs QEMU_STRACE=1 qemu-aarch64-static -L /usr/aarch64-linux-musl/ arm_binary
Error relocating /lib/aarch64-linux-musl/libgps.so: __fdelt_chk: symbol not found180208 writev(2,0x55007ff7a8,0x2) = 81
180208 writev(2,0x55007ff8a8,0x2) = 0

180208 writev(2,0x55007ff788,0x2) = 1
Error relocating /lib/aarch64-linux-musl/libgps.so: __fprintf_chk: symbol not found180208 writev(2,0x55007ff7a8,0x2) = 83
180208 writev(2,0x55007ff8a8,0x2) = 0

180208 writev(2,0x55007ff788,0x2) = 1
Error relocating /lib/aarch64-linux-musl/libgps.so: __snprintf_chk: symbol not found180208 writev(2,0x55007ff7a8,0x2) = 84
180208 writev(2,0x55007ff8a8,0x2) = 0

180208 writev(2,0x55007ff788,0x2) = 1
Error relocating /lib/aarch64-linux-musl/libgps.so: __syslog_chk: symbol not found180208 writev(2,0x55007ff7a8,0x2) = 82
180208 writev(2,0x55007ff8a8,0x2) = 0

There are many more errors but I've omitted them. I have libgps.so and all the other files that the binary supposedly cannot relocate. Does anyone know what the issue might be?

Revoltechs
  • 195
  • 3
  • 9

1 Answers1

0

The error is telling you that libgps.so needs the __fdelt_chk, __fprintf_chk, etc symbols from some other library but nothing provided them.

In this case a little googling suggests that those functions __fdelt_chk, __fprintf_chk, etc, are supposed to be provided by the libc (glibc has them, musl may provide them for backwards compatibility, or may not). The library libgps.so was presumably linked against a newer or different version of libc than whatever the one in your sysroot is.

Peter Maydell
  • 9,707
  • 1
  • 19
  • 25
  • That makes sense. Do you know if there's a good way I can find out which library to get that would have all these dependencies? – Revoltechs Nov 18 '20 at 00:08
  • It's the libc. I dunno where libgps.so came from but I think the trick is to make sure you get a complete consistent set of libraries from the same place and don't mix-and-match. – Peter Maydell Nov 18 '20 at 10:15