On 07/13/2014 07:06 PM, Daniel Kahn Gillmor wrote:
> [cc'ing Wolfgang, faketime upstream]
> 
> re: https://bugs.debian.org/753460, which reports faketime 0.9.6
> segfaults on systems with older libc (2.13-38+deb7u2):
> 
> On 07/02/2014 01:16 AM, Charles Evans wrote:
>>
>> Package: faketime
>> Version: 0.9.6-1
>> Severity: important
>>
>> faketime with no args gives usage. 
>> faketime -f "+1s" date -> segfault:
>>  
>> [Tue Jul  1 19:47:36 2014] date[2872]: segfault at 0 ip   (null) sp bfc7d3dc 
>> error 4 in date[8048000+f000]
>> [Tue Jul  1 19:47:55 2014] date[3010]: segfault at 0 ip   (null) sp bfba081c 
>> error 4 in date[8048000+f000]
>> [Tue Jul  1 19:54:44 2014] date[6663]: segfault at 0 ip   (null) sp bfe9957c 
>> error 4 in date[8048000+f000]
>> (faketime stable works, but breaks iceweasel)
> 
> Interesting, this appears to be due to real_clock_gettime being set to
> NULL, which then causes a segfault in system_time_from_system() at at
> src/libfaketime.c:312.
> 
> I note that clock_gettime() tests for a NULL-valued real_clock_gettime
> (due to dlsym() failure) and fails in that case.
> 
> But system_time_from_system returns void, so there's no way to report a
> failure there.  I'm not sure why dlsym(RTLD_NEXT, "clock_gettime");
> would be returning NULL on debian stable.

ah, i think i see the issue.
debian/patches/fix-infinite-recursion-on-real_clock_gettime.patch
(attached) changes that line with a very dirty patch for systems with
libc6 > 2.13  (see https://bugs.debian.org/699559).  But that patch
isn't needed for libc6 2.13, which is what is running in wheezy.

So i see two things we should probably do about this:

 0) update the versions of libfaketime1 that have the patch so that they
have a versioned dependency on libc6 (>> 2.13)

 1) create a wheezy-backports version of faketime 0.9.6 that has a
*doesn't* have the patch, and has a versioned dependency on libc6 the
other way (<= 2.13).

What do you think?

        --dkg
From: Gerardo Malazdrewicz <gera...@malazdrewicz.com.ar>
To: 699...@bugs.debian.org
Subject: Avoiding loop (very dirty patch)
Date: Tue, 26 Mar 2013 01:18:05 +0100

[Message part 1 (text/plain, inline)]

Attached patch works for me, but it is very very dirty.

Possibly side effects.

Alternative seems to be to protect the call to real_clock_gettime so it is
executed just once (to validate the parameters). Subsequent calls are not
needed (parameters have been validated).

Thanks,
       Gerardo

--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -1380,7 +1380,7 @@ void __attribute__ ((constructor)) ftpl_init(void)
   real_clock_get_time =     dlsym(RTLD_NEXT, "clock_get_time");
   real_clock_gettime  =     apple_clock_gettime;
 #else
-  real_clock_gettime  =     dlsym(RTLD_NEXT, "clock_gettime");
+  real_clock_gettime  =     dlsym(RTLD_NEXT, "__clock_gettime");
 #ifdef FAKE_TIMERS
   real_timer_settime_22 =   dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.2");
   real_timer_settime_233 =  dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.3.3");

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to