[OmniOS-discuss] PowerDNS recursor SIGSEGV
Josef 'Jeff' Sipek
jeffpc at josefsipek.net
Mon Dec 7 15:07:17 UTC 2015
On Sun, Dec 06, 2015 at 06:42:46PM -0500, Dan McDonald wrote:
> I wonder how the 014-compiled binary performs on 016? More accurately, I
> wonder if any gcc-51 compiled libs are off?
I'll try it out, but I expect it to work just fine - or die for a totally
different reason. This is because the SIGSEGV is caused by this instruction:
_ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x14:movaps %xmm0,-0x18(%ebp)
The _ZNKSt15_Deque_iteratorIcRcPcEmiEi function comes from a boost header and
it ends up in the pdns_recursor executable itself. The executable is pretty
boring as far as libs are concerned:
# ldd /usr/sbin/pdns_recursor
libresolv.so.2 => /lib/libresolv.so.2
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
librt.so.1 => /lib/librt.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libmd.so.1 => /lib/libmd.so.1
libmp.so.2 => /lib/libmp.so.2
gcc 4.8/4.9 compiled powerdns doesn't use this instruction at all. (The SEGV
is because the memory operand is 8-byte aligned instead of the required 16-byte
alignment. This causes #gp which turns into a SIGSEGV via the normal trap code
in the kernel.)
Jeff.
> Dan
>
> Sent from my iPhone (typos, autocorrect, and all)
>
> > On Dec 6, 2015, at 5:54 PM, Josef 'Jeff' Sipek <jeffpc at josefsipek.net> wrote:
> >
> >> On Sun, Dec 06, 2015 at 03:40:30PM -0500, Josef 'Jeff' Sipek wrote:
> >>> On Sun, Dec 06, 2015 at 10:26:00AM -0500, Dan McDonald wrote:
> >>> One other weird thing to try -- build powerdns with the Illumos gcc4. If
> >>> the gcc5 bug affects powerdns, that'd isolate it. If gcc5 affects some
> >>> non Illumos library, gcc4 won't help and you'll still segv.
> >>>
> >>> If gcc4 Illumos can't build it,
> >>
> >> The powerdns devs use a lot of c++11 which makes 4.4.4 *waaay* too old.
> >> Apparently, 4.8 should be good enough.
> >>
> >>> you could try 014 and its gcc481.
> >>
> >> Yeah, I'll try that.
> >
> > Ok. 014 produces the same exact instructions as OI Hipster. I wonder if
> > gcc 5 changed some processor default.
> >
> > Jeff.
> >
> >> Thanks,
> >>
> >> Jeff.
> >>
> >>>
> >>> Dan
> >>>
> >>> Sent from my iPhone (typos, autocorrect, and all)
> >>>
> >>>> On Dec 6, 2015, at 9:45 AM, Josef 'Jeff' Sipek <jeffpc at josefsipek.net> wrote:
> >>>>
> >>>> I compiled powerdns recursor [1] on 016, but I'm running into an occasional
> >>>> SIGSEGV. The SIGSEGV is because of insufficiently aligned memory operand to an
> >>>> instruction. (See the powerdns bug I filed for this [2].) The SIGSEGV actually
> >>>> happens in the deque code which comes from boost (1.58.0 in this case).
> >>>>
> >>>> Now, the weird thing... I compiled the same powerdns source with the same
> >>>> version of boost on OI Hipster and OmniOS 016. Hipster uses gcc 4.9.3,
> >>>> OmniOS 016 uses 5.1. The function that causes the SEGV on 016 looks totally
> >>>> different between the two distros so I haven't see it die on my laptop.
> >>>>
> >>>> Has anyone seen any strange SIGSEGVs in boost using software? I hope it isn't
> >>>> some sort of gcc bug.
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Jeff.
> >>>>
> >>>> P.S. PowerDNS uses {get,set,swap}context, so I haven't ruled out a stack
> >>>> alignment bug on their end.
> >>>>
> >>>> [1] https://www.powerdns.com/
> >>>> [2] https://github.com/PowerDNS/pdns/issues/3002
> >>>>
> >>>>
> >>>> OmniOS 016:
> >>>>
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi: pushl %ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+1: movl %esp,%ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+3: pushl %ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+4: subl $0x1c,%esp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+7: movl 0xc(%ebp),%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0xa: movl 0x8(%ebp),%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0xd: movdqu (%eax),%xmm0
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x11:movl 0x10(%ebp),%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x14:movaps %xmm0,-0x18(%ebp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x18:negl %eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1a:pushl %eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1b:leal -0x18(%ebp),%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1e:pushl %eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1f:call -0x94 <_ZNSt15_Deque_iteratorIcRcPcEpLEi>
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x24:movl (%eax),%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x26:addl $0x10,%esp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x29:movl %edx,(%ebx)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x2b:movl 0x4(%eax),%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x2e:movl %edx,0x4(%ebx)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x31:movl 0x8(%eax),%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x34:movl 0xc(%eax),%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x37:movl %edx,0x8(%ebx)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3a:movl %eax,0xc(%ebx)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3d:movl %ebx,%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3f:movl -0x4(%ebp),%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x42:leave
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x43:ret $0x4
> >>>>
> >>>>
> >>>> OI Hipster:
> >>>>
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi: pushl %ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+1: pushl %edi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+2: pushl %esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+3: pushl %ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+4: subl $0x14,%esp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+7: movl 0x2c(%esp),%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0xb: movl 0x30(%esp),%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0xf: movl 0x28(%esp),%eax
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x13:movl (%edx),%esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x15:movl 0x4(%edx),%ecx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x18:movl 0x8(%edx),%edi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1b:movl 0xc(%edx),%ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x1e:movl %esi,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x20:subl %ebx,%esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x22:subl %ecx,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x24:subl %ebx,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x26:cmpl $0x1ff,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x2c:movl %esi,(%esp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x2f:jbe +0x21 <_ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x52>
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x31:movl %edx,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x33:sarl $0x9,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x36:testl %edx,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x38:jle +0x56 <_ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x90>
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3a:leal 0x0(%ebp,%ebx,4),%ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3e:movl 0x0(%ebp),%ecx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x41:shll $0x9,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x44:subl %ebx,%edx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x46:leal (%ecx,%edx),%esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x49:leal 0x200(%ecx),%edi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x4f:movl %esi,(%esp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x52:movl %edi,0x4(%esp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x56:movd (%esp),%xmm0
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x5b:movl %ecx,(%esp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x5e:movd 0x4(%esp),%xmm1
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x64:movl %ebp,0x4(%esp)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x68:movd (%esp),%xmm3
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x6d:punpckldq %xmm3,%xmm0
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x71:movd 0x4(%esp),%xmm2
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x77:punpckldq %xmm2,%xmm1
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x7b:punpcklqdq %xmm1,%xmm0
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x7f:movdqu %xmm0,(%eax)
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x83:addl $0x14,%esp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x86:popl %ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x87:popl %esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x88:popl %edi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x89:popl %ebp
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x8a:ret $0x4
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x8d:leal 0x0(%esi),%esi
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x90:movl %edx,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x92:shrl $0x9,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x95:orl $0xff800000,%ebx
> >>>> _ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x9b:jmp -0x63 <_ZNKSt15_Deque_iteratorIcRcPcEmiEi+0x3a>
> >>>>
> >>>> --
> >>>> I'm somewhere between geek and normal.
> >>>> - Linus Torvalds
> >>>> _______________________________________________
> >>>> OmniOS-discuss mailing list
> >>>> OmniOS-discuss at lists.omniti.com
> >>>> http://lists.omniti.com/mailman/listinfo/omnios-discuss
> >>
> >> --
> >> The box said "Windows XP or better required". So I installed Linux.
> >
> > --
> > If I have trouble installing Linux, something is wrong. Very wrong.
> > - Linus Torvalds
--
Humans were created by water to transport it upward.
More information about the OmniOS-discuss
mailing list