Using GDB to debug a user space process in UML

Johannes Berg johannes at sipsolutions.net
Fri Oct 8 11:43:59 PDT 2021


On Fri, 2021-10-08 at 11:46 -0500, Glenn Washburn wrote:
> 
> Another idea, that might be easier and maybe there's ideas on how this
> can be done without code changes, is to have the user-space process
> coredump on the host. I've enabled codedumps for the UML process, but
> they don't seem to contain the user-space processes. Probably because
> the user-space processes are not threads, but actually separate
> processes (or am I wrong about that?).

I don't think it's really all that simple.

A host process that UML creates corresponds to an *mm*, basically
virtual address space. This will often be a set of processes created
using clone(CLONE_VM), such as threads.

Also, a crash of a userspace process inside UML, such as via a segfault,
does not result in a crash of the UML process that's encapsulating that
process's mm, and in fact not even necessarily results in the
destruction of that mm, if e.g. other threads continue running.

What UML does then is switch around the actual threads inside those mm
processes whenever the scheduler decides which one should run. All those
mm processes are also around all at the same time, but only one of them
will ever be executing at a time (since UML is currently non-SMP).

johannes




More information about the linux-um mailing list