RE: gdbserver + fsgsbase kaputt

From: Metzger, Markus T
Date: Tue Jan 12 2021 - 06:39:55 EST


> The GDB behavior looks to be different between the two cases -- with vs
> without gdb server, when I checked the GS/GSBASE values on the ptrace front.

64-bit GDB doesn't support FSGSBASE for 32-bit inferiors and it looks like gdbserver
might not support FSGSBASE, at all.

I had added support for the former as part of the tests I wrote about a year ago [1]
but never submitted the patch. Was the discussion ever concluded?

The general behavior should be that GDB reads a regset, overwrites the registers it
knows about, and writes it back again to preserve the original values of registers it
doesn't know about.

When I log the values that are read and written for FSGSBASE, however, it looks like
ptrace is returning a non-zero GS_BASE on a read and gdbserver is writing zero on
the next write.

Chang, is that also what you were seeing?

Regards,
Markus.

[1]
https://lkml.org/lkml/2019/11/29/306

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928