Using GDB to debug a user space process in UML

Johannes Berg johannes at sipsolutions.net
Thu Oct 7 12:16:40 PDT 2021


On Thu, 2021-10-07 at 11:41 -0700, YiFei Zhu wrote:
> On Wed, Oct 6, 2021 at 11:36 PM Glenn Washburn
> <development at efficientek.com> wrote:
> > 
> > I'm trying to debug a crash in busybox while it is the init process in
> > a UML instance. I'm having trouble breaking on the entry point of the
> > busybox binary. I'm pretty new to this space, so I'm proceeding from a
> > lot of ignorance, please correct me where I'm wrong and help me clear
> > up some things.
> 
> AFAIK, that isn't possible, but not because of address space
> translation, but because UML is already ptracing user space threads.

Indeed.

My brother posted some (incomplete and not entirely working yet) patches
recently here on the list to allow not using ptrace but seccomp instead,
and that does in fact then allow attaching gdb to the userspace
processes, but note that there's a process per mm, not per userspace
thread, and thread switching happens by running something else in the
mm. So effectively, you're actually debugging all the threads of an
application, everything that runs in a single mm, all together.

It's still really nice because you can actually use gdb to look at the
lower-level internals of UML, but as I said, not quite working yet.

johannes




More information about the linux-um mailing list