[sheepdog] [PATCH] util: dump ucontext in crash handlers

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon May 6 15:38:21 CEST 2013


At Wed, 01 May 2013 22:21:16 +0900,
MORITA Kazutaka wrote:
> 
> At Wed,  1 May 2013 18:30:56 +0900,
> Hitoshi Mitake wrote:
> > 
> > Current crash handlers (of sheep, collie, and logger) don't dump
> > register status when the signal rises. This patch let them dump the
> > information. I believe especially RIP is useful for debugging.
> 
> I don't thinks so.  If you are debugging Sheepdog on your environment,
> you can get the register values from the core file.  If you are
> debugging with a reported sheep.log from other environment, how does
> the register status help us?
> 
> I cannot image the use case of RIP, too.  We can know where the
> process crashed from the backtrace.  Why do we need it?

Sorry for my slack description. Sometimes I debug programs with
objdump -d, so contents of registers are informative for me. But this
is not a productive way and I should switch to gdb.

But dumping registers is helpful for users. Because core files might
contain sensitive information (potentially) so in some cases sending
core files to public mailing lists would not be allowed. Contents of
registers would be helpful for such a case. e.g. redis employes this
way: http://antirez.com/news/43
(Of course redis is a on memory storage software and it stores almost
every data on main memory. So core files produced by redis must be
more sensitive than ones produced by sheep. But the core files
produced by sheep would also contain sensitive information.)

> 
> > 
> > Example of output:
> > May 01 18:23:07 [main] dump_mcontext(397) register status:
> > May 01 18:23:07 [main] dump_mcontext(399) 	RIP: 0x4046ab
> > May 01 18:23:07 [main] dump_mcontext(400) 	RSP: 0x7fff2ced9120
> > May 01 18:23:07 [main] dump_mcontext(401) 	RBP: 0x1
> > May 01 18:23:07 [main] dump_mcontext(402) 	RFLAGS: 0x10246
> > May 01 18:23:07 [main] dump_mcontext(404) 	RAX: 0x5
> > May 01 18:23:07 [main] dump_mcontext(405) 	RBX: 0x7fff2ceda348
> > May 01 18:23:07 [main] dump_mcontext(406) 	RCX: 0x0
> > May 01 18:23:07 [main] dump_mcontext(407) 	RDX: 0x0
> > May 01 18:23:07 [main] dump_mcontext(408) 	R8: 0x7fff2ced8fd0
> > May 01 18:23:07 [main] dump_mcontext(409) 	R9: 0x7f6fa31ef0e0
> > May 01 18:23:07 [main] dump_mcontext(410) 	R10: 0x8
> > May 01 18:23:07 [main] dump_mcontext(411) 	R11: 0x202
> > May 01 18:23:07 [main] dump_mcontext(412) 	R12: 0x404050
> > May 01 18:23:07 [main] dump_mcontext(413) 	R13: 0x7fff2ceda340
> > May 01 18:23:07 [main] dump_mcontext(414) 	R14: 0x0
> > May 01 18:23:07 [main] dump_mcontext(415) 	R15: 0x0
> > May 01 18:23:07 [main] dump_mcontext(417) 	RDI: 0x42557d
> > May 01 18:23:07 [main] dump_mcontext(418) 	RSI: 0x7fff2ced8f20
> 
> Does this work on i386 machines?

Current version doesn't work on i386. If this approach is accepted,
I'll send a refined version.

Thanks,
Hitoshi



More information about the sheepdog mailing list