Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strange libc symbol renaming issue
On Thu, Mar 14, 2019 at 03:14:56PM +0100, Manuel Bouyer wrote:
> Hello,
> I've a very strange symbol renaming issue on NetBSD 8.0/amd64:
> syslog-ng dies with a bad syscall signal, ktrace reveals that it
> called compat_13_sigaction13, just after properly calling __sigprocmask14.
> gdb on the core dump shows:
> Core was generated by `syslog-ng'.
> Program terminated with signal SIGSYS, Bad system call.
> #0 0x00007747ad46e74a in sigaction () from /usr/lib/libc.so.12
> (gdb) up
> #1 0x00007747b0e38f38 in g_process_perform_supervise () at lib/gprocess.c:1087
> 1087 sigaction(SIGHUP, &sa, NULL);
> (gdb)
>
> but gprocess.c properly includes signal.h, there was no warning at link time,
> and disasembling the function confirms it:
> 0x00007747b0e38f08 <+143>: movq $0x0,0x58(%rsp)
> 0x00007747b0e38f11 <+152>: movq $0x0,0x60(%rsp)
> 0x00007747b0e38f1a <+161>: movq $0x0,0x68(%rsp)
> 0x00007747b0e38f23 <+170>: movq $0x1,0x50(%rsp)
> 0x00007747b0e38f2c <+179>: xor %edx,%edx
> 0x00007747b0e38f2e <+181>: mov $0x1,%edi
> 0x00007747b0e38f33 <+186>: callq 0x7747b0e2f700 <__sigaction14@plt>
> => 0x00007747b0e38f38 <+191>: mov $0x1,%ebp
> 0x00007747b0e38f3d <+196>: lea 0x4c(%rsp),%r15
> 0x00007747b0e38f42 <+201>: lea 0x41378(%rip),%r14 # 0x7747b0e7a2c1
>
Well, it turns out that sigaction is reimplemented by syslog-ng in
lib/signal-handler.c. As it includes signal.h, its sigaction implementation
is renamed to _sigaction14.
This reimplementation of sigaction ends up calling the libc's one, using:
static int (*real_sa)(int, const struct sigaction *, struct sigaction *);
if (real_sa == NULL)
{
real_sa = dlsym(RTLD_NEXT, "sigaction");
}
return real_sa(signum, act, oldact);
I could change sigaction to _sigaction14 in the dlsym here for NetBSD;
is there a better way to do it ?
--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
NetBSD: 26 ans d'experience feront toujours la difference
--
Home |
Main Index |
Thread Index |
Old Index