tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Base GDB tracing 32bit applications on amd64 kernel (with 64bit debugger) part 1)



On Sat, Jul 20, 2019 at 04:39:45PM +0200, Maxime Villard wrote:
> Le 20/07/2019 à 10:58, Manuel Bouyer a écrit :
> > On Sat, Jul 20, 2019 at 09:40:38AM +0200, Maxime Villard wrote:
> > > Le 17/07/2019 à 11:08, Manuel Bouyer a écrit :
> > > > On Wed, Jul 17, 2019 at 11:00:04AM +0200, Martin Husemann wrote:
> > > > > >    - Xen is causing some problems here (as usual...). See process_write_regs(),
> > > > > >      we are resetting the ss/cs registers to the default values. Yet in
> > > > > >      cpu_setmcontext32 we suddenly don't care about resetting ss/cs to the
> > > > > >      default values. It's not clear to me which side is incorrect.
> > > > > 
> > > > > Cc'ing Manuel - can you check this, please?
> > > > 
> > > > I'm probably missing something. there's no Xen-specific code in
> > > > process_write_regs()
> > > 
> > > ? There is a #ifdef XENPV in this very function.
> > > 
> > > The point was: there is an asymmetry between process_write_regs() and
> > > cpu_setmcontext32(), because the former resets ss/cs, and the latter
> > > does not. One side has to be incorrect, but it's not clear which.
> > 
> > But process_write_regs() is for 64bit processes, while cpu_setmcontext32()
> > is for 32bits, isn't it ?
> 
> The point of this thread is precisely to make process_write_regs() handle
> 32bit processes as well.
> 
> Beyond that, the current asymmetry between cpu_setmcontext and cpu_setmcontext32
> is already highly suspicious. Yes they are dedicated to 64bit and 32bit
> respectively, but even then, I don't understand how Xen itself can make the
> difference.

If I remember properly, there is something in the code segment descriptor
telling if it's in long mode or not, itsn't it ?
It's been a while since I looked at this ...

> 
> It is possible that the #ifdef XENPV in cpu_setmcontext is just wrong, and
> we just don't need to reset ss/cs anywhere.

I just tried, and it seems to work without it (but I just booted
single user) on Xen 4.11.
I'd like to try it with older hypervisors but I won't be able to do it
before monday.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index