Using GDB to debug a user space process in UML

Glenn Washburn development at efficientek.com
Fri Oct 8 10:01:21 PDT 2021


On Thu, 07 Oct 2021 21:16:40 +0200
Johannes Berg <johannes at sipsolutions.net> wrote:

> 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,

Do you have an idea of what is not working? The only thing I see
referenced in the cover letter[1] seems to be more of a security issue
and a functionality issue. So don't run the patch on untrusted code.
Anything else I should be aware of?

> 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.

According to the cover letter, this could be an answer to the "is
exec still slow" question I posted earlier. Very cool!

> 
> 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
> 

Thanks for the heads up!
Glenn

[1] http://lists.infradead.org/pipermail/linux-um/2021-March/001167.html




More information about the linux-um mailing list