This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/16257] New: Internal calls to gnu_indirect_functions skip implementation, leaving gibberish behind
- From: "CoreyMutter at eaton dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 26 Nov 2013 17:23:40 +0000
- Subject: [Bug libc/16257] New: Internal calls to gnu_indirect_functions skip implementation, leaving gibberish behind
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16257
Bug ID: 16257
Summary: Internal calls to gnu_indirect_functions skip
implementation, leaving gibberish behind
Product: glibc
Version: 2.18
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: CoreyMutter at eaton dot com
CC: drepper.fsp at gmail dot com
Target: powerpc-e300c3-linux-gnu
Build: x86_64-redhat-linux
Created attachment 7305
--> https://sourceware.org/bugzilla/attachment.cgi?id=7305&action=edit
Test program
I'm seeing calls to gnu_indirect_functions from inside of libc (not crossing a
dynamic-link boundary), so they don't work. The failing case I have is on
powerpc 32-bit, and I have a workaround, but I believe the problem is more
general.
My example case (details and test program attached): the time stamps of
syslog() messages are coming out as gibberish, with a constant
unrelated-to-reality time from each program. E.g.:
/tmp # ./testprog
Local time: Nov 26 09:23:43
/tmp # ./testprog
Local time: Nov 26 09:23:52
/tmp # tail /flash/log/messages
Oct 11 01:45:52 testprog[1500]: Test syslog message
Oct 11 01:45:52 testprog[1502]: Test syslog message
(The same timestamp happens no matter how many hours or days apart the messages
are. This particular one has a year in the 1930s).
Analysis:
__vsyslog_chk() calls time(). Disassembly (in case details attachment)
single-stepping shows that what it's calling is the ifunc, not the real target.
So the "now" struct is left untouched (and the return value is actually a
function address), leading to gibberish timestamps.
When the program itself calls time(), the dynamic linker calls the ifunc, gets
the address, calls the implementation that has INLINE_VSYSCALL() and it works
fine.
This *may* be a problem with ld instead of glibc; perhaps the linker should see
what we're doing and call an implementation instead. Or perhaps glibc should be
using the version of sysdeps/unix/sysv/linux/powerpc/time.c compiled without
-DSHARED for its internal calls. I see that that version does get built, don't
know why it's not being used by syslog().
I don't feel comfortable enough with glibc or binutils development to do a
"real" fix. Currently I'm using a workaround of patching that time.c and
gettimeofday.c to remove the indirect functions, instead always using
INLINE_VSYSCALL. As far as I can tell, those are the only indirect functions
being used internally on PPC (there appear to be many others on x86_64).
--
You are receiving this mail because:
You are on the CC list for the bug.