2

In a program I am debugging, the canary value is read to eax from gs:0x14 memory location. I am attaching gdb to the process late enough to break on the mov reading the canary to eax. Therefore, reading eax is not an option to me. How can I read (x/w) the canary location (gs:0x14) in gdb?

2
  • very similar questions have been asked and answered here and here – julian May 14 '17 at 20:55
  • @SYS_V I'm not sure either one was really "answered" (well, maybe if you count "you can't" as an answer) – Igor Skochinsky May 15 '17 at 16:32
3

It seems it's not possible to do this using built-in GDB functionality but I found a blog post which explains how to get the gs base from a core dump:

https://www.technovelty.org/linux/debugging-__thead-variables-from-coredumps.html

You should be able to generate a core using generate-core-file command then inspect it outside of GDB.

1
  • Ah! I see. Every time I learn something new from you. Thanks. Will try that. – Holmes.Sherlock May 14 '17 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.