Disable xsave in glibc's ld.so

Viewed 352

I would like to use gdb's recording, but because glibc's ld.so uses xsave instructions, I get the error "Process record does not support instruction 0xfae64 at address 0x7ffff7fe883c."

I was able to fix a similar error with binary patching thanks to a stackoverflow answer. Compiling glibc with debug symbols failed after running for half an hour, so I'd be glad if there's a quicker solution. I got a compiled version from here, but it looks like there are no earlier versions offered (i.e. I'm using glibc 2.28.r502.g065957a3704-1 now and gdb 8.2.1). How can I make gdb recording work?

1 Answers

The problem is that the x86 emulator built into gdb doesn't understand many newer instructions. The only fix for this is waiting for a new version with the relevant instructions patched in. In the meanwhile, this thread suggests a number of workarounds:

  • load the binary with the environment variable LD_BIND_NOW set to 1 to avoid triggering xsave in the dynamic linker
  • alternatively, link the binary you want to debug statically
  • alternatively, link with -z now e.g. by passing -Wl,-z,now to the C compiler
Related