[PATCH]: NULL pointer check in timer_* functions
Khem Raj
kraj@mvista.com
Fri Aug 12 00:32:00 GMT 2005
Hi
I came across this problem while running a small test where a timer is
created and deleted after that a call to timer_settime is made. This
caused a segmentation fault
on x86_64 target because the old_timer_delete function the timerid was
nullified. So when the call was made for timer_settime it passed 0
timerid and caused the segmentation fault.
This only happens if we are running a binary which was linked against
older glibc (e.g.) 2.2.5 because then only it is calling the
compatibility code.
I tracked it down to a problem inside timer_* functions. Currently we do
not check for timerid for NULL value inside timer_delete()
timer_settime() and timer_gettime() timer_getoverrun() functions.
This patch adds the checks to these functions.
Other way to fix this was do not nullify timerid in compatibility code
when timer is deleted instead of having an array to hold just the
timerid's expand this to hold additional element which will denote if
timer is deleted or is in use. In this approach the size of array will
double and also the checking code has to be added.
Is this OK or is it that we don't need this kind of checks at all.
Thanks
-Khem
nptl/Changelog
2005-08-11 Khem Raj <kraj@mvista.com>
* sysdeps/unix/sysv/linux/timer_delete.c (timer_delete): Check for
NULL timerid.
* sysdeps/unix/sysv/linux/timer_delete.c (timer_delete): Likewise.
* sysdeps/unix/sysv/linux/timer_delete.c (timer_delete): Likewise.
* sysdeps/unix/sysv/linux/timer_delete.c (timer_delete): Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050812/68497715/attachment.ksh>
More information about the Libc-alpha
mailing list