On Mon, Apr 30, 2007 at 10:12:44AM +0100, Christoph Hellwig wrote:> On Sun, Apr 29, 2007 at 09:02:32PM -0700, Roland McGrath wrote:> > > EXPORT_SYMBOL_GPL(utrace_attach);> > > > > > There is not modular user of this, so this and the other utrace_> > > functions should not be exported. Nor do I think that exporting> > > such a low-level process control is nessecary a good idea, but> > > we'll have to evaluate that if patches to add users show up.> > > > If you remove the exports, just throw the whole thing away.> > The reason utrace exists is to be used by modules.> > used != used by modules. Even without things exported you can use> things in the kernel. Once we have a valid modular use case we can> add exports.

The file crash-suspend.c is a simple example of a loadable kernel moduleusing the new infrastructure. It implements the old GNU feature of doing ajob suspend on crash, so you can attach a debugger right then instead ofjust looking at the core file afterwards. Try for example: $ sudo /sbin/insmod crash-suspend.ko pid=$$to load the module and attach it to your shell. It then attaches to anychildren of your shell. Now run something that crashes and wouldordinarily dump core--you can just run cat or sleep and hit ^\ to crash itwith a SIGQUIT. See it suspend. Try "jobs -l" and see it stopped with anon-stop signal. If you resume it with "fg" it will go ahead and dumpcore. Or, you can attach a debugger like gdb first, and then debug it.

Most certainly, it should be included into utrace patchset to pin someexports.