From jakub@redhat.com Fri Nov 2 11:55:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 02 Nov 2001 11:55:00 -0000 Subject: setres[ug]id prototypes Message-ID: <20011112165419.G11220@sunsite.ms.mff.cuni.cz> Hi! I got a request to provide prototypes for setres[ug]id. What do you think is the best way to do this? Create stub sysdeps/generic/setres*id.c, move it to main Versions file and add under _GNU_SOURCE into unistd.h? Jakub From drepper@redhat.com Sat Nov 3 01:05:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 03 Nov 2001 01:05:00 -0000 Subject: setres[ug]id prototypes In-Reply-To: <20011112165419.G11220@sunsite.ms.mff.cuni.cz> References: <20011112165419.G11220@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > I got a request to provide prototypes for setres[ug]id. > What do you think is the best way to do this? You getting a request does not mean this is OK. Why should such non-standard functions be promoted? -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Nov 12 07:48:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 12 Nov 2001 07:48:00 -0000 Subject: 2.3 plans Message-ID: Jakub's latest gcc 3.1 patch looked quite reasonable. I made a few comments and once these things are resolved I'll apply it. This means that the branch point for 2.3 is near (well, the 2.2-stable branch is created). Time to post the to-do list for 2.3. I'd like to have a quick cycle to get the functionality out there as uick as possible (especially the locale-model stuff). A second reason is that I still hope to get the thread-library rewritten but this won't happen in 2.3. So we don't have to wait for this but should also not have 2.4 delayed for long just because 2.3 was just released. Anyway, I've mentioned on several occasions that I have a to-do list myself. I include it hear. So far these items are assigned to me. If somebody wants to take over the one or other thing let me know. Only Wolfram already has an item on his list since he agreed to it a long time ago. Anyway, please send me ASAP the additional items you expect on the list so that we can make final plans. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ me: - new locale model - implement transliteration inside localedef - update to new ISO 14651 table with needed localedef changes; this is again a lot of work - implement read-only mmap() support for streams; read-only streams should under certain circumstances simply use one mmap() call and set the buffer pointers appropriately - further reduce startup costs + 11 locale files! + get rid of __libc_subinit + avoid PLT entries by using internal symbol + eventually move all ld.so variables in one structure - add object file reordering; I have a beginning for this but it's not yet sophisticated enough - getifaddrs (http://veltec.co.jp/jman/cat/freeifaddrs.html) - regex speed patch; I have the patches in my inbox - add additional level of testing (root-only, alias, namespace, ...) - eventually implement one or two of the proposed nscd improvements - correctly implement filter DSOs; implement DSO groups Wolfram: - new malloc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Mon Nov 12 10:04:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 12 Nov 2001 10:04:00 -0000 Subject: 2.3 plans In-Reply-To: (Ulrich Drepper's message of "12 Nov 2001 12:07:35 -0800") References: Message-ID: Ulrich Drepper writes: > Jakub's latest gcc 3.1 patch looked quite reasonable. I made a few > comments and once these things are resolved I'll apply it. > > This means that the branch point for 2.3 is near (well, the 2.2-stable > branch is created). Time to post the to-do list for 2.3. I'd like to > have a quick cycle to get the functionality out there as uick as > possible (especially the locale-model stuff). A second reason is that > I still hope to get the thread-library rewritten but this won't happen > in 2.3. So we don't have to wait for this but should also not have > 2.4 delayed for long just because 2.3 was just released. > > Anyway, I've mentioned on several occasions that I have a to-do list > myself. I include it hear. So far these items are assigned to me. > If somebody wants to take over the one or other thing let me know. > Only Wolfram already has an item on his list since he agreed to it a > long time ago. > > Anyway, please send me ASAP the additional items you expect on the > list so that we can make final plans. Can you put the final list with some more information on the web, please? > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > me: > > - new locale model > > - implement transliteration inside localedef > > - update to new ISO 14651 table with needed localedef changes; this is again > a lot of work > > - implement read-only mmap() support for streams; read-only streams should > under certain circumstances simply use one mmap() call and set the > buffer pointers appropriately > > - further reduce startup costs > + 11 locale files! > + get rid of __libc_subinit > + avoid PLT entries by using internal symbol > + eventually move all ld.so variables in one structure > > - add object file reordering; I have a beginning for this but it's not yet > sophisticated enough Can you elaborate on this? > - getifaddrs (http://veltec.co.jp/jman/cat/freeifaddrs.html) > > - regex speed patch; I have the patches in my inbox > > - add additional level of testing (root-only, alias, namespace, ...) > > - eventually implement one or two of the proposed nscd improvements > > - correctly implement filter DSOs; implement DSO groups > > > Wolfram: > > - new malloc > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My list has currently (I'm not volunteering for everything): - Evaluate and use GMP 3.1 - Use GLIBC_PRIVATE for glibc internal symbols - Add prelinking support (that's probably Jakub's task) - Usage of glibc headers in C++ - is everything ok? - long double on PowerPC and Sparc32 done right (should be done by PowerPC/Sparc developers) - Convert libm-tests to use exact parameters so that we have no rounding in the arguments. We could even consider using Hexadecimal Constants for both inputs and outputs so that the used values are correct (I'll definitly do this). Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From wmglo@dent.med.uni-muenchen.de Mon Nov 12 12:15:00 2001 From: wmglo@dent.med.uni-muenchen.de (Wolfram Gloger) Date: Mon, 12 Nov 2001 12:15:00 -0000 Subject: 2.3 plans In-Reply-To: (message from Ulrich Drepper on 12 Nov 2001 12:07:35 -0800) References: Message-ID: <20011113094901.3628.qmail@md.dent.med.uni-muenchen.de> > Wolfram: > > - new malloc Yes, I'm working on this right now. It will have to be a new file malloc.c since I started 'from scratch' from Doug Lea's 2.7.0 version. There are _far_ too many changes to break it up into diffs. Definitely 2.3 stuff, and it will take some time to actually check its stability (I'm optimistic, though). Regards, Wolfram. From aj@suse.de Tue Nov 13 01:15:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 13 Nov 2001 01:15:00 -0000 Subject: 2.3 plans In-Reply-To: <20011113094901.3628.qmail@md.dent.med.uni-muenchen.de> (Wolfram Gloger's message of "13 Nov 2001 09:49:01 -0000") References: <20011113094901.3628.qmail@md.dent.med.uni-muenchen.de> Message-ID: Wolfram Gloger writes: >> Wolfram: >> >> - new malloc > > Yes, I'm working on this right now. It will have to be a new file > malloc.c since I started 'from scratch' from Doug Lea's 2.7.0 version. > There are _far_ too many changes to break it up into diffs. > Definitely 2.3 stuff, and it will take some time to actually check its > stability (I'm optimistic, though). What kind of improvements do you expect with the new malloc? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From wmglo@dent.med.uni-muenchen.de Tue Nov 13 01:49:00 2001 From: wmglo@dent.med.uni-muenchen.de (Wolfram Gloger) Date: Tue, 13 Nov 2001 01:49:00 -0000 Subject: 2.3 plans In-Reply-To: (message from Andreas Jaeger on Tue, 13 Nov 2001 10:54:12 +0100) References: <20011113094901.3628.qmail@md.dent.med.uni-muenchen.de> Message-ID: <20011113143532.3842.qmail@md.dent.med.uni-muenchen.de> > What kind of improvements do you expect with the new malloc? Mostly less fragmentation. The mozilla people in particular have reported this. But also faster performance, since there are now 'fastbins' again (chunks that aren't immediately consolidated on a free() but can be handed out again quickly). Regards, Wolfram. From drepper@redhat.com Tue Nov 13 01:54:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 13 Nov 2001 01:54:00 -0000 Subject: temporary to-do list Message-ID: I've uploaded the to-do list in a nicer format and with more explanantions and with Andreas' entries to sourceware: http://sources.redhat.com/glibc/todo-2.3.html I'll move it at some point to another machine which is easier accessible and not so heavily loaded. So don't create permanent links. If you send new entries, please look at the format the current entries have so that I only have to copy&paste the test. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Tue Nov 13 06:35:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 13 Nov 2001 06:35:00 -0000 Subject: temporary to-do list In-Reply-To: ; from Ulrich Drepper on Tue, Nov 13, 2001 at 05:09:47PM -0800 References: Message-ID: <20011114085717.A527@sunsite.ms.mff.cuni.cz> On Tue, Nov 13, 2001 at 05:09:47PM -0800, Ulrich Drepper wrote: > I've uploaded the to-do list in a nicer format and with more > explanantions and with Andreas' entries to sourceware: > > http://sources.redhat.com/glibc/todo-2.3.html > > I'll move it at some point to another machine which is easier > accessible and not so heavily loaded. So don't create permanent > links. > > If you send new entries, please look at the format the current entries > have so that I only have to copy&paste the test. Another thing missing on the todo list is ld.so auditing interface and implement ltrace on top of that. Jakub From drepper@redhat.com Tue Nov 13 17:10:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 13 Nov 2001 17:10:00 -0000 Subject: temporary to-do list In-Reply-To: <20011114085717.A527@sunsite.ms.mff.cuni.cz> References: <20011114085717.A527@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Another thing missing on the todo list is ld.so auditing interface and > implement ltrace on top of that. OK, added. I now wait for you to volunteer. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue Nov 13 23:54:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 13 Nov 2001 23:54:00 -0000 Subject: Handle PGI/Intel Compilers Message-ID: This patch adds some support for PGI and Intel compilers, both compilers support long long. Ok to commit? Andreas 2001-11-14 Andreas Jaeger * sysdeps/unix/sysv/linux/bits/types.h: Handle PGI and Intel compilers. * posix/sys/types.h: Likewise. Index: sysdeps/unix/sysv/linux/bits/types.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/bits/types.h,v retrieving revision 1.27 diff -u -p -u -r1.27 types.h --- types.h 2001/07/06 04:56:14 1.27 +++ types.h 2001/11/14 08:57:36 @@ -33,7 +33,7 @@ typedef unsigned char __u_char; typedef unsigned short __u_short; typedef unsigned int __u_int; typedef unsigned long __u_long; -#ifdef __GNUC__ +#if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef unsigned long long int __u_quad_t; __extension__ typedef long long int __quad_t; #else @@ -52,7 +52,7 @@ typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; -#ifdef __GNUC__ +#if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif Index: posix/sys/types.h =================================================================== RCS file: /cvs/glibc/libc/posix/sys/types.h,v retrieving revision 1.43 diff -u -p -u -r1.43 types.h --- types.h 2001/07/06 04:55:38 1.43 +++ types.h 2001/11/14 08:57:36 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -162,7 +162,7 @@ typedef unsigned int uint; typedef char int8_t; typedef short int int16_t; typedef int int32_t; -# ifdef __GNUC__ +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef long long int int64_t; # endif # endif @@ -171,7 +171,7 @@ __extension__ typedef long long int int6 typedef unsigned char u_int8_t; typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; -# ifdef __GNUC__ +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef unsigned long long int u_int64_t; # endif -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Wed Nov 14 00:28:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 14 Nov 2001 00:28:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: References: Message-ID: Andreas Jaeger writes: > This patch adds some support for PGI and Intel compilers, both > compilers support long long. > > Ok to commit? This probably should be handled with a macro like __GLIBC_HAVE_LONG_LONG defined in based on something similar to what you have. Beside testing for __PGI etc you probably have to check for the architexcture as well. Just to prevent bad surprises. Only gcc is known to work accross platforms. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Wed Nov 14 01:03:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 14 Nov 2001 01:03:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: ; from Ulrich Drepper on Wed, Nov 14, 2001 at 09:16:11AM -0800 References: Message-ID: <20011114182613.D527@sunsite.ms.mff.cuni.cz> On Wed, Nov 14, 2001 at 09:16:11AM -0800, Ulrich Drepper wrote: > Andreas Jaeger writes: > > > This patch adds some support for PGI and Intel compilers, both > > compilers support long long. > > > > Ok to commit? > > This probably should be handled with a macro like > > __GLIBC_HAVE_LONG_LONG > > defined in based on something similar to what you have. > Beside testing for __PGI etc you probably have to check for the > architexcture as well. Just to prevent bad surprises. Only gcc is > known to work accross platforms. And perhaps it could include __STDC_VERSION__ >= 199901L too, because I don't think any compiler would pretend to be C99 if not supporting long long. Jakub From drepper@redhat.com Wed Nov 14 09:17:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 14 Nov 2001 09:17:00 -0000 Subject: to-do list, final location Message-ID: The final place for the to-do list http://people.redhat.com/drepper/todo-2.3.html -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Wed Nov 14 09:23:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Wed, 14 Nov 2001 09:23:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: <20011114182613.D527@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Wed, 14 Nov 2001 18:26:13 +0100") References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > On Wed, Nov 14, 2001 at 09:16:11AM -0800, Ulrich Drepper wrote: >> Andreas Jaeger writes: >> >> > This patch adds some support for PGI and Intel compilers, both >> > compilers support long long. >> > >> > Ok to commit? >> >> This probably should be handled with a macro like >> >> __GLIBC_HAVE_LONG_LONG >> >> defined in based on something similar to what you have. >> Beside testing for __PGI etc you probably have to check for the >> architexcture as well. Just to prevent bad surprises. Only gcc is >> known to work accross platforms. > > And perhaps it could include __STDC_VERSION__ >= 199901L too, because > I don't think any compiler would pretend to be C99 if not supporting > long long. Since both the PGI and Intel compilers do not use __STDC_VERSION >= 199901L (at least not by default), I suggest the patch below. Ok to commit? Andreas 2001-11-15 Andreas Jaeger * include/features.h (__GLIBC_HAVE_LONG_LONG): Define for compilers that support it. * posix/sys/types.h: Use __GLIBC_HAVE_LONG_LONG. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * stdlib/stdlib.h: Likewise. Index: sysdeps/unix/sysv/linux/bits/types.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/bits/types.h,v retrieving revision 1.27 diff -u -p -r1.27 types.h --- types.h 2001/07/06 04:56:14 1.27 +++ types.h 2001/11/15 08:51:55 @@ -33,7 +33,7 @@ typedef unsigned char __u_char; typedef unsigned short __u_short; typedef unsigned int __u_int; typedef unsigned long __u_long; -#ifdef __GNUC__ +#ifdef __GLIBC_HAVE_LONG_LONG __extension__ typedef unsigned long long int __u_quad_t; __extension__ typedef long long int __quad_t; #else @@ -52,7 +52,7 @@ typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; -#ifdef __GNUC__ +#ifdef __GLIBC_HAVE_LONG_LONG __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; #endif @@ -63,7 +63,7 @@ typedef __u_int __uid_t; /* Type of use typedef __u_int __gid_t; /* Type of group identifications. */ typedef __u_long __ino_t; /* Type of file serial numbers. */ typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ -typedef __u_int __nlink_t; /* Type of file link counts. */ +typedef __u_int __nlink_t; /* Type of file link counts. */ typedef long int __off_t; /* Type of file sizes and offsets. */ typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ typedef int __pid_t; /* Type of process identifications. */ Index: include/features.h =================================================================== RCS file: /cvs/glibc/libc/include/features.h,v retrieving revision 1.29 diff -u -p -r1.29 features.h --- features.h 2001/11/01 04:23:17 1.29 +++ features.h 2001/11/15 08:51:55 @@ -277,6 +277,14 @@ #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) +/* Decide whether a compiler supports the long long datatypes. */ +#if defined __GNUC__ \ + || (defined __PGI && defined __i386__ ) \ + || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \ + || __STDC_VERSION >= 199901L +# define __GLIBC_HAVE_LONG_LONG 1 +#endif + /* This is here only because every header file already includes this one. */ #ifndef __ASSEMBLER__ # ifndef _SYS_CDEFS_H Index: posix/sys/types.h =================================================================== RCS file: /cvs/glibc/libc/posix/sys/types.h,v retrieving revision 1.43 diff -u -p -r1.43 types.h --- types.h 2001/07/06 04:55:38 1.43 +++ types.h 2001/11/15 08:51:55 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -162,7 +162,7 @@ typedef unsigned int uint; typedef char int8_t; typedef short int int16_t; typedef int int32_t; -# ifdef __GNUC__ +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef long long int int64_t; # endif # endif @@ -171,7 +171,7 @@ __extension__ typedef long long int int6 typedef unsigned char u_int8_t; typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; -# ifdef __GNUC__ +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER __extension__ typedef unsigned long long int u_int64_t; # endif Index: stdlib/stdlib.h =================================================================== RCS file: /cvs/glibc/libc/stdlib/stdlib.h,v retrieving revision 1.96 diff -u -p -r1.96 stdlib.h --- stdlib.h 2001/07/06 04:55:41 1.96 +++ stdlib.h 2001/11/15 08:51:55 @@ -140,7 +140,7 @@ extern int atoi (__const char *__nptr) _ /* Convert a string to a long integer. */ extern long int atol (__const char *__nptr) __THROW __attribute_pure__; -#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC) +#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) /* Convert a string to a long long integer. */ __extension__ extern long long int atoll (__const char *__nptr) __THROW __attribute_pure__; @@ -167,7 +167,7 @@ extern unsigned long int strtoul (__cons char **__restrict __endptr, int __base) __THROW; -#if defined __GNUC__ && defined __USE_BSD +#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD /* Convert a string to a quadword integer. */ __extension__ extern long long int strtoq (__const char *__restrict __nptr, @@ -179,7 +179,7 @@ extern unsigned long long int strtouq (_ __THROW; #endif /* GCC and use BSD. */ -#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC) +#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC) /* These functions will part of the standard C library in ISO C99. */ /* Convert a string to a quadword integer. */ -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Wed Nov 14 10:08:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 14 Nov 2001 10:08:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: ; from Andreas Jaeger on Thu, Nov 15, 2001 at 09:52:08AM +0100 References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> Message-ID: <20011115110135.F527@sunsite.ms.mff.cuni.cz> On Thu, Nov 15, 2001 at 09:52:08AM +0100, Andreas Jaeger wrote: > --- features.h 2001/11/01 04:23:17 1.29 > +++ features.h 2001/11/15 08:51:55 > @@ -277,6 +277,14 @@ > #define __GLIBC_PREREQ(maj, min) \ > ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) > > +/* Decide whether a compiler supports the long long datatypes. */ > +#if defined __GNUC__ \ > + || (defined __PGI && defined __i386__ ) \ > + || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \ > + || __STDC_VERSION >= 199901L This should be || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) instead. > +# define __GLIBC_HAVE_LONG_LONG 1 > +#endif > + > /* This is here only because every header file already includes this one. */ > #ifndef __ASSEMBLER__ > # ifndef _SYS_CDEFS_H Jakub From aj@suse.de Thu Nov 15 00:52:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 15 Nov 2001 00:52:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: <20011115110135.F527@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Thu, 15 Nov 2001 11:01:36 +0100") References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> <20011115110135.F527@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > On Thu, Nov 15, 2001 at 09:52:08AM +0100, Andreas Jaeger wrote: >> --- features.h 2001/11/01 04:23:17 1.29 >> +++ features.h 2001/11/15 08:51:55 >> @@ -277,6 +277,14 @@ >> #define __GLIBC_PREREQ(maj, min) \ >> ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) >> >> +/* Decide whether a compiler supports the long long datatypes. */ >> +#if defined __GNUC__ \ >> + || (defined __PGI && defined __i386__ ) \ >> + || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \ >> + || __STDC_VERSION >= 199901L > > This should be > || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) > instead. I'll change it, thanks! Ok to commit with that change? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Thu Nov 15 01:58:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 15 Nov 2001 01:58:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> Message-ID: Andreas Jaeger writes: > Index: posix/sys/types.h > =================================================================== > RCS file: /cvs/glibc/libc/posix/sys/types.h,v > retrieving revision 1.43 > diff -u -p -r1.43 types.h > --- types.h 2001/07/06 04:55:38 1.43 > +++ types.h 2001/11/15 08:51:55 > @@ -1,4 +1,4 @@ > -/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. > +/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. > This file is part of the GNU C Library. > > The GNU C Library is free software; you can redistribute it and/or > @@ -162,7 +162,7 @@ typedef unsigned int uint; > typedef char int8_t; > typedef short int int16_t; > typedef int int32_t; > -# ifdef __GNUC__ > +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER > __extension__ typedef long long int int64_t; > # endif > # endif Why don't you use the __GLIBC_HAVE_LONG_LONG macro here? -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Thu Nov 15 02:00:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 15 Nov 2001 02:00:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: (Ulrich Drepper's message of "15 Nov 2001 09:41:04 -0800") References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> Message-ID: Ulrich Drepper writes: > Andreas Jaeger writes: > >> Index: posix/sys/types.h >> =================================================================== >> RCS file: /cvs/glibc/libc/posix/sys/types.h,v >> retrieving revision 1.43 >> diff -u -p -r1.43 types.h >> --- types.h 2001/07/06 04:55:38 1.43 >> +++ types.h 2001/11/15 08:51:55 >> @@ -1,4 +1,4 @@ >> -/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. >> +/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. >> This file is part of the GNU C Library. >> >> The GNU C Library is free software; you can redistribute it and/or >> @@ -162,7 +162,7 @@ typedef unsigned int uint; >> typedef char int8_t; >> typedef short int int16_t; >> typedef int int32_t; >> -# ifdef __GNUC__ >> +# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER >> __extension__ typedef long long int int64_t; >> # endif >> # endif > > Why don't you use the __GLIBC_HAVE_LONG_LONG macro here? I forgot to save that file when I made the patch, I'll use the macro in the final patch. Ok to commit with that change? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Thu Nov 15 09:42:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 15 Nov 2001 09:42:00 -0000 Subject: Handle PGI/Intel Compilers In-Reply-To: References: <20011114182613.D527@sunsite.ms.mff.cuni.cz> Message-ID: Andreas Jaeger writes: > Ok to commit with that change? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Thu Nov 15 11:21:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 15 Nov 2001 11:21:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: <20011026145657.B926@sunsite.ms.mff.cuni.cz> References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> Message-ID: As you can see, I've applied the patch now. But I changed quite a bit before that. No file should be added if the minimum ABI is 2.2.5 or later. I don't see why a strange version name like GCC_3.0 should be used so that is changed as well. Also, the configure code must assume that by default the compatibilty stuff is not needed; platforms must explicitly enable it. I've build and tested the code on x86 now. This works but I have not done any testing of the code using binaries from the system. I'll try compiling with gcc3 next. I have no doubt that during the changes I've made I introduced the one of the other problem for various architectures. So everybody should try to build glibc on her/his favourite platform. And also perform compatiblity testing. Now that this patch is in cutting the stable branch is next and then very soon after a 2.2.5 release. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Thu Nov 15 11:30:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 15 Nov 2001 11:30:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: ; from Ulrich Drepper on Thu, Nov 15, 2001 at 05:39:57PM -0800 References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> Message-ID: <20011116123456.I527@sunsite.ms.mff.cuni.cz> On Thu, Nov 15, 2001 at 05:39:57PM -0800, Ulrich Drepper wrote: > As you can see, I've applied the patch now. But I changed quite a bit > before that. No file should be added if the minimum ABI is 2.2.5 or > later. I don't see why a strange version name like GCC_3.0 should be > used so that is changed as well. Also, the configure code must assume > that by default the compatibilty stuff is not needed; platforms must > explicitly enable it. But is the __*register_frame* and _Unwind_Find_FDE in glibc really just compatibility stuff? __frame_state_for definitely is, but the *register_frame* routines will be used by gcc 3.0.x, 3.1.x and later too. And when they are available in glibc, all C shared libs can be built with -static-libgcc (actually it could be the default for those glibc 2.2.5+ platforms, ATM I'm using such patch in our gcc 3.1 rpm). C shared libs don't need the frame unwinding stuff in libgcc_s.so, they just want to register their potential .eh_frame section. Also, when you changed the symbol versions from GCC_3.0 to GLIBC_2.2.5, it means binary compatibility is lost. Say on x86, if you have some pre-gcc3.0 compiled shared lib C with some -fexception stuff, they will register using __register_frame_info@GLIBC_2.0 (lets assume the main program is C only, not linked against libgcc_s.so, thus they will register with glibc). When this dlopens a C++ library which calls _Unwind_Find_FDE@GCC_3.0, it will obviously not able to throw through that lib, since _Unwind_Find_FDE@GCC_3.0 will be found only in libgcc_s.so (and it registered with glibc, but _Unwind_Find_FDE@GLIBC_2.2.5 will be totally unused). Jakub From drepper@redhat.com Thu Nov 15 17:40:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 15 Nov 2001 17:40:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: <20011116123456.I527@sunsite.ms.mff.cuni.cz> References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> <20011116123456.I527@sunsite.ms.mff.cuni.cz> Message-ID: [Don't cc: the gcc list on a message to libc-hacker. If you have gcc issues talk to them.] Jakub Jelinek writes: > But is the __*register_frame* and _Unwind_Find_FDE in glibc really just > compatibility stuff? You misunderstand the patch. The code is left out for new ports and if somebody when compiling glibc specifies the oldest supported ABI is 2.2.5. This is a special build which somebody has to select deliberately and which means s/he is completely taking compatibility issues in her/his own hands. Nothing to worry about. Something like this is useful if you build binaries for a closed environment you have complete control over. This includes the compiler to use. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Fri Nov 16 03:31:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 16 Nov 2001 03:31:00 -0000 Subject: glibc 2.2 branch created Message-ID: The name is glibc-2-2-branch. Only bug fixes (and probably non-code patches) should be applied to this branch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Fri Nov 16 16:16:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 16 Nov 2001 16:16:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: ; from Ulrich Drepper on Fri, Nov 16, 2001 at 04:15:35PM -0800 References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> <20011116123456.I527@sunsite.ms.mff.cuni.cz> Message-ID: <20011117143626.A543@sunsite.ms.mff.cuni.cz> On Fri, Nov 16, 2001 at 04:15:35PM -0800, Ulrich Drepper wrote: > > But is the __*register_frame* and _Unwind_Find_FDE in glibc really just > > compatibility stuff? > > You misunderstand the patch. The code is left out for new ports and > if somebody when compiling glibc specifies the oldest supported ABI is > 2.2.5. This is a special build which somebody has to select > deliberately and which means s/he is completely taking compatibility > issues in her/his own hands. Nothing to worry about. Something like > this is useful if you build binaries for a closed environment you have > complete control over. This includes the compiler to use. Nope, I understand what's the patch doing. But, suppose a new port is contributed which uses the generic unwind-dw2-fde.c gcc code (all but ia-64 currently). If __register_frame_info and similar registry is not present in glibc, this means all shared libs have to be linked against -lgcc_s (but ld.so and libc.so). So -static-libgcc cannot be used to build whole glibc, and every single binary will need to suffer similarly (in fact, all binaries will have to be linked directly against it too, since when libc.so doesn't have DT_NEEDED libgcc_s.so, they wouldn't have any registry to register with (which is needed in case they dlopen C++ or Java libs). Similarly with oldest supoprted ABI 2.2.5. Unless the compiler does something similar to IA-64, of course. But what I'm worried more is the GCC_3.0 vs. GLIBC_2.2.5 thing which basically render this glibc change useless. If we said we don't want compatibility with gcc 3.0.x, then gcc 3.1.x could move those symbols to GLIBC_2.2.5 version and have GCC_3.0 symbols as non-default aliases. But I'm afraid gcc 3.0.x compatibility is needed. Jakub From drepper@redhat.com Fri Nov 16 16:42:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 16 Nov 2001 16:42:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: <20011117143626.A543@sunsite.ms.mff.cuni.cz> References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> <20011116123456.I527@sunsite.ms.mff.cuni.cz> <20011117143626.A543@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > If __register_frame_info and similar registry is not present in > glibc, this means all shared libs have to be linked against -lgcc_s Anad this is how it has to be. Otherwise the whole conceot of libgcc_s is wrong and then you'll have to convince the gcc people. glibc is not there to work around such decisions. > But what I'm worried more is the GCC_3.0 vs. GLIBC_2.2.5 thing which > basically render this glibc change useless. Show me examples. Code. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Sat Nov 17 05:33:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Sat, 17 Nov 2001 05:33:00 -0000 Subject: linuxthread race condition Message-ID: There is a race condition in linuxthreads during thread creation on architectures that use a dedicated thread register. Between the point the thread is created and inserted in the list of active threads, and the point the thread register is initialized in the child a cancel signal may arrive, with the thread manager calling pthread_handle_exit. The newly created thread now calls pthread_handle_sigcancel, which uses thread_self to find itself. But since the thread register is not yet initialized it still points to the manager thread, and the signal handler falls trough to __pthread_manager_sighandler. Now if main is calling exit without joining the threads it is waiting for all threads to terminate, but if the new thread goes on waiting on a condition or similar it will never be able to exit. To fix this race I have blocked the cancel signal in the manager around the clone call, so that the child does not call the signal handler before thread_self is initialized. An easy way to reproduce the race is to insert a sleep in pthread_start_thread before INIT_THREAD_SELF. Andreas. 2001-11-20 Andreas Schwab * manager.c (pthread_handle_create): Make sure the cancel signal is initially blocked in the child so that it can initialize thread_self before the signal is handled. --- linuxthreads/manager.c.~1.73.~ Wed Sep 12 15:09:52 2001 +++ linuxthreads/manager.c Tue Nov 20 22:55:36 2001 @@ -611,6 +611,13 @@ if ((mask & (__pthread_threads_events.event_bits[idx] | event_maskp->event_bits[idx])) != 0) { + sigset_t newmask, oldmask; + + /* Block cancel signal in the child until it is fully + initialized. */ + sigemptyset(&newmask); + sigaddset(&newmask, __pthread_sig_cancel); + sigprocmask(SIG_BLOCK, &newmask, &oldmask); /* Lock the mutex the child will use now so that it will stop. */ __pthread_lock(new_thread->p_lock, NULL); @@ -638,6 +645,8 @@ CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif + if (pid != 0) + sigprocmask(SIG_SETMASK, &oldmask, NULL); if (pid != -1) { /* Now fill in the information about the new thread in @@ -663,6 +672,13 @@ } if (pid == 0) { + sigset_t newmask, oldmask; + + /* Block cancel signal in the child until it is fully + initialized. */ + sigemptyset(&newmask); + sigaddset(&newmask, __pthread_sig_cancel); + sigprocmask(SIG_BLOCK, &newmask, &oldmask); #ifdef NEED_SEPARATE_REGISTER_STACK pid = __clone2(pthread_start_thread, (void **)new_thread_bottom, @@ -678,6 +694,8 @@ CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif /* !NEED_SEPARATE_REGISTER_STACK */ + if (pid != 0) + sigprocmask(SIG_SETMASK, &oldmask, NULL); } /* Check if cloning succeeded */ if (pid == -1) { -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From jakub@redhat.com Sat Nov 17 11:00:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Sat, 17 Nov 2001 11:00:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: ; from Ulrich Drepper on Sat, Nov 17, 2001 at 10:59:24AM -0800 References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> <20011116123456.I527@sunsite.ms.mff.cuni.cz> <20011117143626.A543@sunsite.ms.mff.cuni.cz> Message-ID: <20011121133139.F611@sunsite.ms.mff.cuni.cz> On Sat, Nov 17, 2001 at 10:59:24AM -0800, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > If __register_frame_info and similar registry is not present in > > glibc, this means all shared libs have to be linked against -lgcc_s > > Anad this is how it has to be. Otherwise the whole conceot of > libgcc_s is wrong and then you'll have to convince the gcc people. > glibc is not there to work around such decisions. Richard, can you please say your word here? Do you want /lib/libgcc_s.so.1 to be linked with every C shared library and every C program even on GLIBC 2.2.5+ systems? > > But what I'm worried more is the GCC_3.0 vs. GLIBC_2.2.5 thing which > > basically render this glibc change useless. > > Show me examples. Code. E.g. try the attached testcase (replace the compilers so that one is gcc 3.1 and one is gcc-2.96 (or 2.95, doesn't matter) and the third one can be equal to one of the two). Dies miserably when glibc has those symbols @ GLIBC_2.2.5, while works flawlessly if they are @ GCC_3.0. Jakub -------------- next part -------------- A non-text attachment was scrubbed... Name: test_eh.tar.bz2 Type: application/octet-stream Size: 2911 bytes Desc: not available URL: From jakub@redhat.com Tue Nov 20 16:45:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 20 Nov 2001 16:45:00 -0000 Subject: [PATCH] Updated glibc-gcc3.patch In-Reply-To: <20011121133139.F611@sunsite.ms.mff.cuni.cz>; from Jakub Jelinek on Wed, Nov 21, 2001 at 01:31:39PM +0100 References: <20011026145657.B926@sunsite.ms.mff.cuni.cz> <20011116123456.I527@sunsite.ms.mff.cuni.cz> <20011117143626.A543@sunsite.ms.mff.cuni.cz> <20011121133139.F611@sunsite.ms.mff.cuni.cz> Message-ID: <20011121135617.G611@sunsite.ms.mff.cuni.cz> On Wed, Nov 21, 2001 at 01:31:39PM +0100, Jakub Jelinek wrote: > > > But what I'm worried more is the GCC_3.0 vs. GLIBC_2.2.5 thing which > > > basically render this glibc change useless. > > > > Show me examples. Code. > > E.g. try the attached testcase (replace the compilers so that one is gcc 3.1 > and one is gcc-2.96 (or 2.95, doesn't matter) and the third one can be equal > to one of the two). > Dies miserably when glibc has those symbols @ GLIBC_2.2.5, while works > flawlessly if they are @ GCC_3.0. Maybe I should be more precise on what tests exactly fails. I have modified makefile so that instead of || exit it does || echo ABORTED. It failed the following tests, ie. - C program compiled with gcc 3.1 dlopening 2.96-RH C++ lib throwing exceptions (as it dies on the first throw, it doesn't matter if it later throws through dlopened C lib compiled with 2.96-RH or gcc 3.1) - Mark's __frame_state_for tester compiled with gcc 3.1 - C program compiled with gcc 2.96-RH dlopening 2.96-RH C++ lib throwing exceptions - main C++ program compiled with gcc 2.96-RH dlopening 2.96-RH C++ lib The rest of the tests passed. The reason why those tests abort is what I described previously, .eh_frame sections get registered in one registry (glibc) while when _Unwind_Find_FDE is used, it looks into a different registry (libgcc_s). This is due to libgcc_s relevant symbols being GCC_3.0 and their glibc counterparts being GLIBC_2.2.5. ./t31.tst ./t12.so ./t21.so Catching A within C++ DSO... ABORTED ./t31.tst ./t12.so ./t22.so Catching A within C++ DSO... ABORTED ./t31.tst ./t12.so ./t23.so Catching A within C++ DSO... ABORTED ./t31.tst ./t13.so ./t21.so Catching A within C++ DSO... ABORTED ./t31.tst ./t13.so ./t22.so Catching A within C++ DSO... ABORTED ./t31.tst ./t13.so ./t23.so Catching A within C++ DSO... ABORTED Cannot find frame info for tsearch Cannot find frame info for lfind Cannot find frame info for lsearch Cannot find frame info for bsearch Cannot find frame info for qsort tsearch lfind lsearch bsearch qsort ABORTED ./t42.tst ./t21.so Catching A within C++ DSO... ABORTED ./t32.tst ./t12.so ./t21.so Catching A within C++ DSO... ABORTED ./t32.tst ./t12.so ./t22.so Catching A within C++ DSO... ABORTED ./t32.tst ./t12.so ./t23.so Catching A within C++ DSO... ABORTED ./t42.tst ./t22.so Catching A within C++ DSO... ABORTED ./t32.tst ./t13.so ./t21.so Catching A within C++ DSO... ABORTED ./t32.tst ./t13.so ./t22.so Catching A within C++ DSO... ABORTED ./t32.tst ./t13.so ./t23.so Catching A within C++ DSO... ABORTED ./t42.tst ./t23.so Catching A within C++ DSO... ABORTED Cannot find frame info for tsearch Cannot find frame info for lfind Cannot find frame info for lsearch Cannot find frame info for bsearch Cannot find frame info for qsort tsearch lfind lsearch bsearch qsort ABORTED ./t43.tst ./t21.so Catching A within C++ DSO... ABORTED ./t33.tst ./t12.so ./t21.so Catching A within C++ DSO... ABORTED ./t33.tst ./t12.so ./t22.so Catching A within C++ DSO... ABORTED ./t33.tst ./t12.so ./t23.so Catching A within C++ DSO... ABORTED ./t43.tst ./t22.so Catching A within C++ DSO... ABORTED ./t33.tst ./t13.so ./t21.so Catching A within C++ DSO... ABORTED ./t33.tst ./t13.so ./t22.so Catching A within C++ DSO... ABORTED ./t33.tst ./t13.so ./t23.so Catching A within C++ DSO... ABORTED ./t43.tst ./t23.so Catching A within C++ DSO... ABORTED Cannot find frame info for tsearch Cannot find frame info for lfind Cannot find frame info for lsearch Cannot find frame info for bsearch Cannot find frame info for qsort tsearch lfind lsearch bsearch qsort ABORTED Jakub From kukuk@suse.de Wed Nov 21 04:28:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Wed, 21 Nov 2001 04:28:00 -0000 Subject: [PATCH] files-hosts fix for to small buffer Message-ID: <20011122144144.A19296@suse.de> Hi, If you have one alias for a lot of entries in /etc/hosts or very long lines, the current glibc version will fail. Reason: files-hosts. from libnss_files runs out of buffer space, but does not set all variables, so it will never be called with a bigger buffer. Appended patch fixes this problem. Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrenstr. 15-19 D-90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B -------------- next part -------------- 2001-11-22 Thorsten Kukuk * nss/nss_files/files-hosts.c (_nss_files_get##name##_r): Set herrnop to NETDB_INTERNAL if we run out of buffer space. --- nss/nss_files/files-hosts.c +++ nss/nss_files/files-hosts.c 2001/11/22 13:16:24 @@ -173,6 +173,7 @@ >= buffer + buflen) \ { \ *errnop = ERANGE; \ + *herrnop = NETDB_INTERNAL; \ status = NSS_STATUS_TRYAGAIN; \ break; \ } \ From kukuk@suse.de Wed Nov 21 04:53:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Wed, 21 Nov 2001 04:53:00 -0000 Subject: [PATCH] 32bit ID patches Message-ID: <20011122145219.A13702@suse.de> Hi, in some places in glibc code we use signed values for user id and group id, but with linux they are unsigned. Appended is a patch for the cases I found. Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrenstr. 15-19 D-90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B -------------- next part -------------- 2001-11-22 Thorsten Kukuk * nis/nss_compat/compat-grp.c: Print group id as unsigned long. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nisplus/nisplus-grp.c: Likewise. * nis/nss_comapt/compat-pwd.c: Print user id as unsigned long. * nis/nss_nis/nis-pwd: Likewise. * nis/nss_nisplus/nisplus-pwd.c: Likewise. * nis/nss_nis/nis-publickey.c: Use strtoul instead of atoi. * nis/nss_nisplus/nisplus-parser.c: Likewise. * nis/nss_nisplus/nisplus-publickey.c: Likewise. * nscd/grpcache.c: Use strtoul instead of atol. * nscd/pwdcache.c: Likewise. * nss/getent.c: Likewise. --- nis/nss_compat/compat-grp.c +++ nis/nss_compat/compat-grp.c 2001/09/03 10:22:46 @@ -764,7 +764,7 @@ nis_result *res; char buf[24 + grptablelen]; - sprintf(buf, "[gid=%d],%s", gid, grptable); + sprintf(buf, "[gid=%lu],%s", (unsigned long) gid, grptable); res = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); if (niserr2nss (res->status) != NSS_STATUS_SUCCESS) { @@ -794,7 +794,7 @@ return NSS_STATUS_NOTFOUND; } - snprintf (buf, sizeof (buf), "%d", gid); + snprintf (buf, sizeof (buf), "%lu", (unsigned long) gid); if (yp_match (domain, "group.bygid", buf, strlen (buf), &outval, &outvallen) != YPERR_SUCCESS) --- nis/nss_compat/compat-pwd.c +++ nis/nss_compat/compat-pwd.c 2001/09/03 10:21:05 @@ -1353,8 +1353,9 @@ nis_result *res; char buf[1024 + pwdtablelen]; - snprintf(buf, sizeof (buf), "[uid=%d],%s", uid, pwdtable); - res = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[uid=%lu],%s", (unsigned long) uid, + pwdtable); + res = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); if (niserr2nss (res->status) != NSS_STATUS_SUCCESS) { enum nss_status status = niserr2nss (res->status); @@ -1383,7 +1384,7 @@ return NSS_STATUS_NOTFOUND; } - sprintf (buf, "%d", uid); + sprintf (buf, "%lu", (unsigned long) uid); if (yp_match (domain, "passwd.byuid", buf, strlen (buf), &outval, &outvallen) != YPERR_SUCCESS) --- nis/nss_nis/nis-grp.c +++ nis/nss_nis/nis-grp.c 2001/09/03 13:09:09 @@ -227,7 +227,7 @@ if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; - nlen = sprintf (buf, "%d", gid); + nlen = sprintf (buf, "%lu", (unsigned long) gid); retval = yperr2nss (yp_match (domain, "group.bygid", buf, nlen, &result, &len)); --- nis/nss_nis/nis-publickey.c +++ nis/nss_nis/nis-publickey.c 2001/09/03 13:32:39 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -143,7 +143,7 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp, gid_t *gidlist) { - char *p; + char *p, *ep; int gidlen; if (!s || !isdigit (*s)) @@ -153,7 +153,7 @@ } /* Fetch the uid */ - *uidp = (atoi (s)); + *uidp = strtoul (s, NULL, 10); if (*uidp == 0) { @@ -175,14 +175,17 @@ return NSS_STATUS_NOTFOUND; } - *gidp = (atoi (p)); + *gidp = strtoul (p, &ep, 10); gidlen = 0; - while ((p = strchr (p, ',')) != NULL) - { - p++; - gidlist[gidlen++] = atoi (p); + /* After strtoul() ep should point to the first invalid character. + This is the marker "," we search for the next value. */ + while (ep != NULL && *ep == ',') + { + ep++; + p = ep; + gidlist[gidlen++] = strtoul (p, &ep, 10); } *gidlenp = gidlen; --- nis/nss_nis/nis-pwd.c +++ nis/nss_nis/nis-pwd.c 2001/09/03 13:09:36 @@ -329,7 +329,7 @@ if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; - nlen = sprintf (buf, "%d", uid); + nlen = sprintf (buf, "%lu", (unsigned long) uid); retval = yperr2nss (yp_match (domain, "passwd.byuid", buf, nlen, &result, &len)); --- nis/nss_nisplus/nisplus-grp.c +++ nis/nss_nisplus/nisplus-grp.c 2001/09/03 12:31:05 @@ -227,7 +227,7 @@ nis_result *result; char buf[36 + tablename_len]; - sprintf (buf, "[gid=%d],%s", gid, tablename_val); + sprintf (buf, "[gid=%lu],%s", (unsigned long) gid, tablename_val); result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); --- nis/nss_nisplus/nisplus-parser.c +++ nis/nss_nisplus/nisplus-parser.c 2001/09/03 13:24:37 @@ -89,7 +89,7 @@ len = strlen (first_unused); if (len == 0) /* If we don't have a uid, it's an invalid shadow entry */ return 0; - pw->pw_uid = atoi (first_unused); + pw->pw_uid = strtoul (first_unused, NULL, 10); room_left -= (len + 1); first_unused += (len + 1); @@ -102,7 +102,7 @@ len = strlen (first_unused); if (len == 0) /* If we don't have a gid, it's an invalid shadow entry */ return 0; - pw->pw_gid = atoi (first_unused); + pw->pw_gid = strtoul (first_unused, NULL, 10); room_left -= (len + 1); first_unused += (len + 1); @@ -200,7 +200,7 @@ len = strlen (first_unused); if (len == 0) /* We should always have an gid */ return 0; - gr->gr_gid = atoi (first_unused); + gr->gr_gid = strtoul (first_unused, NULL, 10); room_left -= (strlen (first_unused) + 1); first_unused += strlen (first_unused) + 1; --- nis/nss_nisplus/nisplus-publickey.c +++ nis/nss_nisplus/nisplus-publickey.c 2001/09/03 13:34:02 @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1999 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -200,6 +200,7 @@ parse_grp_str (const char *s, gid_t *gidp, int *gidlenp, gid_t *gidlist, int *errnop) { + char *ep; int gidlen; if (!s || (!isdigit (*s))) @@ -208,14 +209,17 @@ return NSS_STATUS_NOTFOUND; } - *gidp = atoi (s); + *gidp = strtoul (s, &ep, 10); gidlen = 0; - while ((s = strchr (s, ',')) != NULL) - { - s++; - gidlist[gidlen++] = atoi (s); + /* After strtoul() ep should point to the marker ',', which means + here starts a new value. */ + while (ep != NULL && *ep == ',') + { + ep++; + s = ep; + gidlist[gidlen++] = strtoul (s, &ep, 10); } *gidlenp = gidlen; @@ -368,7 +372,7 @@ _("netname2user: LOCAL entry for %s in directory %s not unique"), netname, domain); /* Fetch the uid */ - *uidp = atoi (ENTRY_VAL (res->objects.objects_val, 2)); + *uidp = strtoul (ENTRY_VAL (res->objects.objects_val, 2), NULL, 10); if (*uidp == 0) { --- nis/nss_nisplus/nisplus-pwd.c +++ nis/nss_nisplus/nisplus-pwd.c 2001/09/03 12:31:44 @@ -235,7 +235,7 @@ nis_result *result; char buf[100 + tablename_len]; - sprintf (buf, "[uid=%d],%s", uid, tablename_val); + sprintf (buf, "[uid=%lu],%s", (unsigned long) uid, tablename_val); result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); --- nscd/grpcache.c +++ nscd/grpcache.c 2001/09/03 09:53:40 @@ -246,8 +246,18 @@ char *buffer = alloca (buflen); struct group resultbuf; struct group *grp; - gid_t gid = atol (key); uid_t oldeuid = 0; + char *ep; + gid_t gid = strtoul ((char *)key, &ep, 10); + + if (*(char*)key == '\0' || *ep != '\0') /* invalid numeric gid */ + { + if (debug_level > 0) + dbg_log (_("Invalid numeric gid \"%s\"!"), (char *)key); + + errno = EINVAL; + return; + } if (debug_level > 0) dbg_log (_("Haven't found \"%d\" in group cache!"), gid); --- nscd/pwdcache.c +++ nscd/pwdcache.c 2001/09/03 09:54:44 @@ -242,8 +242,18 @@ char *buffer = alloca (buflen); struct passwd resultbuf; struct passwd *pwd; - uid_t uid = atol (key); uid_t oldeuid = 0; + char *ep; + uid_t uid = strtoul ((char*) key, &ep, 10); + + if (*(char*)key == '\0' || *ep != '\0') /* invalid numeric uid */ + { + if (debug_level > 0) + dbg_log (_("Invalid numeric uid \"%s\"!"), (char *)key); + + errno = EINVAL; + return; + } if (debug_level > 0) dbg_log (_("Haven't found \"%d\" in password cache!"), uid); --- nss/getent.c +++ nss/getent.c 2001/09/03 09:49:02 @@ -198,7 +198,15 @@ for (i = 0; i < number; ++i) { if (isdigit (key[i][0])) - grp = getgrgid (atol (key[i])); + { + char *ep; + gid_t arg_gid = strtoul (key[i], &ep, 10); + + if (*key[i] != '\0' && *ep == '\0') /* valid numeric uid */ + grp = getgrgid (arg_gid); + else + grp = NULL; + } else grp = getgrnam (key[i]); @@ -404,7 +412,15 @@ for (i = 0; i < number; ++i) { if (isdigit (key[i][0])) - pwd = getpwuid (atol (key[i])); + { + char *ep; + uid_t arg_uid = strtoul (key[i], &ep, 10); + + if (*key[i] != '\0' && *ep == '\0') /* valid numeric uid */ + pwd = getpwuid (arg_uid); + else + pwd = NULL; + } else pwd = getpwnam (key[i]); From roland@frob.com Thu Nov 22 05:41:00 2001 From: roland@frob.com (Roland McGrath) Date: Thu, 22 Nov 2001 05:41:00 -0000 Subject: 2.3 plans In-Reply-To: Ulrich Drepper's message of , 12 November 2001 12:07:35 -0800 Message-ID: <20011122213856.97A3E99771@perdition.linnaean.org> > I still hope to get the thread-library rewritten but this won't happen > in 2.3. I hope that before this does start to happen, whenever that is, you let us here know about your implementation ideas in detail, early and often. There are a few volunteers interested in working on pthreads for Hurd. It's important to me that their efforts be integrated well with yours and that we end up with a threads library that is both very well-integrated into libc and cleanly portable (i.e. machine dependencies are well isolated from OS dependencies, individual implementation choices are modular, etc). When this does take shape, we will hopefully also rewrite the Hurd signals code in libc to integrate properly with pthreads and to implement the full 1003.1-1996 signal semantics. If this all comes together in 2.4, that will be a fine fine thing. > - implement read-only mmap() support for streams; read-only streams should > under certain circumstances simply use one mmap() call and set the > buffer pointers appropriately Does "Later" in your list mean that you now don't plan this for 2.3? This is something that I'd planned to implement from the beginning in GNU stdio. But I was always concerned about the problem of handling faults. It's always possible for an access to the mapped region to fault because of an EIO error in the filesystem backing the page. If that happens inside a stdio function or inside the getc macro, it should be handled and just return a normal stdio error, rather than letting the signal through to the program. Do you have a plan to address that issue? I had previously planned to move Hurd users over to libio before 2.3, and completely excise the old stdio implementation from the source in 2.3. We may still be able to do that soon enough not to support the old (current) Hurd ABI with GNU stdio in 2.3 at all, but I can't be sure yet. I have a Hurd-specific aio implementation that might be ready for 2.3, and also possibly a posix_spawn implementation. Aside from that, I don't anticipate anything else for Hurd in 2.3 other than bug fixes and possibly incorporating more ports. Roland From drepper@redhat.com Thu Nov 22 05:52:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 22 Nov 2001 05:52:00 -0000 Subject: 2.3 plans In-Reply-To: <20011122213856.97A3E99771@perdition.linnaean.org> References: <20011122213856.97A3E99771@perdition.linnaean.org> Message-ID: Roland McGrath writes: > I hope that before this does start to happen, whenever that is, you let us > here know about your implementation ideas in detail, early and often. I currently have no immediate plans or ideas. The problem is that the Linux kernel is currently not suitable for a good thread implementation and before this is changed I'll not spend a second thinking about this. The idea is, of course, to have a generic implementation which can suit Linux and Hurd. Other kernels are optional. > Does "Later" in your list mean that you now don't plan this for 2.3? No. It means work will start later in the 2.3 development cycle. > But I was always concerned about the problem of handling faults. It's > always possible for an access to the mapped region to fault because of an > EIO error in the filesystem backing the page. If that happens inside a > stdio function or inside the getc macro, it should be handled and just > return a normal stdio error, rather than letting the signal through to the > program. Do you have a plan to address that issue? Not really. Access to mmap()ed pages is today almost everywhere assumed to work without causing EIO errors. Almost all programs (including ld.so and other glibc code) will just fail. I have not seen this to be an issue anywhere in the last years so I think it is safe to ignore this. > We may still be able to do that soon enough not to support the old > (current) Hurd ABI with GNU stdio in 2.3 at all, but I can't be sure > yet. There won't be a 2.3 release which has to be supported for some time. Ripping the stdio code out is therefore no problem. It just has to happen before a 2.3 release. > I have a Hurd-specific aio implementation that might be ready for 2.3, and > also possibly a posix_spawn implementation. Aside from that, I don't > anticipate anything else for Hurd in 2.3 other than bug fixes and possibly > incorporating more ports. OK, I'll add these two points to the list and assign them to you. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Thu Nov 22 13:38:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 22 Nov 2001 13:38:00 -0000 Subject: BENCHMARK bits/string.h and bits/string2.h optimizations Message-ID: <20011126155732.F572@sunsite.ms.mff.cuni.cz> Hi! As gcc3 vastly improved and extended builtin stringops optimizations, I'd like to open the question of which bits/string.h resp. bits/string2.h optimizations should be disabled for gcc3+ or gcc3.1+. Attached is a small program + Makefile which tests some stringops optimizations which bits/string.h and bits/string2.h are trying to do. Attached are results of running these tests on i686 with -O2 -mcpu=i686 and -O2 -mcpu=i686 -fPIC with trunk gcc. In the output, gcc means gcc builtins without glibc inlines, nob means the -fno-builtin without gcc inlines, str means bits/string.h optimizations and str2 bits/string2.h opts. Lines marked with * are where gcc is at least as fast as all the others, or better. If similar results prove on other arches, IMHO at least string2.h (strcpy, strncat, strncpy, memset, strstr) are good candidates for #if !__GNUC_PREREQ(3, 0) resp. 3,1 depending on whether the same results are found in 3.0 or not. Jakub -------------- next part -------------- A non-text attachment was scrubbed... Name: tester.tar.bz2 Type: application/octet-stream Size: 3139 bytes Desc: not available URL: -------------- next part -------------- gcc nob str str2 memcpy (0,a,1) 3 51 3 3 * (0,a,2) 3 51 12 3 * (0,ab,3) 3 51 4 3 * (0,abc,4) 4 51 4 4 * (0,abcd,5) 3 58 36 3 * (0,abcde,6) 4 58 6 4 * (0,abcdef,7) 9 58 39 9 * (0,abcdefg,8) 4 58 20 4 * (0,quitelongstring,0) 2 51 2 2 * (0,quitelongstring,1) 3 51 3 3 * (0,quitelongstring,2) 4 51 3 4 (0,quitelongstring,3) 3 51 4 3 * (0,quitelongstring,4) 3 51 4 3 * (0,quitelongstring,5) 8 58 36 8 * (0,quitelongstring,6) 4 58 6 4 * (0,quitelongstring,7) 9 58 39 9 * (0,quitelongstring,8) 4 58 4 4 * (5,a,1) 3 51 3 3 * (5,a,2) 4 51 12 4 * (5,ab,3) 3 51 4 3 * (5,abc,4) 3 51 4 3 * (5,abcd,5) 8 58 36 8 * (5,abcde,6) 4 58 6 4 * (5,abcdef,7) 9 58 39 9 * (5,abcdefg,8) 4 58 20 4 * (5,quitelongstring,0) 2 51 2 2 * (5,quitelongstring,1) 3 51 3 3 * (5,quitelongstring,2) 3 51 3 3 * (5,quitelongstring,3) 8 51 4 8 (5,quitelongstring,4) 3 51 4 3 * (5,quitelongstring,5) 3 58 36 3 * (5,quitelongstring,6) 4 58 6 4 * (5,quitelongstring,7) 9 58 39 9 * (5,quitelongstring,8) 4 58 4 4 * memmove (0,a,1) 54 54 60 54 * (0,a,2) 54 54 60 54 * (0,ab,3) 54 54 60 54 * (0,abc,4) 54 54 60 54 * (0,abcd,5) 61 61 68 61 * (0,abcde,6) 61 61 68 61 * (0,abcdef,7) 61 61 68 61 * (0,abcdefg,8) 94 94 68 94 (0,quitelongstring,0) 54 54 60 54 * (0,quitelongstring,1) 54 54 60 54 * (0,quitelongstring,2) 54 54 60 54 * (0,quitelongstring,3) 54 54 60 54 * (0,quitelongstring,4) 54 54 60 54 * (0,quitelongstring,5) 61 61 68 61 * (0,quitelongstring,6) 61 61 68 61 * (0,quitelongstring,7) 61 61 68 61 * (0,quitelongstring,8) 94 94 68 94 (5,a,1) 54 54 57 54 * (5,a,2) 54 54 58 54 * (5,ab,3) 54 54 58 54 * (5,abc,4) 54 54 58 54 * (5,abcd,5) 61 61 65 61 * (5,abcde,6) 61 61 65 61 * (5,abcdef,7) 61 61 65 61 * (5,abcdefg,8) 94 94 65 94 (5,quitelongstring,0) 54 54 59 54 * (5,quitelongstring,1) 54 54 57 54 * (5,quitelongstring,2) 54 54 58 54 * (5,quitelongstring,3) 54 54 58 54 * (5,quitelongstring,4) 54 54 58 54 * (5,quitelongstring,5) 61 61 65 61 * (5,quitelongstring,6) 61 61 65 61 * (5,quitelongstring,7) 61 61 65 61 * (5,quitelongstring,8) 94 94 65 94 mempcpy (0,a,1) 52 52 3 3 (0,a,2) 52 52 3 4 (0,ab,3) 52 52 3 3 (0,abc,4) 52 52 4 3 (0,abcd,5) 59 59 3 8 (0,abcde,6) 59 59 4 4 (0,abcdef,7) 59 59 9 9 (0,abcdefg,8) 59 59 4 4 (0,quitelongstring,0) 52 52 2 2 (0,quitelongstring,1) 52 52 3 3 (0,quitelongstring,2) 52 52 4 3 (0,quitelongstring,3) 52 52 3 8 (0,quitelongstring,4) 52 52 3 3 (0,quitelongstring,5) 59 59 8 3 (0,quitelongstring,6) 59 59 4 4 (0,quitelongstring,7) 59 59 9 9 (0,quitelongstring,8) 59 59 4 4 (5,a,1) 52 52 3 3 (5,a,2) 52 52 4 3 (5,ab,3) 52 52 3 8 (5,abc,4) 52 52 3 3 (5,abcd,5) 59 59 8 3 (5,abcde,6) 59 59 4 4 (5,abcdef,7) 59 59 9 9 (5,abcdefg,8) 59 59 4 4 (5,quitelongstring,0) 52 52 2 2 (5,quitelongstring,1) 52 52 3 3 (5,quitelongstring,2) 52 52 3 3 (5,quitelongstring,3) 52 52 8 3 (5,quitelongstring,4) 52 52 3 4 (5,quitelongstring,5) 59 59 3 3 (5,quitelongstring,6) 59 59 4 4 (5,quitelongstring,7) 59 59 9 9 (5,quitelongstring,8) 59 59 4 4 memset (0,0,0) 2 79 2 2 * (0,0,1) 2 79 2 2 * (0,0,10) 6 79 29 6 * (0,0,11) 7 79 35 7 * (0,0,12) 6 79 28 6 * (0,0,13) 7 79 29 7 * (0,0,14) 7 79 29 7 * (0,0,15) 7 79 35 7 * (0,0,16) 7 79 28 7 * (0,0,2) 3 79 3 3 * (0,0,3) 4 79 4 4 * (0,0,4) 3 79 3 3 * (0,0,5) 4 79 29 4 * (0,0,6) 4 79 29 4 * (0,0,7) 9 79 35 9 * (0,0,8) 4 79 28 4 * (0,0,9) 9 79 29 9 * (0,32,0) 2 79 2 2 * (0,32,1) 2 79 2 2 * (0,32,10) 8 79 30 8 * (0,32,11) 6 79 35 6 * (0,32,12) 8 79 29 8 * (0,32,13) 6 79 30 6 * (0,32,14) 6 76 30 6 * (0,32,15) 6 79 35 6 * (0,32,16) 7 79 29 7 * (0,32,2) 3 79 3 3 * (0,32,3) 3 79 3 3 * (0,32,4) 3 79 3 3 * (0,32,5) 3 79 30 3 * (0,32,6) 4 79 30 4 * (0,32,7) 9 79 35 9 * (0,32,8) 4 79 29 4 * (0,32,9) 9 79 30 9 * (5,0,0) 2 79 2 2 * (5,0,1) 2 79 2 2 * (5,0,10) 6 79 29 6 * (5,0,11) 7 79 35 7 * (5,0,12) 6 79 28 6 * (5,0,13) 7 79 29 7 * (5,0,14) 7 79 29 7 * (5,0,15) 7 79 35 7 * (5,0,16) 7 79 28 7 * (5,0,2) 3 79 3 3 * (5,0,3) 4 79 4 4 * (5,0,4) 3 79 3 3 * (5,0,5) 4 79 29 4 * (5,0,6) 4 79 29 4 * (5,0,7) 9 79 35 9 * (5,0,8) 4 79 28 4 * (5,0,9) 9 79 29 9 * (5,32,0) 2 79 2 2 * (5,32,1) 2 79 2 2 * (5,32,10) 8 79 30 8 * (5,32,11) 6 79 35 6 * (5,32,12) 8 79 29 8 * (5,32,13) 6 79 30 6 * (5,32,14) 7 79 30 7 * (5,32,15) 6 79 35 6 * (5,32,16) 6 79 29 6 * (5,32,2) 4 79 4 4 * (5,32,3) 3 79 3 3 * (5,32,4) 3 79 3 3 * (5,32,5) 3 79 30 3 * (5,32,6) 4 79 30 4 * (5,32,7) 9 79 35 9 * (5,32,8) 4 79 29 4 * (5,32,9) 9 79 30 9 * stpcpy (0,NUL) 42 42 135 3 (0,a) 42 42 138 3 (0,ab) 31 31 150 8 (0,abc) 46 46 147 3 (0,abcd) 56 56 153 3 (0,abcde) 55 55 153 4 (0,abcdef) 60 60 159 9 (0,abcdefg) 63 63 166 4 (5,NUL) 42 42 138 3 (5,a) 42 42 139 3 (5,ab) 31 31 162 3 (5,abc) 46 46 147 4 (5,abcd) 56 56 160 3 (5,abcde) 55 55 164 4 (5,abcdef) 60 60 181 9 (5,abcdefg) 63 63 167 4 strchr (0,0,0) 82 82 83 61 (0,0,65) 84 84 85 84 * (5,0,0) 78 78 63 52 (5,0,65) 80 80 64 80 (abcde,0) 2 67 47 45 * (abcde,67) 2 69 49 2 * (abcdefghij,12) 2 79 69 2 * (abcdefghij,70) 2 79 69 2 * strcmp (0,a) 50 19 28 3 (0,ab) 50 19 28 3 (0,abc) 50 19 28 3 (0,abcd) 50 19 28 50 (0,abcde) 50 19 28 50 (0,abcdef) 50 19 28 50 (5,a) 55 23 40 4 (5,ab) 55 23 50 5 (5,abc) 55 23 50 5 (5,abcd) 55 23 50 55 (5,abcde) 55 23 50 55 (5,abcdef) 55 23 40 55 (NUL,NUL) 2 19 29 2 * (NUL,abcd) 2 19 28 2 * (a,0) 50 19 28 4 (a,5) 55 23 50 3 (a,a) 2 23 51 2 * (ab,0) 50 19 28 4 (ab,5) 55 23 50 6 (ab,abcd) 2 27 59 2 * (abc,0) 50 19 28 4 (abc,5) 55 23 40 6 (abcd,0) 50 19 28 50 (abcd,5) 55 23 50 55 (abcd,NUL) 2 19 28 2 * (abcd,abc) 2 31 69 2 * (abcd,abcd) 2 35 71 50 * (abcde,0) 50 19 28 50 (abcde,5) 55 23 50 55 (abcdef,0) 50 19 28 50 (abcdef,5) 55 23 50 55 strcpy (0,NUL) 3 42 20 3 * (0,a) 3 42 33 3 * (0,ab) 8 31 40 3 (0,abc) 3 45 53 4 * (0,abcd) 3 56 57 3 * (0,abcde) 4 55 52 4 * (0,abcdef) 9 60 56 9 * (0,abcdefg) 4 63 61 4 * (5,NUL) 3 42 20 3 * (5,a) 3 42 33 4 * (5,ab) 3 31 46 3 * (5,abc) 4 45 53 3 (5,abcd) 3 56 57 8 * (5,abcde) 4 55 52 4 * (5,abcdef) 9 60 56 9 * (5,abcdefg) 4 63 61 4 * strcspn (0,NUL) 26 126 304 27 * (0,a) 106 106 196 28 (0,ab) 110 110 221 33 (0,abcd) 119 119 252 119 * (0,aln) 110 110 157 17 (0,tal) 112 112 185 27 (5,NUL) 56 113 219 56 * (5,a) 93 93 101 6 (5,ab) 99 99 106 7 (5,abcd) 107 107 112 107 * (5,aln) 106 106 110 7 (5,tal) 106 106 114 7 (abc,c) 2 99 150 14 * (abcdef,fed) 2 112 194 27 * (abcdefghijk,fi) 2 110 221 30 * strncat (0,a,2) 52 70 120 52 * (0,a,3) 52 70 120 52 * (0,ab,4) 54 73 136 54 * (0,abc,5) 63 77 140 63 * (0,abcd,6) 56 79 154 56 * (0,abcde,7) 76 85 149 76 * (0,abcdef,8) 61 85 152 61 * (0,quitelongstring,0) 2 69 118 2 * (0,quitelongstring,1) 70 70 119 70 * (0,quitelongstring,2) 76 76 131 76 * (0,quitelongstring,3) 79 79 136 79 * (0,quitelongstring,4) 80 80 138 80 * (0,quitelongstring,5) 81 81 142 81 * (0,quitelongstring,6) 88 88 146 88 * (0,quitelongstring,7) 91 91 150 91 * (0,quitelongstring,8) 90 90 155 90 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 124 238 358 124 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 164 164 245 164 * (5,a,2) 50 60 98 50 * (5,a,3) 50 60 98 50 * (5,ab,4) 54 63 114 54 * (5,abc,5) 63 67 128 63 * (5,abcd,6) 55 69 132 55 * (5,abcde,7) 75 75 127 75 * (5,abcdef,8) 62 72 130 62 * (5,quitelongstring,0) 2 59 96 2 * (5,quitelongstring,1) 60 60 97 60 * (5,quitelongstring,2) 66 66 100 66 * (5,quitelongstring,3) 69 69 114 69 * (5,quitelongstring,4) 70 70 120 70 * (5,quitelongstring,5) 71 71 120 71 * (5,quitelongstring,6) 78 78 124 78 * (5,quitelongstring,7) 79 79 128 79 * (5,quitelongstring,8) 80 80 133 80 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 123 224 336 123 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 154 154 223 154 * strncpy (0,a,2) 3 37 38 3 * (0,a,3) 3 41 38 3 * (0,ab,4) 4 41 44 4 * (0,abc,5) 3 43 46 3 * (0,abcd,6) 4 48 50 4 * (0,abcde,7) 9 52 67 9 * (0,abcdef,8) 4 51 71 4 * (0,quitelongstring,0) 2 29 17 2 * (0,quitelongstring,1) 3 32 31 3 * (0,quitelongstring,2) 4 37 35 4 * (0,quitelongstring,3) 3 42 37 3 * (0,quitelongstring,4) 3 41 42 3 * (0,quitelongstring,5) 8 44 48 8 * (0,quitelongstring,6) 4 48 52 4 * (0,quitelongstring,7) 9 53 57 9 * (0,quitelongstring,8) 4 51 61 4 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 284 284 406 284 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 12 118 149 12 * (5,a,2) 4 37 38 4 * (5,a,3) 3 41 38 3 * (5,ab,4) 3 41 44 3 * (5,abc,5) 8 43 46 8 * (5,abcd,6) 4 48 50 4 * (5,abcde,7) 9 52 67 9 * (5,abcdef,8) 4 51 71 4 * (5,quitelongstring,0) 2 29 17 2 * (5,quitelongstring,1) 3 32 31 3 * (5,quitelongstring,2) 3 37 25 3 * (5,quitelongstring,3) 8 42 37 8 * (5,quitelongstring,4) 3 41 42 3 * (5,quitelongstring,5) 3 44 48 3 * (5,quitelongstring,6) 4 48 52 4 * (5,quitelongstring,7) 9 53 57 9 * (5,quitelongstring,8) 4 51 61 4 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 284 284 406 284 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 18 118 149 18 * strpbrk (0,NUL) 2 127 304 3 * (0,ab) 111 111 224 33 (0,abcd) 119 119 255 119 * (0,i) 55 95 104 55 * (0,int) 106 106 113 16 (5,NUL) 2 115 219 3 * (5,ab) 99 99 109 11 (5,abcd) 107 107 115 107 * (5,i) 52 99 142 52 * (5,int) 113 113 163 26 (abc,c) 2 99 153 52 * (abcdef,fed) 2 114 197 37 * (abcdefghijk,fi) 2 111 223 33 * strspn (0,NUL) 2 90 69 2 * (0,ab) 99 99 84 8 (0,abcd) 107 107 96 107 (0,i) 96 96 127 10 (0,int) 119 119 321 24 (5,NUL) 2 90 69 2 * (5,ab) 101 101 126 12 (5,abcd) 109 109 138 109 * (5,i) 93 93 76 5 (5,int) 106 106 91 9 (abc,c) 2 93 76 3 * (abcdef,fed) 2 106 91 8 * (abcdefghijk,fi) 2 99 84 7 * strstr (0,a) 65 61 299 65 * (0,ion) 98 98 584 98 * (0,on) 88 88 598 88 * (0,tion) 94 94 550 94 * (5,a) 44 31 80 44 * (5,ion) 69 69 354 69 * (5,on) 74 74 383 74 * (5,tion) 82 82 315 82 * (NUL,NUL) 2 26 76 2 * (NUL,a) 2 27 110 2 * (NUL,ab) 2 27 115 2 * (NUL,abc) 2 27 119 2 * (a,NUL) 2 26 73 2 * (a,a) 2 31 84 2 * (ab,NUL) 2 26 73 2 * (abc,NUL) 2 26 73 2 * (abc,c) 2 37 160 2 * (abcdef,def) 2 55 220 2 * (abcdef,ef) 2 54 254 2 * -------------- next part -------------- gcc nob str str2 memcpy (0,a,1) 14 48 23 14 * (0,a,2) 16 49 29 16 * (0,ab,3) 17 48 24 17 * (0,abc,4) 14 48 23 14 * (0,abcd,5) 15 56 52 15 * (0,abcde,6) 17 56 26 17 * (0,abcdef,7) 18 56 55 18 * (0,abcdefg,8) 15 56 31 15 * (0,quitelongstring,0) 10 48 18 10 * (0,quitelongstring,1) 14 48 23 14 * (0,quitelongstring,2) 16 48 23 16 * (0,quitelongstring,3) 17 48 24 17 * (0,quitelongstring,4) 14 48 23 14 * (0,quitelongstring,5) 15 56 52 15 * (0,quitelongstring,6) 17 56 26 17 * (0,quitelongstring,7) 18 56 55 18 * (0,quitelongstring,8) 15 56 24 15 * (5,a,1) 16 50 25 16 * (5,a,2) 17 50 31 17 * (5,ab,3) 18 50 26 18 * (5,abc,4) 16 66 25 16 * (5,abcd,5) 15 57 53 15 * (5,abcde,6) 22 57 25 22 * (5,abcdef,7) 23 57 57 23 * (5,abcdefg,8) 15 57 38 15 * (5,quitelongstring,0) 10 50 20 10 * (5,quitelongstring,1) 16 50 25 16 * (5,quitelongstring,2) 17 50 25 17 * (5,quitelongstring,3) 18 50 26 18 * (5,quitelongstring,4) 16 50 25 16 * (5,quitelongstring,5) 15 57 53 15 * (5,quitelongstring,6) 22 57 25 22 * (5,quitelongstring,7) 23 57 57 23 * (5,quitelongstring,8) 15 57 26 15 * memmove (0,a,1) 52 52 64 52 * (0,a,2) 54 54 76 54 * (0,ab,3) 52 52 86 52 * (0,abc,4) 52 52 66 52 * (0,abcd,5) 60 60 77 60 * (0,abcde,6) 60 60 77 60 * (0,abcdef,7) 60 60 77 60 * (0,abcdefg,8) 94 94 77 94 (0,quitelongstring,0) 52 52 74 52 * (0,quitelongstring,1) 52 52 64 52 * (0,quitelongstring,2) 52 52 76 52 * (0,quitelongstring,3) 52 52 69 52 * (0,quitelongstring,4) 52 52 69 52 * (0,quitelongstring,5) 60 60 77 60 * (0,quitelongstring,6) 60 60 77 60 * (0,quitelongstring,7) 60 60 77 60 * (0,quitelongstring,8) 94 94 77 94 (5,a,1) 54 54 64 54 * (5,a,2) 54 54 75 54 * (5,ab,3) 54 54 69 54 * (5,abc,4) 72 72 69 72 (5,abcd,5) 62 62 80 62 * (5,abcde,6) 62 62 77 62 * (5,abcdef,7) 62 62 77 62 * (5,abcdefg,8) 94 94 77 94 (5,quitelongstring,0) 54 54 75 54 * (5,quitelongstring,1) 54 54 64 54 * (5,quitelongstring,2) 54 54 75 54 * (5,quitelongstring,3) 54 54 69 54 * (5,quitelongstring,4) 54 54 69 54 * (5,quitelongstring,5) 62 62 77 62 * (5,quitelongstring,6) 62 62 77 62 * (5,quitelongstring,7) 62 62 77 62 * (5,quitelongstring,8) 94 94 77 94 mempcpy (0,a,1) 49 49 44 44 (0,a,2) 49 49 47 49 (0,ab,3) 49 49 47 47 (0,abc,4) 49 49 37 37 (0,abcd,5) 57 57 34 34 (0,abcde,6) 57 57 29 29 (0,abcdef,7) 57 57 27 27 (0,abcdefg,8) 57 57 15 15 (0,quitelongstring,0) 49 49 12 12 (0,quitelongstring,1) 49 49 14 14 (0,quitelongstring,2) 49 49 20 20 (0,quitelongstring,3) 49 49 20 20 (0,quitelongstring,4) 49 49 14 14 (0,quitelongstring,5) 57 57 14 14 (0,quitelongstring,6) 57 57 22 22 (0,quitelongstring,7) 57 57 22 22 (0,quitelongstring,8) 57 57 15 15 (5,a,1) 51 51 44 44 (5,a,2) 51 51 48 48 (5,ab,3) 51 51 48 48 (5,abc,4) 67 67 40 40 (5,abcd,5) 58 58 34 34 (5,abcde,6) 58 58 29 29 (5,abcdef,7) 58 58 26 26 (5,abcdefg,8) 58 58 15 15 (5,quitelongstring,0) 51 51 12 12 (5,quitelongstring,1) 51 51 14 14 (5,quitelongstring,2) 51 51 20 20 (5,quitelongstring,3) 51 51 20 20 (5,quitelongstring,4) 51 51 17 17 (5,quitelongstring,5) 57 58 17 17 (5,quitelongstring,6) 58 58 22 22 (5,quitelongstring,7) 58 58 22 22 (5,quitelongstring,8) 58 58 15 15 memset (0,0,0) 10 78 12 10 * (0,0,1) 13 78 14 13 * (0,0,10) 17 78 42 17 * (0,0,11) 18 78 46 18 * (0,0,12) 16 78 42 16 * (0,0,13) 17 78 42 17 * (0,0,14) 18 78 42 18 * (0,0,15) 19 78 46 19 * (0,0,16) 17 78 42 17 * (0,0,2) 16 78 20 16 * (0,0,3) 18 78 20 18 * (0,0,4) 14 78 14 14 * (0,0,5) 15 78 42 15 * (0,0,6) 17 78 42 17 * (0,0,7) 18 78 46 18 * (0,0,8) 15 78 42 15 * (0,0,9) 16 78 42 16 * (0,32,0) 10 78 12 10 * (0,32,1) 13 78 14 13 * (0,32,10) 17 78 43 17 * (0,32,11) 18 78 44 18 * (0,32,12) 16 78 42 16 * (0,32,13) 17 78 43 17 * (0,32,14) 18 78 43 18 * (0,32,15) 19 78 44 19 * (0,32,16) 17 78 42 17 * (0,32,2) 16 78 20 16 * (0,32,3) 18 78 20 18 * (0,32,4) 14 78 14 14 * (0,32,5) 15 78 43 15 * (0,32,6) 17 78 43 17 * (0,32,7) 18 78 44 18 * (0,32,8) 15 78 42 15 * (0,32,9) 16 78 43 16 * (5,0,0) 10 78 12 10 * (5,0,1) 16 78 16 16 * (5,0,10) 17 78 45 17 * (5,0,11) 18 78 47 18 * (5,0,12) 16 78 44 16 * (5,0,13) 17 78 45 17 * (5,0,14) 18 78 45 18 * (5,0,15) 19 78 47 19 * (5,0,16) 17 78 44 17 * (5,0,2) 17 78 20 17 * (5,0,3) 17 78 20 17 * (5,0,4) 16 78 15 16 (5,0,5) 15 78 45 15 * (5,0,6) 22 78 45 22 * (5,0,7) 23 78 47 23 * (5,0,8) 15 78 44 15 * (5,0,9) 16 78 45 16 * (5,32,0) 10 78 12 10 * (5,32,1) 16 78 16 16 * (5,32,10) 17 78 45 17 * (5,32,11) 18 78 47 18 * (5,32,12) 16 78 45 16 * (5,32,13) 17 78 45 17 * (5,32,14) 18 78 45 18 * (5,32,15) 19 78 47 19 * (5,32,16) 17 78 45 17 * (5,32,2) 17 78 20 17 * (5,32,3) 17 78 20 17 * (5,32,4) 16 78 15 16 (5,32,5) 15 78 45 15 * (5,32,6) 22 78 45 22 * (5,32,7) 23 78 47 23 * (5,32,8) 15 78 45 15 * (5,32,9) 16 78 45 16 * stpcpy (0,NUL) 49 49 141 50 * (0,a) 57 57 146 46 (0,ab) 35 35 161 43 * (0,abc) 53 53 158 39 (0,abcd) 63 63 160 38 (0,abcde) 61 61 166 30 (0,abcdef) 67 67 168 27 (0,abcdefg) 70 70 167 15 (5,NUL) 49 49 142 51 * (5,a) 49 49 161 46 (5,ab) 35 35 162 44 * (5,abc) 53 53 160 39 (5,abcd) 71 71 189 39 (5,abcde) 61 61 173 30 (5,abcdef) 67 67 167 26 (5,abcdefg) 70 70 168 15 strchr (0,0,0) 86 86 92 61 (0,0,65) 88 88 96 88 * (5,0,0) 83 83 75 56 (5,0,65) 86 86 76 86 (abcde,0) 10 69 56 47 * (abcde,67) 0 71 59 0 * (abcdefghij,12) 0 81 79 0 * (abcdefghij,70) 0 81 79 0 * strcmp (0,a) 62 21 39 11 (0,ab) 62 21 39 11 (0,abc) 62 21 39 11 (0,abcd) 62 21 39 62 (0,abcde) 62 21 39 62 (0,abcdef) 62 21 39 62 (5,a) 75 29 53 12 (5,ab) 69 29 53 14 (5,abc) 69 29 53 14 (5,abcd) 69 29 53 69 (5,abcde) 69 29 53 69 (5,abcdef) 69 29 53 69 (NUL,NUL) 0 23 39 10 * (NUL,abcd) 0 21 38 10 * (a,0) 62 21 39 12 (a,5) 75 26 53 13 (a,a) 0 30 50 10 * (ab,0) 62 21 39 12 (ab,5) 69 26 53 14 (ab,abcd) 0 29 60 10 * (abc,0) 62 21 39 12 (abc,5) 69 26 53 14 (abcd,0) 62 21 39 62 (abcd,5) 69 26 53 69 (abcd,NUL) 0 21 38 10 * (abcd,abc) 0 33 71 10 * (abcd,abcd) 0 39 83 59 * (abcde,0) 62 21 39 62 (abcde,5) 69 26 53 69 (abcdef,0) 62 21 39 62 (abcdef,5) 69 26 53 69 strcpy (0,NUL) 14 49 26 50 * (0,a) 16 57 31 48 * (0,ab) 17 35 31 43 * (0,abc) 14 52 34 39 * (0,abcd) 15 63 38 38 * (0,abcde) 17 61 55 23 * (0,abcdef) 18 67 59 23 * (0,abcdefg) 15 70 64 16 * (5,NUL) 16 49 28 50 * (5,a) 17 49 30 46 * (5,ab) 18 35 33 42 * (5,abc) 16 52 54 40 * (5,abcd) 15 71 41 38 * (5,abcde) 22 61 57 23 * (5,abcdef) 23 67 61 25 * (5,abcdefg) 15 70 65 16 * strcspn (0,NUL) 33 127 317 35 * (0,a) 108 108 211 31 (0,ab) 112 112 234 37 (0,abcd) 120 120 267 120 * (0,aln) 111 111 158 30 (0,tal) 116 116 200 34 (5,NUL) 61 116 229 61 * (5,a) 96 96 109 16 (5,ab) 102 102 114 16 (5,abcd) 110 110 120 110 * (5,aln) 108 108 118 16 (5,tal) 108 108 123 16 (abc,c) 0 98 165 19 * (abcdef,fed) 0 114 222 32 * (abcdefghijk,fi) 0 110 234 35 * strncat (0,a,2) 54 72 122 54 * (0,a,3) 54 72 122 54 * (0,ab,4) 56 75 142 56 * (0,abc,5) 62 80 152 62 * (0,abcd,6) 63 82 157 63 * (0,abcde,7) 96 117 173 96 * (0,abcdef,8) 63 88 158 63 * (0,quitelongstring,0) 10 71 125 10 * (0,quitelongstring,1) 75 75 121 75 * (0,quitelongstring,2) 78 78 127 78 * (0,quitelongstring,3) 81 81 141 81 * (0,quitelongstring,4) 83 83 146 83 * (0,quitelongstring,5) 84 84 151 84 * (0,quitelongstring,6) 91 91 156 91 * (0,quitelongstring,7) 94 94 161 94 * (0,quitelongstring,8) 93 93 166 93 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 120 241 413 120 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 167 167 276 167 * (5,a,2) 52 62 104 52 * (5,a,3) 52 62 104 52 * (5,ab,4) 55 65 133 55 * (5,abc,5) 65 67 125 65 * (5,abcd,6) 67 71 128 67 * (5,abcde,7) 97 105 160 97 * (5,abcdef,8) 62 76 138 62 * (5,quitelongstring,0) 10 61 104 10 * (5,quitelongstring,1) 62 62 111 62 * (5,quitelongstring,2) 68 68 116 68 * (5,quitelongstring,3) 71 71 121 71 * (5,quitelongstring,4) 69 69 123 69 * (5,quitelongstring,5) 72 72 127 72 * (5,quitelongstring,6) 79 79 132 79 * (5,quitelongstring,7) 82 82 136 82 * (5,quitelongstring,8) 82 82 141 82 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 129 229 343 129 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 155 155 230 155 * strncpy (0,a,2) 16 42 47 16 * (0,a,3) 17 45 47 17 * (0,ab,4) 14 43 49 14 * (0,abc,5) 15 46 50 15 * (0,abcd,6) 17 52 56 17 * (0,abcde,7) 18 55 70 18 * (0,abcdef,8) 15 55 74 15 * (0,quitelongstring,0) 10 30 24 10 * (0,quitelongstring,1) 14 34 28 14 * (0,quitelongstring,2) 16 38 32 16 * (0,quitelongstring,3) 17 43 35 17 * (0,quitelongstring,4) 14 43 38 14 * (0,quitelongstring,5) 15 46 49 15 * (0,quitelongstring,6) 17 51 53 17 * (0,quitelongstring,7) 18 56 58 18 * (0,quitelongstring,8) 15 55 62 15 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 291 291 407 291 * (0,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 20 121 150 20 * (5,a,2) 17 38 50 17 * (5,a,3) 18 42 50 18 * (5,ab,4) 16 42 52 16 * (5,abc,5) 15 62 65 15 * (5,abcd,6) 22 50 59 22 * (5,abcde,7) 23 54 72 23 * (5,abcdef,8) 15 55 76 15 * (5,quitelongstring,0) 10 30 26 10 * (5,quitelongstring,1) 16 33 30 16 * (5,quitelongstring,2) 17 38 34 17 * (5,quitelongstring,3) 18 43 37 18 * (5,quitelongstring,4) 16 43 40 16 * (5,quitelongstring,5) 15 46 52 15 * (5,quitelongstring,6) 22 50 56 22 * (5,quitelongstring,7) 23 55 61 23 * (5,quitelongstring,8) 15 53 65 15 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,100) 294 294 410 294 * (5,reallyhugeverylongstringwhichisinfactlongerthanthelastone,30) 25 124 153 25 * strpbrk (0,NUL) 0 128 316 10 * (0,ab) 112 112 234 45 (0,abcd) 120 120 266 120 * (0,i) 59 97 111 59 * (0,int) 111 111 120 19 (5,NUL) 0 118 239 10 * (5,ab) 102 102 121 21 (5,abcd) 110 110 127 110 * (5,i) 57 102 161 57 * (5,int) 115 115 182 30 (abc,c) 10 99 155 54 * (abcdef,fed) 10 113 210 36 * (abcdefghijk,fi) 10 110 236 40 * strspn (0,NUL) 0 92 83 10 * (0,ab) 101 101 99 18 (0,abcd) 109 109 112 109 * (0,i) 98 98 127 15 (0,int) 119 119 331 39 (5,NUL) 0 93 83 10 * (5,ab) 106 106 131 21 (5,abcd) 113 113 143 113 * (5,i) 96 96 91 14 (5,int) 108 108 109 19 (abc,c) 0 93 91 11 * (abcdef,fed) 0 105 109 15 * (abcdefghijk,fi) 0 99 100 13 * strstr (0,a) 69 58 297 69 * (0,ion) 104 104 592 104 * (0,on) 88 88 608 88 * (0,tion) 95 95 560 95 * (5,a) 49 33 95 49 * (5,ion) 70 70 366 70 * (5,on) 73 73 397 73 * (5,tion) 81 81 326 81 * (NUL,NUL) 10 28 86 10 * (NUL,a) 0 29 120 0 * (NUL,ab) 0 29 125 0 * (NUL,abc) 0 29 129 0 * (a,NUL) 10 28 85 10 * (a,a) 10 33 94 10 * (ab,NUL) 10 28 85 10 * (abc,NUL) 10 28 85 10 * (abc,c) 10 37 170 10 * (abcdef,def) 10 54 230 10 * (abcdef,ef) 10 54 266 10 * From wmglo@dent.med.uni-muenchen.de Thu Nov 22 13:50:00 2001 From: wmglo@dent.med.uni-muenchen.de (Wolfram Gloger) Date: Thu, 22 Nov 2001 13:50:00 -0000 Subject: linuxthread race condition In-Reply-To: (message from Andreas Schwab on 20 Nov 2001 23:02:50 +0100) References: Message-ID: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> > There is a race condition in linuxthreads during thread creation on > architectures that use a dedicated thread register. Between the point the > thread is created and inserted in the list of active threads, and the > point the thread register is initialized in the child a cancel signal may > arrive, with the thread manager calling pthread_handle_exit. ... > To fix this race I have blocked the cancel signal in the manager around > the clone call, so that the child does not call the signal handler before > thread_self is initialized. Wouldn't it be enough to check for this special case in pthread_handle_sigcancel(), like so: static void pthread_handle_sigcancel(int sig) { pthread_descr self = thread_self(); sigjmp_buf * jmpbuf; if (self == &__pthread_manager_thread) { if (thread_self_stack() == &__pthread_manager_thread) { __pthread_manager_sighandler(sig); return; } /* Oops, thread_self() isn't working yet.. */ self = thread_self_stack(); } ... with thread_self_stack() being the current 'normal' thread_self(). I'd rather see cancellation becoming a little slower than every pthread_create() requiring two more system calls. Regards, Wolfram. From drepper@redhat.com Mon Nov 26 06:54:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 26 Nov 2001 06:54:00 -0000 Subject: [PATCH] 32bit ID patches In-Reply-To: <20011122145219.A13702@suse.de> References: <20011122145219.A13702@suse.de> Message-ID: Thorsten Kukuk writes: > in some places in glibc code we use signed values for user id and > group id, but with linux they are unsigned. Appended is a patch for > the cases I found. Thanks, I've applied the patch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Mon Nov 26 14:20:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Mon, 26 Nov 2001 14:20:00 -0000 Subject: linuxthread race condition In-Reply-To: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> (Wolfram Gloger's message of "26 Nov 2001 22:20:18 -0000") References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> Message-ID: Wolfram Gloger writes: |> > There is a race condition in linuxthreads during thread creation on |> > architectures that use a dedicated thread register. Between the point the |> > thread is created and inserted in the list of active threads, and the |> > point the thread register is initialized in the child a cancel signal may |> > arrive, with the thread manager calling pthread_handle_exit. |> ... |> > To fix this race I have blocked the cancel signal in the manager around |> > the clone call, so that the child does not call the signal handler before |> > thread_self is initialized. |> |> Wouldn't it be enough to check for this special case in |> pthread_handle_sigcancel(), like so: |> |> static void pthread_handle_sigcancel(int sig) |> { |> pthread_descr self = thread_self(); |> sigjmp_buf * jmpbuf; |> |> if (self == &__pthread_manager_thread) |> { |> if (thread_self_stack() == &__pthread_manager_thread) |> { |> __pthread_manager_sighandler(sig); |> return; |> } |> /* Oops, thread_self() isn't working yet.. */ |> self = thread_self_stack(); |> } |> ... |> |> with thread_self_stack() being the current 'normal' thread_self(). Would this thread_self_stack work with FLOATING_STACKS? What if the stack size of the new thread is wildly different from STACK_SIZE? I don't think that thread_self_stack can always return a valid thread descriptor. Andreas. -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From wmglo@dent.med.uni-muenchen.de Mon Nov 26 19:44:00 2001 From: wmglo@dent.med.uni-muenchen.de (Wolfram Gloger) Date: Mon, 26 Nov 2001 19:44:00 -0000 Subject: linuxthread race condition In-Reply-To: (message from Andreas Schwab on 27 Nov 2001 11:10:23 +0100) References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> Message-ID: <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> > Would this thread_self_stack work with FLOATING_STACKS? What if the stack > size of the new thread is wildly different from STACK_SIZE? I don't think > that thread_self_stack can always return a valid thread descriptor. You're right, I forgot about FLOATING_STACKS at first. However, thread_self_stack could look like the existing __pthread_find_self, except that it would also look for the initial thread and the manager thread's stack. Certainly slower, but in the normal case where it is only the manager stack that needs to be found, it is fast enough, I believe (just 4 or so pointer comparisons). Regards, Wolfram. From jakub@redhat.com Tue Nov 27 02:10:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 27 Nov 2001 02:10:00 -0000 Subject: [PATCH] Fix sparc mathinline.h warnings Message-ID: <20011128163059.M572@sunsite.ms.mff.cuni.cz> Hi! Without this patch one gets: /usr/include/bits/mathinline.h:107: warning: no previous prototype for `__signbitf' /usr/include/bits/mathinline.h:116: warning: no previous prototype for `__signbit' /usr/include/bits/mathinline.h:123: warning: no previous prototype for `__signbitl' warnings with -Wmissing-prototypes (unless -std=c99 or -std=gnu99). 2001-11-28 Jakub Jelinek * sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit, __signbitl): Only define for ISO C99. --- libc/sysdeps/sparc/fpu/bits/mathinline.h 2001/07/06 04:56:04 1.8 +++ libc/sysdeps/sparc/fpu/bits/mathinline.h 2001/11/28 15:19:39 @@ -101,7 +101,10 @@ /* The gcc, version 2.7 or below, has problems with all this inlining code. So disable it for this version of the compiler. */ # if __GNUC_PREREQ (2, 8) - /* Test for negative number. Used in the signbit() macro. */ + +#if defined __USE_ISOC99 + +/* Test for negative number. Used in the signbit() macro. */ __MATH_INLINE int __signbitf (float __x) __THROW { @@ -142,6 +145,8 @@ __signbitl (long double __x) __THROW #endif /* sparc64 */ +#endif /* __USE_ISOC99 */ + #ifndef __NO_MATH_INLINES __MATH_INLINE double @@ -171,7 +176,7 @@ sqrtl(long double __x) __THROW } #endif /* sparc64 */ -#endif +#endif /* !__NO_MATH_INLINES */ /* This code is used internally in the GNU libc. */ #ifdef __LIBC_INTERNAL_MATH_INLINES Jakub From drepper@redhat.com Tue Nov 27 06:49:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 27 Nov 2001 06:49:00 -0000 Subject: [PATCH] Fix sparc mathinline.h warnings In-Reply-To: <20011128163059.M572@sunsite.ms.mff.cuni.cz> References: <20011128163059.M572@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > 2001-11-28 Jakub Jelinek > > * sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit, > __signbitl): Only define for ISO C99. I've applied the patch (and cleaned the file up a bit). -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Wed Nov 28 07:27:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 28 Nov 2001 07:27:00 -0000 Subject: [PATCH] Fix glob segfault and nested braces handling Message-ID: <20011129132556.O572@sunsite.ms.mff.cuni.cz> Hi! Please see http://sources.redhat.com/ml/bug-glibc/2001-11/msg00109.html for description. I have slightly changed next_brace_sub so that it doesn't use break and doesn't compare character with '}' twice, plus added tests to globtest.sh. Bootstrapped on i686, no make check regressions. 2001-11-29 Jakub Jelinek * sysdeps/generic/glob.c (next_brace_sub): Return NULL if braces don't match, fix {{a,b},c} globbing, clean up. Patch by Flavio Veloso . * posix/globtest.sh: Add new tests. --- libc/posix/globtest.sh.jj Thu Aug 23 18:48:53 2001 +++ libc/posix/globtest.sh Thu Nov 29 13:32:05 2001 @@ -146,6 +146,32 @@ if test $failed -ne 0; then result=1 fi +failed=0 +${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" | +sort > $testout +cat <<"EOF" | cmp - $testout >> $logfile || failed=1 +`-file3' +`file1' +`file2' +EOF +if test $failed -ne 0; then + echo "Braces test 2 failed" >> $logfile + result=1 +fi + +failed=0 +${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${common_objpfx}posix/globtest -b "$testdir" "{" | +sort > $testout +cat <<"EOF" | cmp - $testout >> $logfile || failed=1 +GLOB_NOMATCH +EOF +if test $failed -ne 0; then + echo "Braces test 3 failed" >> $logfile + result=1 +fi + # Test NOCHECK failed=0 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ --- libc/sysdeps/generic/glob.c.jj Thu Aug 23 18:49:29 2001 +++ libc/sysdeps/generic/glob.c Thu Nov 29 13:17:21 2001 @@ -355,42 +355,14 @@ static inline #endif const char * -next_brace_sub (begin) - const char *begin; +next_brace_sub (cp) + const char *cp; { unsigned int depth = 0; - const char *cp = begin; - - while (1) - { - if (depth == 0) - { - if (*cp != ',' && *cp != '}' && *cp != '\0') - { - if (*cp == '{') - ++depth; - ++cp; - continue; - } - } - else - { - while (*cp != '\0' && (*cp != '}' || depth > 0)) - { - if (*cp == '}') - --depth; - ++cp; - } - if (*cp == '\0') - /* An incorrectly terminated brace expression. */ - return NULL; - - continue; - } - break; - } - - return cp; + while (*cp != '\0' && (*cp != '}' || depth--) && (*cp != ',' || depth)) + if (*cp++ == '{') + depth++; + return *cp != '\0' ? cp : NULL; } #endif /* !GLOB_ONLY_P */ Jakub From schwab@suse.de Wed Nov 28 13:14:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Wed, 28 Nov 2001 13:14:00 -0000 Subject: linuxthread race condition In-Reply-To: <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> (Wolfram Gloger's message of "27 Nov 2001 14:49:28 -0000") References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> Message-ID: Wolfram Gloger writes: |> > Would this thread_self_stack work with FLOATING_STACKS? What if the stack |> > size of the new thread is wildly different from STACK_SIZE? I don't think |> > that thread_self_stack can always return a valid thread descriptor. |> |> You're right, I forgot about FLOATING_STACKS at first. However, |> thread_self_stack could look like the existing __pthread_find_self, |> except that it would also look for the initial thread and the manager |> thread's stack. Certainly slower, but in the normal case where it is |> only the manager stack that needs to be found, it is fast enough, I |> believe (just 4 or so pointer comparisons). How about this, tested on ia64: 2001-11-29 Andreas Schwab * pthread.c (pthread_handle_sigcancel) [THREAD_SELF]: Double check that self is the manager thread. (thread_self_stack) [THREAD_SELF]: New function to find self via stack pointer. * manager.c (pthread_handle_create): Don't block cancel signal any more. Index: manager.c =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/manager.c,v retrieving revision 1.76 diff -u -a -r1.76 manager.c --- manager.c 2001/11/29 07:40:45 1.76 +++ manager.c 2001/11/29 21:19:24 @@ -534,7 +534,6 @@ size_t guardsize = 0; int pagesize = __getpagesize(); int saved_errno; - sigset_t newmask, oldmask; /* First check whether we have to change the policy and if yes, whether we can do this. Normally this should be done by examining the @@ -620,11 +619,6 @@ if ((mask & (__pthread_threads_events.event_bits[idx] | event_maskp->event_bits[idx])) != 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); /* Lock the mutex the child will use now so that it will stop. */ __pthread_lock(new_thread->p_lock, NULL); @@ -653,7 +647,6 @@ __pthread_sig_cancel, new_thread); #endif saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); if (pid != -1) { /* Now fill in the information about the new thread in @@ -679,11 +672,6 @@ } if (pid == 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); #ifdef NEED_SEPARATE_REGISTER_STACK pid = __clone2(pthread_start_thread, (void **)new_thread_bottom, @@ -700,7 +688,6 @@ __pthread_sig_cancel, new_thread); #endif /* !NEED_SEPARATE_REGISTER_STACK */ saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); } /* Check if cloning succeeded */ if (pid == -1) { Index: pthread.c =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/pthread.c,v retrieving revision 1.88 diff -u -a -r1.88 pthread.c --- pthread.c 2001/11/28 22:25:43 1.88 +++ pthread.c 2001/11/29 21:19:24 @@ -709,7 +709,7 @@ #ifndef THREAD_SELF -pthread_descr __pthread_find_self() +pthread_descr __pthread_find_self(void) { char * sp = CURRENT_STACK_FRAME; pthread_handle h; @@ -721,6 +721,27 @@ return h->h_descr; } +#else + +static pthread_descr thread_self_stack(void) +{ + char *sp = CURRENT_STACK_FRAME; + pthread_handle h; + + if (sp >= __pthread_initial_thread_bos) + return &__pthread_initial_thread; + else if (sp >= __pthread_manager_thread_bos + && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + else + { + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) + h++; + return h->h_descr; + } +} + #endif /* Thread scheduling */ @@ -769,7 +790,7 @@ return 0; } -int __pthread_yield () +int __pthread_yield (void) { /* For now this is equivalent with the POSIX call. */ return sched_yield (); @@ -841,8 +862,23 @@ if (self == &__pthread_manager_thread) { +#ifdef THREAD_SELF + /* A new thread might get a cancel signal before it is fully + initialized, so that the thread register might still point to the + manager thread. Double check that this is really the manager + thread. */ + pthread_descr real_self = thread_self_stack(); + if (real_self == &__pthread_manager_thread) + { + __pthread_manager_sighandler(sig); + return; + } + /* Oops, thread_self() isn't working yet.. */ + self = real_self; +#else __pthread_manager_sighandler(sig); return; +#endif } if (__builtin_expect (__pthread_exit_requested, 0)) { /* Main thread should accumulate times for thread manager and its @@ -884,7 +920,7 @@ Notice that we can't free the stack segments, as the forked thread may hold pointers into them. */ -void __pthread_reset_main_thread() +void __pthread_reset_main_thread(void) { pthread_descr self = thread_self(); struct rlimit limit; Andreas. -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From drepper@redhat.com Thu Nov 29 04:21:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 29 Nov 2001 04:21:00 -0000 Subject: [PATCH] Fix glob segfault and nested braces handling In-Reply-To: <20011129132556.O572@sunsite.ms.mff.cuni.cz> References: <20011129132556.O572@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Please see http://sources.redhat.com/ml/bug-glibc/2001-11/msg00109.html > for description. I have slightly changed next_brace_sub so that it doesn't > use break and doesn't compare character with '}' twice, plus added tests to > globtest.sh. Looks fine, I've applied it. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Thu Nov 29 13:22:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 29 Nov 2001 13:22:00 -0000 Subject: linuxthread race condition In-Reply-To: References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> Message-ID: Andreas Schwab writes: > +static pthread_descr thread_self_stack(void) > +{ > + char *sp = CURRENT_STACK_FRAME; > + pthread_handle h; > + > + if (sp >= __pthread_initial_thread_bos) > + return &__pthread_initial_thread; > + else if (sp >= __pthread_manager_thread_bos > + && sp < __pthread_manager_thread_tos) > + return &__pthread_manager_thread; > + else > + { > + h = __pthread_handles + 2; > + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) > + h++; > + return h->h_descr; > + } > +} > + > #endif This is overkill. You use this function to check whether the thread is the manager via the stack pointer. But the function contains a lot of tests and returns useful values for all other cases as well. All the tests except the first else are unnecessary. Instead you should introduce a function which returns a boolean value saying whether the thread is the manager or not. This can be implemented via the stack pointer, one could also simply call getpid() and compare this to the PID of the manager. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Thu Nov 29 13:56:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Thu, 29 Nov 2001 13:56:00 -0000 Subject: linuxthread race condition In-Reply-To: (Ulrich Drepper's message of "29 Nov 2001 16:54:18 -0800") References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> Message-ID: Ulrich Drepper writes: |> Andreas Schwab writes: |> |> > +static pthread_descr thread_self_stack(void) |> > +{ |> > + char *sp = CURRENT_STACK_FRAME; |> > + pthread_handle h; |> > + |> > + if (sp >= __pthread_initial_thread_bos) |> > + return &__pthread_initial_thread; |> > + else if (sp >= __pthread_manager_thread_bos |> > + && sp < __pthread_manager_thread_tos) |> > + return &__pthread_manager_thread; |> > + else |> > + { |> > + h = __pthread_handles + 2; |> > + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) |> > + h++; |> > + return h->h_descr; |> > + } |> > +} |> > + |> > #endif |> |> This is overkill. You use this function to check whether the thread |> is the manager via the stack pointer. But the function contains a lot |> of tests and returns useful values for all other cases as well. All |> the tests except the first else are unnecessary. No, they are not. We need the real thread descriptor for the rest of the signal handler. In fact, my patch is still not enough, we must call INIT_THREAD_SELF so that THREAD_GETMEM is using the correct thread pointer. Andreas. 2001-11-30 Andreas Schwab * pthread.c (pthread_handle_sigcancel) [THREAD_SELF]: Double check that self is the manager thread, and initialize the thread register if not. (thread_self_stack) [THREAD_SELF]: New function to find self via stack pointer. * manager.c (pthread_handle_create): Don't block cancel signal any more. --- manager.c.~1.76.~ Thu Nov 29 10:40:10 2001 +++ manager.c Thu Nov 29 20:37:59 2001 @@ -534,7 +534,6 @@ size_t guardsize = 0; int pagesize = __getpagesize(); int saved_errno; - sigset_t newmask, oldmask; /* First check whether we have to change the policy and if yes, whether we can do this. Normally this should be done by examining the @@ -620,11 +619,6 @@ if ((mask & (__pthread_threads_events.event_bits[idx] | event_maskp->event_bits[idx])) != 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); /* Lock the mutex the child will use now so that it will stop. */ __pthread_lock(new_thread->p_lock, NULL); @@ -653,7 +647,6 @@ __pthread_sig_cancel, new_thread); #endif saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); if (pid != -1) { /* Now fill in the information about the new thread in @@ -679,11 +672,6 @@ } if (pid == 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); #ifdef NEED_SEPARATE_REGISTER_STACK pid = __clone2(pthread_start_thread, (void **)new_thread_bottom, @@ -700,7 +688,6 @@ __pthread_sig_cancel, new_thread); #endif /* !NEED_SEPARATE_REGISTER_STACK */ saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); } /* Check if cloning succeeded */ if (pid == -1) { --- pthread.c.~1.88.~ Thu Nov 29 10:40:10 2001 +++ pthread.c Fri Nov 30 10:38:26 2001 @@ -709,7 +709,7 @@ #ifndef THREAD_SELF -pthread_descr __pthread_find_self() +pthread_descr __pthread_find_self(void) { char * sp = CURRENT_STACK_FRAME; pthread_handle h; @@ -721,6 +721,27 @@ return h->h_descr; } +#else + +static pthread_descr thread_self_stack(void) +{ + char *sp = CURRENT_STACK_FRAME; + pthread_handle h; + + if (sp >= __pthread_initial_thread_bos) + return &__pthread_initial_thread; + else if (sp >= __pthread_manager_thread_bos + && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + else + { + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) + h++; + return h->h_descr; + } +} + #endif /* Thread scheduling */ @@ -769,7 +790,7 @@ return 0; } -int __pthread_yield () +int __pthread_yield (void) { /* For now this is equivalent with the POSIX call. */ return sched_yield (); @@ -841,8 +862,26 @@ if (self == &__pthread_manager_thread) { +#ifdef THREAD_SELF + /* A new thread might get a cancel signal before it is fully + initialized, so that the thread register might still point to the + manager thread. Double check that this is really the manager + thread. */ + pthread_descr real_self = thread_self_stack(); + if (real_self == &__pthread_manager_thread) + { + __pthread_manager_sighandler(sig); + return; + } + /* Oops, thread_self() isn't working yet.. */ + self = real_self; +# ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +# endif +#else __pthread_manager_sighandler(sig); return; +#endif } if (__builtin_expect (__pthread_exit_requested, 0)) { /* Main thread should accumulate times for thread manager and its @@ -884,7 +923,7 @@ Notice that we can't free the stack segments, as the forked thread may hold pointers into them. */ -void __pthread_reset_main_thread() +void __pthread_reset_main_thread(void) { pthread_descr self = thread_self(); struct rlimit limit; -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From jakub@redhat.com Thu Nov 29 16:57:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 29 Nov 2001 16:57:00 -0000 Subject: linuxthread race condition In-Reply-To: ; from Andreas Schwab on Fri, Nov 30, 2001 at 10:42:51AM +0100 References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> Message-ID: <20011130105529.Q572@sunsite.ms.mff.cuni.cz> On Fri, Nov 30, 2001 at 10:42:51AM +0100, Andreas Schwab wrote: > + if (sp >= __pthread_initial_thread_bos) > + return &__pthread_initial_thread; How could it be initial thread? Even if it could (it cannot), for FLOATING_STACKS, this is totally bogus test (sp >= -1) and for non-floating stacks there is no guarantee that there are no thread stacks above initial thread stack (think about sparc64, where sp initial thread stack is below VM hole, while thread stacks can be in the mmap area (after VM hole)). Jakub From schwab@suse.de Fri Nov 30 01:42:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Fri, 30 Nov 2001 01:42:00 -0000 Subject: linuxthread race condition In-Reply-To: <20011130105529.Q572@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Fri, 30 Nov 2001 10:55:29 +0100") References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> <20011130105529.Q572@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: |> On Fri, Nov 30, 2001 at 10:42:51AM +0100, Andreas Schwab wrote: |> > + if (sp >= __pthread_initial_thread_bos) |> > + return &__pthread_initial_thread; |> |> How could it be initial thread? Even if it could (it cannot), for |> FLOATING_STACKS, this is totally bogus test (sp >= -1) and for non-floating |> stacks there is no guarantee that there are no thread stacks above initial |> thread stack (think about sparc64, where sp initial thread stack is below VM |> hole, while thread stacks can be in the mmap area (after VM hole)). Yes, you're right, these two lines should be taken out. We can never have the initial thread here. Andreas. -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From schwab@suse.de Fri Nov 30 01:52:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Fri, 30 Nov 2001 01:52:00 -0000 Subject: linuxthread race condition In-Reply-To: <20011130105529.Q572@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Fri, 30 Nov 2001 10:55:29 +0100") References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> <20011130105529.Q572@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: |> On Fri, Nov 30, 2001 at 10:42:51AM +0100, Andreas Schwab wrote: |> > + if (sp >= __pthread_initial_thread_bos) |> > + return &__pthread_initial_thread; |> |> How could it be initial thread? Even if it could (it cannot), for |> FLOATING_STACKS, this is totally bogus test (sp >= -1) and for non-floating |> stacks there is no guarantee that there are no thread stacks above initial |> thread stack (think about sparc64, where sp initial thread stack is below VM |> hole, while thread stacks can be in the mmap area (after VM hole)). Here is now the updated patch, again tested on ia64: 2001-11-30 Andreas Schwab * pthread.c (pthread_handle_sigcancel) [THREAD_SELF]: Double check that self is the manager thread, and initialize the thread register if not. (thread_self_stack) [THREAD_SELF]: New function to find self via stack pointer. * manager.c (pthread_handle_create): Don't block cancel signal any more. --- manager.c.~1.76.~ Thu Nov 29 10:40:10 2001 +++ manager.c Fri Nov 30 12:26:10 2001 @@ -534,7 +534,6 @@ size_t guardsize = 0; int pagesize = __getpagesize(); int saved_errno; - sigset_t newmask, oldmask; /* First check whether we have to change the policy and if yes, whether we can do this. Normally this should be done by examining the @@ -620,11 +619,6 @@ if ((mask & (__pthread_threads_events.event_bits[idx] | event_maskp->event_bits[idx])) != 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); /* Lock the mutex the child will use now so that it will stop. */ __pthread_lock(new_thread->p_lock, NULL); @@ -653,7 +647,6 @@ __pthread_sig_cancel, new_thread); #endif saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); if (pid != -1) { /* Now fill in the information about the new thread in @@ -679,11 +672,6 @@ } if (pid == 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); #ifdef NEED_SEPARATE_REGISTER_STACK pid = __clone2(pthread_start_thread, (void **)new_thread_bottom, @@ -700,7 +688,6 @@ __pthread_sig_cancel, new_thread); #endif /* !NEED_SEPARATE_REGISTER_STACK */ saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); } /* Check if cloning succeeded */ if (pid == -1) { --- pthread.c.~1.88.~ Thu Nov 29 10:40:10 2001 +++ pthread.c Fri Nov 30 12:27:44 2001 @@ -709,7 +709,7 @@ #ifndef THREAD_SELF -pthread_descr __pthread_find_self() +pthread_descr __pthread_find_self(void) { char * sp = CURRENT_STACK_FRAME; pthread_handle h; @@ -721,6 +721,21 @@ return h->h_descr; } +#else + +static pthread_descr thread_self_stack(void) +{ + char *sp = CURRENT_STACK_FRAME; + pthread_handle h; + + if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) + h++; + return h->h_descr; +} + #endif /* Thread scheduling */ @@ -769,7 +784,7 @@ return 0; } -int __pthread_yield () +int __pthread_yield (void) { /* For now this is equivalent with the POSIX call. */ return sched_yield (); @@ -841,8 +856,26 @@ if (self == &__pthread_manager_thread) { +#ifdef THREAD_SELF + /* A new thread might get a cancel signal before it is fully + initialized, so that the thread register might still point to the + manager thread. Double check that this is really the manager + thread. */ + pthread_descr real_self = thread_self_stack(); + if (real_self == &__pthread_manager_thread) + { + __pthread_manager_sighandler(sig); + return; + } + /* Oops, thread_self() isn't working yet.. */ + self = real_self; +# ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +# endif +#else __pthread_manager_sighandler(sig); return; +#endif } if (__builtin_expect (__pthread_exit_requested, 0)) { /* Main thread should accumulate times for thread manager and its @@ -884,7 +917,7 @@ Notice that we can't free the stack segments, as the forked thread may hold pointers into them. */ -void __pthread_reset_main_thread() +void __pthread_reset_main_thread(void) { pthread_descr self = thread_self(); struct rlimit limit; -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From drepper@redhat.com Fri Nov 30 02:18:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 30 Nov 2001 02:18:00 -0000 Subject: linuxthread race condition In-Reply-To: References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> <20011130105529.Q572@sunsite.ms.mff.cuni.cz> Message-ID: Andreas Schwab writes: > Here is now the updated patch, again tested on ia64: I've applied it. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Fri Nov 30 04:34:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Fri, 30 Nov 2001 04:34:00 -0000 Subject: linuxthread race condition References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> <20011130105529.Q572@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: |> On Fri, Nov 30, 2001 at 10:42:51AM +0100, Andreas Schwab wrote: |> > + if (sp >= __pthread_initial_thread_bos) |> > + return &__pthread_initial_thread; |> |> How could it be initial thread? Even if it could (it cannot), for |> FLOATING_STACKS, this is totally bogus test (sp >= -1) and for non-floating |> stacks there is no guarantee that there are no thread stacks above initial |> thread stack (think about sparc64, where sp initial thread stack is below VM |> hole, while thread stacks can be in the mmap area (after VM hole)). Here is now the updated patch, again tested on ia64: 2001-11-30 Andreas Schwab * pthread.c (pthread_handle_sigcancel) [THREAD_SELF]: Double check that self is the manager thread, and initialize the thread register if not. (thread_self_stack) [THREAD_SELF]: New function to find self via stack pointer. * manager.c (pthread_handle_create): Don't block cancel signal any more. --- manager.c.~1.76.~ Thu Nov 29 10:40:10 2001 +++ manager.c Fri Nov 30 12:26:10 2001 @@ -534,7 +534,6 @@ size_t guardsize = 0; int pagesize = __getpagesize(); int saved_errno; - sigset_t newmask, oldmask; /* First check whether we have to change the policy and if yes, whether we can do this. Normally this should be done by examining the @@ -620,11 +619,6 @@ if ((mask & (__pthread_threads_events.event_bits[idx] | event_maskp->event_bits[idx])) != 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); /* Lock the mutex the child will use now so that it will stop. */ __pthread_lock(new_thread->p_lock, NULL); @@ -653,7 +647,6 @@ __pthread_sig_cancel, new_thread); #endif saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); if (pid != -1) { /* Now fill in the information about the new thread in @@ -679,11 +672,6 @@ } if (pid == 0) { - /* Block cancel signal in the child until it is fully - initialized. */ - sigemptyset(&newmask); - sigaddset(&newmask, __pthread_sig_cancel); - sigprocmask(SIG_BLOCK, &newmask, &oldmask); #ifdef NEED_SEPARATE_REGISTER_STACK pid = __clone2(pthread_start_thread, (void **)new_thread_bottom, @@ -700,7 +688,6 @@ __pthread_sig_cancel, new_thread); #endif /* !NEED_SEPARATE_REGISTER_STACK */ saved_errno = errno; - sigprocmask(SIG_SETMASK, &oldmask, NULL); } /* Check if cloning succeeded */ if (pid == -1) { --- pthread.c.~1.88.~ Thu Nov 29 10:40:10 2001 +++ pthread.c Fri Nov 30 12:27:44 2001 @@ -709,7 +709,7 @@ #ifndef THREAD_SELF -pthread_descr __pthread_find_self() +pthread_descr __pthread_find_self(void) { char * sp = CURRENT_STACK_FRAME; pthread_handle h; @@ -721,6 +721,21 @@ return h->h_descr; } +#else + +static pthread_descr thread_self_stack(void) +{ + char *sp = CURRENT_STACK_FRAME; + pthread_handle h; + + if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos) + return &__pthread_manager_thread; + h = __pthread_handles + 2; + while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom)) + h++; + return h->h_descr; +} + #endif /* Thread scheduling */ @@ -769,7 +784,7 @@ return 0; } -int __pthread_yield () +int __pthread_yield (void) { /* For now this is equivalent with the POSIX call. */ return sched_yield (); @@ -841,8 +856,26 @@ if (self == &__pthread_manager_thread) { +#ifdef THREAD_SELF + /* A new thread might get a cancel signal before it is fully + initialized, so that the thread register might still point to the + manager thread. Double check that this is really the manager + thread. */ + pthread_descr real_self = thread_self_stack(); + if (real_self == &__pthread_manager_thread) + { + __pthread_manager_sighandler(sig); + return; + } + /* Oops, thread_self() isn't working yet.. */ + self = real_self; +# ifdef INIT_THREAD_SELF + INIT_THREAD_SELF(self, self->p_nr); +# endif +#else __pthread_manager_sighandler(sig); return; +#endif } if (__builtin_expect (__pthread_exit_requested, 0)) { /* Main thread should accumulate times for thread manager and its @@ -884,7 +917,7 @@ Notice that we can't free the stack segments, as the forked thread may hold pointers into them. */ -void __pthread_reset_main_thread() +void __pthread_reset_main_thread(void) { pthread_descr self = thread_self(); struct rlimit limit; -- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From drepper@redhat.com Fri Nov 30 13:21:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 30 Nov 2001 13:21:00 -0000 Subject: linuxthread race condition References: <20011126222018.1478.qmail@md.dent.med.uni-muenchen.de> <20011127144928.3244.qmail@md.dent.med.uni-muenchen.de> <20011130105529.Q572@sunsite.ms.mff.cuni.cz> Message-ID: Andreas Schwab writes: > Here is now the updated patch, again tested on ia64: I've applied it. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------