From gniibe@m17n.org Fri Sep 2 06:59:00 2005 From: gniibe@m17n.org (NIIBE Yutaka) Date: Fri, 02 Sep 2005 06:59:00 -0000 Subject: [Manual] memory access atomicity Message-ID: <200509020658.j826wW727389@mule.m17n.org> Hi, I found a bug in the description of sig_atomic_t. It said: In practice, you can assume that @code{int} and other integer types no longer than @code{int} are atomic. This is untrue, for example, 16-bit access or 8-bit access on Alpha is not atomic. Here is a patch to point out this issue. Index: signal.texi =================================================================== RCS file: /cvs/glibc/libc/manual/signal.texi,v retrieving revision 1.70 diff -u -3 -p -r1.70 signal.texi --- signal.texi 12 Jul 2004 21:44:33 -0000 1.70 +++ signal.texi 2 Sep 2005 06:37:07 -0000 @@ -2029,8 +2029,8 @@ This is an integer data type. Objects o atomically. @end deftp -In practice, you can assume that @code{int} and other integer types no -longer than @code{int} are atomic. You can also assume that pointer +In practice, you can assume that @code{int} is atomic. +You can also assume that pointer types are atomic; that is very convenient. Both of these assumptions are true on all of the machines that the GNU C library supports and on all POSIX systems we know of. From drepper@redhat.com Sun Sep 4 20:46:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 04 Sep 2005 20:46:00 -0000 Subject: [Manual] memory access atomicity In-Reply-To: <200509020658.j826wW727389@mule.m17n.org> References: <200509020658.j826wW727389@mule.m17n.org> Message-ID: <431B5C8E.2070002@redhat.com> I made the change. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From kkojima@rr.iij4u.or.jp Mon Sep 5 12:07:00 2005 From: kkojima@rr.iij4u.or.jp (Kaz Kojima) Date: Mon, 05 Sep 2005 12:07:00 -0000 Subject: SH: A typo in lowlevellock.S Message-ID: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> Hi, The appended patch fixes a typo in a low-level lock function. It set the correct 3rd argument for the futex syscall in loop. Sorry for missing such an embarrassing bug. Regards, kaz -- nptl/ChangeLog: 2005-09-05 Kaz Kojima * sysdeps/unix/sysv/linux/sh/lowlevellock.S (__lll_mutex_lock_wait): Fix typo in register name. diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2004-10-26 04:06:44.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2005-09-05 19:18:25.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 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 @@ -51,8 +51,8 @@ __lll_mutex_lock_wait: SYSCALL_INST_PAD 2: - mov #2, r4 - XCHG (r4, @r8, r2) + mov #2, r6 + XCHG (r6, @r8, r2) tst r2, r2 bf 1b From aoliva@redhat.com Mon Sep 5 17:20:00 2005 From: aoliva@redhat.com (Alexandre Oliva) Date: Mon, 05 Sep 2005 17:20:00 -0000 Subject: If configure compile&link test has -shared, use -fPIC as well Message-ID: My x86_64-*-linux-gnu build of glibc wasn't passing all tests. One of the reason for failures was that the test for --as-needed as broken: it compiled a source file without -fPIC, then attempted to include it in a shared library. The relocations emitted in the eh_frame and debugging sections caused the file to be rejected by the linker. A number of other tests that used to fail because of this mistake pass after installing the following patch. Please check it in. I haven't included the changes autoconf made to the configure script, only configure.in. For the record, the failure mode was that tests such as tst-cancelx4 aborted. That was because the main executable ended up linked with libgcc_eh.a, taking a number of functions from it, whereas libpthread dlopen()ed libgcc_s.so.1 to obtain such functions for thread cancellation. The shared-library copy initialized its dwarf reg sizes table correctly, per libpthread's request, whereas the other didn't get it initialized at all. However, the dynamic loader resolved the personality function in the main executable to the copy in the main executable, and that called _Unwind_SetGR in the main executable as well, thus using the uninitialized table and abort()ing. -------------- next part -------------- A non-text attachment was scrubbed... Name: glibc-configure-use-PIC-for-shared.patch Type: text/x-patch Size: 3377 bytes Desc: not available URL: -------------- next part -------------- -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} From drepper@redhat.com Mon Sep 5 21:59:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 05 Sep 2005 21:59:00 -0000 Subject: SH: A typo in lowlevellock.S In-Reply-To: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> References: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> Message-ID: <431CBF3E.2080204@redhat.com> Kaz Kojima wrote: > The appended patch fixes a typo in a low-level lock function. It > set the correct 3rd argument for the futex syscall in loop. Sorry > for missing such an embarrassing bug. The test suite missed this? If yes, can you come up with a test which exposes the problem? -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From kkojima@rr.iij4u.or.jp Mon Sep 5 23:33:00 2005 From: kkojima@rr.iij4u.or.jp (Kaz Kojima) Date: Mon, 05 Sep 2005 23:33:00 -0000 Subject: SH: A typo in lowlevellock.S In-Reply-To: <431CBF3E.2080204@redhat.com> References: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> <431CBF3E.2080204@redhat.com> Message-ID: <20050906.083343.26274250.kkojima@rr.iij4u.or.jp> Ulrich Drepper wrote: > The test suite missed this? If yes, can you come up with a test which > exposes the problem? The current testcases didn't fail for this normally. Perhaps I've seen but missed it because it wasn't reproducible. It seems to be timing critical on the slow machines like sh. I've noticed it with a random behavior of a libstdc++-v3 testcase gcc/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.c. The appended is a slightly changed version of it which will end in ~30s on my sh box with the patched libpthread but will take long time or hang up with high probability on the old libpthread. I could replace the locale stuff with something and rewrite it in C using pthread_mutex_{lock,unlock} directly, though I'm unsure that I can get the appropriate timings. Regards, kaz -- // Copyright (C) 2004, 2005 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 2, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. // 22.1.1.2 locale constructors and destructors [lib.locale.cons] #include #include const int max_thread_count = 2; //const int max_loop_count = 1000000; // orig value const int max_loop_count = 100000; const int max_locales = 10; void* thread_main(void*) { try { std::locale loc_c = std::locale::classic(); std::locale loc[max_locales]; for (int j = 0; j < max_locales; ++j) loc[j] = std::locale(j % 2 ? "en_US" : "fr_FR"); for (int i = 0; i < max_loop_count; ++i) { int k = i % max_locales; loc[k] = std::locale::global(loc[k]); if (i % 37 == 0) loc[k] = loc[k].combine >(loc_c); } } catch (...) { } return 0; } int main() { pthread_t tid[max_thread_count]; for (int i = 0; i < max_thread_count; i++) pthread_create (&tid[i], NULL, thread_main, 0); for (int i = 0; i < max_thread_count; i++) pthread_join (tid[i], NULL); return 0; } From drepper@redhat.com Tue Sep 6 01:16:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 06 Sep 2005 01:16:00 -0000 Subject: SH: A typo in lowlevellock.S In-Reply-To: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> References: <20050905.210715.15267870.kkojima@rr.iij4u.or.jp> Message-ID: <431CED9E.4060608@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Tue Sep 6 01:17:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 06 Sep 2005 01:17:00 -0000 Subject: If configure compile&link test has -shared, use -fPIC as well In-Reply-To: References: Message-ID: <431CEDFE.5080207@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From aoliva@redhat.com Wed Sep 7 19:20:00 2005 From: aoliva@redhat.com (Alexandre Oliva) Date: Wed, 07 Sep 2005 19:20:00 -0000 Subject: Fix for timezone tests that regressed with tzdata2005m Message-ID: This patch gets the timezone/ tests to pass. I haven't checked whether the modified information is accurate, I just tweaked the tests enough such that they'd pass, so use it with caution. -------------- next part -------------- A non-text attachment was scrubbed... Name: glibc-timezone-2005m.patch Type: text/x-patch Size: 1801 bytes Desc: not available URL: -------------- next part -------------- -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} From drepper@redhat.com Wed Sep 7 19:54:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 07 Sep 2005 19:54:00 -0000 Subject: Fix for timezone tests that regressed with tzdata2005m In-Reply-To: References: Message-ID: <431F453E.803@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Fri Sep 9 15:18:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 09 Sep 2005 15:18:00 -0000 Subject: [RFC] Fix netgroups handling Message-ID: <20050909143702.GE15708@sunsite.mff.cuni.cz> Hi! I believe there are several problems in netgroups handling (setnetgrent/getnetgrent*/endnetgrent/innetgr). 1) data/data_size/cursor/position __netgrent fields are private to the service. From what I understand, there needs to be always at most one service live for each __netgrent object. But we should never allow for one service to cleanup after a different service, as it doesn't understand how it uses the fields internally. Say the call internal_endnetgrent in NIS or NIS+'s setgrent hook if the fields were previously allocated by NIS+ resp. files/NIS will do bad things. 2) using setup/__nss_lookup/__nss_next for hooks other than setgrent seems to be wrong to me. These functions (might) modify __netgrent's nip field, but that means that data populated by one service's setnetgrent would be interpreted by a different service's endnetgrent or getnetgrent_r hook 3) __internal_setnetgrent_reuse call in __internal_getnetgrent_r (when some netgroup contains name of another netgroup) might be provided by different service. Say /etc/netgroup containing foo (host1,user1,) bar and say NIS+ bar (host2,user2,) But in that case we need to look up a different function, reusing the one from last service might be wrong. 4) if (result->cursor == NULL) return NSS_STATUS_NOTFOUND; in _nss_nis_getnetgrent_r is redundant IMHO, as _nss_netgroup_parseline does the same check at the beginning. The following (just compile tested) patch assumes that only NSS_STATUS_SUCCESS returning setgrent hooks modify data/data_size/cursor/position and in that case will call the endnetgrent hook before switching to another service or another netgroup and uses just __nss_lookup_function to look up endnetgrent/getnetgrent_r hooks. 2005-09-09 Jakub Jelinek * inet/getnetgrent_r.c: Include assert. (setup): Remove FUNC_NAME and ALL arguments, assume they are always "setnetgrent" and 1. (endnetgrent_hook): New function. (internal_endnetgrent): Use it. (__internal_setnetgrent_reuse): Use it. Adjust setup caller. If status is NSS_STATUS_SUCCESS, yet action is continue, call endnetgrent hook. (internal_getnetgrent_r): Use __nss_lookup_function rather than setup. Recompute getfct pointer after successful __internal_setnetgrent_reuse. Don't use __nss_next. (innetgr): Use __nss_lookup_function instead of __nss_lookup. Adjust setup caller. * nss/nss_files/files-netgrp.c (_nss_files_endnetgrent): Always clear data_size and cursor. Add libnss_files_hidden_proto and libnss_files_hidden_def. (_nss_files_setnetgrent): Call _nss_files_endnetgrent on failure. * nis/nss_nis/nis-netgrp.c (internal_endnetgrent): Always clear data_size and cursor. (_nss_nis_setnetgrent): Don't call internal_endnetgrent. (_nss_nis_getnetgrent_r): Remove result->cursor == NULL handling. * nis/nss_nisplus/nisplus-netgrp.c (internal_endnetgrent): Always clear data_size and position. (_nss_nisplus_setnetgrent): Don't call internal_endnetgrent. --- libc/inet/getnetgrent_r.c.jj 2004-08-14 18:18:30.000000000 +0200 +++ libc/inet/getnetgrent_r.c 2005-09-09 15:22:13.000000000 +0200 @@ -1,4 +1,5 @@ -/* Copyright (C) 1996,1997,1998,1999,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2004, 2005 + 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 @@ -16,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -33,15 +35,13 @@ __libc_lock_define_initialized (static, static struct __netgrent dataset; /* The lookup function for the first entry of this service. */ -extern int __nss_netgroup_lookup (service_user **nip, const char *name, +extern int __nss_netgroup_lookup (service_user **nipp, const char *name, void **fctp) internal_function; - -/* Set up NIP to run through the services. If ALL is zero, use NIP's - current location if it's not nil. Return nonzero if there are no +/* Set up NIP to run through the services. Return nonzero if there are no services (left). */ static enum nss_status -setup (void **fctp, const char *func_name, int all, service_user **nipp) +setup (void **fctp, service_user **nipp) { /* Remember the first service_entry, it's always the same. */ static service_user *startp; @@ -51,7 +51,7 @@ setup (void **fctp, const char *func_nam { /* Executing this more than once at the same time must yield the same result every time. So we need no locking. */ - no_more = __nss_netgroup_lookup (nipp, func_name, fctp); + no_more = __nss_netgroup_lookup (nipp, "setnetgrent", fctp); startp = no_more ? (service_user *) -1 : *nipp; } else if (startp == (service_user *) -1) @@ -59,11 +59,10 @@ setup (void **fctp, const char *func_nam return 1; else { - if (all || *nipp == NULL) - /* Reset to the beginning of the service list. */ - *nipp = startp; + /* Reset to the beginning of the service list. */ + *nipp = startp; /* Look up the first function. */ - no_more = __nss_lookup (nipp, func_name, fctp); + no_more = __nss_lookup (nipp, "setnetgrent", fctp); } return no_more; } @@ -87,6 +86,20 @@ free_memory (struct __netgrent *data) } } +static void +endnetgrent_hook (struct __netgrent *datap) +{ + enum nss_status (*endfct) (struct __netgrent *); + + if (datap->nip == NULL) + return; + + endfct = __nss_lookup_function (datap->nip, "endnetgrent"); + if (endfct != NULL) + (void) (*endfct) (datap); + datap->nip = NULL; +} + static int internal_function __internal_setnetgrent_reuse (const char *group, struct __netgrent *datap, @@ -100,14 +113,29 @@ __internal_setnetgrent_reuse (const char enum nss_status status = NSS_STATUS_UNAVAIL; struct name_list *new_elem; + /* Free data from previous service. */ + endnetgrent_hook (datap); + /* Cycle through all the services and run their setnetgrent functions. */ - int no_more = setup (&fct.ptr, "setnetgrent", 1, &datap->nip); + int no_more = setup (&fct.ptr, &datap->nip); while (! no_more) { + assert (datap->data == NULL); + /* Ignore status, we force check in `__nss_next'. */ status = (*fct.f) (group, datap); + service_user *old_nip = datap->nip; no_more = __nss_next (&datap->nip, "setnetgrent", &fct.ptr, status, 0); + + if (status == NSS_STATUS_SUCCESS && ! no_more) + { + enum nss_status (*endfct) (struct __netgrent *); + + endfct = __nss_lookup_function (old_nip, "endnetgrent"); + if (endfct != NULL) + (void) (*endfct) (datap); + } } /* Add the current group to the list of known groups. */ @@ -157,34 +185,13 @@ setnetgrent (const char *group) return result; } - void internal_endnetgrent (struct __netgrent *datap); libc_hidden_proto (internal_endnetgrent) void internal_endnetgrent (struct __netgrent *datap) { - service_user *old_nip; - union - { - enum nss_status (*f) (struct __netgrent *); - void *ptr; - } fct; - - /* Remember which was the last used service. */ - old_nip = datap->nip; - - /* Cycle through all the services and run their endnetgrent functions. */ - int no_more = setup (&fct.ptr, "endnetgrent", 1, &datap->nip); - while (! no_more) - { - /* Ignore status, we force check in `__nss_next'. */ - (void) (*fct.f) (datap); - - no_more = (datap->nip == old_nip - || __nss_next (&datap->nip, "endnetgrent", &fct.ptr, 0, 1)); - } - + endnetgrent_hook (datap); /* Now free list of all netgroup names from last run. */ free_memory (datap); } @@ -213,11 +220,7 @@ internal_getnetgrent_r (char **hostp, ch struct __netgrent *datap, char *buffer, size_t buflen, int *errnop) { - union - { - enum nss_status (*f) (struct __netgrent *, char *, size_t, int *); - void *ptr; - } fct; + enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *); /* Initialize status to return if no more functions are found. */ enum nss_status status = NSS_STATUS_NOTFOUND; @@ -225,10 +228,12 @@ internal_getnetgrent_r (char **hostp, ch /* Run through available functions, starting with the same function last run. We will repeat each function as long as it succeeds, and then go on to the next service action. */ - int no_more = setup (&fct.ptr, "getnetgrent_r", 0, &datap->nip); + int no_more = (datap->nip == NULL + || (fct = __nss_lookup_function (datap->nip, "getnetgrent_r")) + == NULL); while (! no_more) { - status = (*fct.f) (datap, buffer, buflen, &errno); + status = (*fct) (datap, buffer, buflen, &errno); if (status == NSS_STATUS_RETURN) { @@ -246,8 +251,12 @@ internal_getnetgrent_r (char **hostp, ch datap, errnop); } - if (found) - continue; + if (found && datap->nip != NULL) + { + fct = __nss_lookup_function (datap->nip, "getnetgrent_r"); + if (fct != NULL) + continue; + } } else if (status == NSS_STATUS_SUCCESS && datap->type == group_val) { @@ -279,7 +288,7 @@ internal_getnetgrent_r (char **hostp, ch } } - no_more = __nss_next (&datap->nip, "getnetgrent_r", &fct.ptr, status, 0); + break; } if (status == NSS_STATUS_SUCCESS) @@ -322,16 +331,8 @@ innetgr (const char *netgroup, const cha int (*f) (const char *, struct __netgrent *); void *ptr; } setfct; - union - { - void (*f) (struct __netgrent *); - void *ptr; - } endfct; - union - { - int (*f) (struct __netgrent *, char *, size_t, int *); - void *ptr; - } getfct; + void (*endfct) (struct __netgrent *); + int (*getfct) (struct __netgrent *, char *, size_t, int *); struct __netgrent entry; int result = 0; const char *current_group = netgroup; @@ -345,18 +346,21 @@ innetgr (const char *netgroup, const cha the work during one walk through the service list. */ while (1) { - int no_more = setup (&setfct.ptr, "setnetgrent", 1, &entry.nip); + int no_more = setup (&setfct.ptr, &entry.nip); while (! no_more) { + assert (entry.data == NULL); + /* Open netgroup. */ enum nss_status status = (*setfct.f) (current_group, &entry); if (status == NSS_STATUS_SUCCESS - && __nss_lookup (&entry.nip, "getnetgrent_r", &getfct.ptr) == 0) + && (getfct = __nss_lookup_function (entry.nip, "getnetgrent_r")) + != NULL) { char buffer[1024]; - while ((*getfct.f) (&entry, buffer, sizeof buffer, &errno) + while ((*getfct) (&entry, buffer, sizeof buffer, &errno) == NSS_STATUS_SUCCESS) { if (entry.type == group_val) @@ -414,8 +418,9 @@ innetgr (const char *netgroup, const cha } /* Free all resources of the service. */ - if (__nss_lookup (&entry.nip, "endnetgrent", &endfct.ptr) == 0) - (*endfct.f) (&entry); + endfct = __nss_lookup_function (entry.nip, "endnetgrent"); + if (endfct != NULL) + (*endfct) (&entry); /* Look for the next service. */ no_more = __nss_next (&entry.nip, "setnetgrent", --- libc/nis/nss_nisplus/nisplus-netgrp.c.jj 2004-12-13 09:36:17.000000000 +0100 +++ libc/nis/nss_nisplus/nisplus-netgrp.c 2005-09-09 13:42:45.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -142,12 +142,10 @@ static void internal_endnetgrent (struct __netgrent *netgrp) { if (netgrp->data != NULL) - { - nis_freeresult ((nis_result *) netgrp->data); - netgrp->data = NULL; - netgrp->data_size = 0; - netgrp->position = 0; - } + nis_freeresult ((nis_result *) netgrp->data); + netgrp->data = NULL; + netgrp->data_size = 0; + netgrp->position = 0; } enum nss_status @@ -161,8 +159,6 @@ _nss_nisplus_setnetgrent (const char *gr status = NSS_STATUS_SUCCESS; - internal_endnetgrent (netgrp); - sprintf (buf, "[name=%s],netgroup.org_dir", group); netgrp->data = (char *) nis_list (buf, EXPAND_NAME, NULL, NULL); --- libc/nis/nss_nis/nis-netgrp.c.jj 2005-08-23 12:00:37.000000000 +0200 +++ libc/nis/nss_nis/nis-netgrp.c 2005-09-09 13:40:34.000000000 +0200 @@ -41,13 +41,10 @@ _nss_netgroup_parseline (char **cursor, static void internal_nis_endnetgrent (struct __netgrent *netgrp) { - if (netgrp->data != NULL) - { - free (netgrp->data); - netgrp->data = NULL; - netgrp->data_size = 0; - netgrp->cursor = NULL; - } + free (netgrp->data); + netgrp->data = NULL; + netgrp->data_size = 0; + netgrp->cursor = NULL; } enum nss_status @@ -65,8 +62,6 @@ _nss_nis_setnetgrent (const char *group, if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; - internal_nis_endnetgrent (netgrp); - status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group), &netgrp->data, &len)); if (status == NSS_STATUS_SUCCESS) @@ -99,9 +94,6 @@ enum nss_status _nss_nis_getnetgrent_r (struct __netgrent *result, char *buffer, size_t buflen, int *errnop) { - if (result->cursor == NULL) - return NSS_STATUS_NOTFOUND; - return _nss_netgroup_parseline (&result->cursor, result, buffer, buflen, errnop); } --- libc/nss/nss_files/files-netgrp.c.jj 2004-11-23 21:42:29.000000000 +0100 +++ libc/nss/nss_files/files-netgrp.c 2005-09-09 13:35:31.000000000 +0200 @@ -1,5 +1,5 @@ /* Netgroup file parser in nss_files modules. - Copyright (C) 1996, 1997, 2000, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -29,6 +29,7 @@ #define DATAFILE "/etc/netgroup" +libnss_files_hidden_proto (_nss_files_endnetgrent) #define EXPAND(needed) \ do \ @@ -140,6 +141,9 @@ _nss_files_setnetgrent (const char *grou /* We don't need the file and the line buffer anymore. */ free (line); fclose (fp); + + if (status != NSS_STATUS_SUCCESS) + _nss_files_endnetgrent (result); } return status; @@ -150,16 +154,13 @@ int _nss_files_endnetgrent (struct __netgrent *result) { /* Free allocated memory for data if some is present. */ - if (result->data != NULL) - { - free (result->data); - result->data = NULL; - result->data_size = 0; - result->cursor = NULL; - } - + free (result->data); + result->data = NULL; + result->data_size = 0; + result->cursor = NULL; return NSS_STATUS_SUCCESS; } +libnss_files_hidden_def (_nss_files_endnetgrent) static char * strip_whitespace (char *str) Jakub From jakub@redhat.com Fri Sep 9 16:17:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 09 Sep 2005 16:17:00 -0000 Subject: [PATCH] Fix memory leak in loadarchive.c (BZ #1318) Message-ID: <20050909161720.GF15708@sunsite.mff.cuni.cz> Hi! _nl_normalize_codeset returns a freshly malloced string no matter whether the original string has been already normalized or not. So we should free it always, not only when it has not been normalized before. $ LC_ALL=en_US.UTF-8 valgrind /bin/echo 2>&1 | grep definitely $ LC_ALL=en_US.utf8 valgrind /bin/echo 2>&1 | grep definitely ==28320== definitely lost: 5 bytes in 1 blocks. 2005-09-09 Jakub Jelinek [BZ #1318] * locale/loadarchive.c (_nl_load_locale_from_archive): Free normalized_codeset even if p was already normalized. Reported by Jaroslav Snajdr . --- libc/locale/loadarchive.c.jj 2003-09-14 20:13:40.000000000 +0200 +++ libc/locale/loadarchive.c 2005-09-09 18:05:25.000000000 +0200 @@ -1,5 +1,5 @@ /* Code to load locale data from the locale archive file. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005 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 @@ -185,9 +185,9 @@ _nl_load_locale_from_archive (int catego memcpy (__mempcpy (__mempcpy (newname, name, p - name), normalized_codeset, normlen), rest, restlen); - free ((char *) normalized_codeset); name = newname; } + free ((char *) normalized_codeset); } } Jakub From drepper@redhat.com Fri Sep 9 16:59:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 09 Sep 2005 16:59:00 -0000 Subject: [PATCH] Fix memory leak in loadarchive.c (BZ #1318) In-Reply-To: <20050909161720.GF15708@sunsite.mff.cuni.cz> References: <20050909161720.GF15708@sunsite.mff.cuni.cz> Message-ID: <4321BF07.8010803@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Sat Sep 10 03:25:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 10 Sep 2005 03:25:00 -0000 Subject: [RFC] Fix netgroups handling In-Reply-To: <20050909143702.GE15708@sunsite.mff.cuni.cz> References: <20050909143702.GE15708@sunsite.mff.cuni.cz> Message-ID: <432251CF.9020007@redhat.com> I think the patch is fine. I made a few minor changes and ran some tests. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Mon Sep 12 09:37:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 12 Sep 2005 09:37:00 -0000 Subject: [PATCH] Fix calloc with MALLOC_PERTURB_ Message-ID: <20050912093708.GG15708@sunsite.mff.cuni.cz> Hi! malloc_usable_size() is chunksize (p) - 2 * SIZE_SZ for chunk_is_mmapped (p), not chunksize (p) - SIZE_SZ, but with MALLOC_PERTURB_=X if X != 0 calloc was clearing SIZE_SZ bytes too much (without MALLOC_PERTURB_ it would just return right away). On 32-bit architectures, that is not fatal, as chunksize is always a multiple of 8 (3 bits used for other stuff), but on 64-bit arches if calloc uses mmap this means usually segfault or clobbering whatever memory is after it. On closer inspection, we really need to clear just sz bytes in that case (and unrolling in that case is not a good idea, sz is usually quite large), as _int_malloc cleared just sz bytes and the rest are 0's from mmap, plus apps shouldn't rely on calloc clearing bytes beyond what it asked for (IMHO nothing says what values will have bytes at ret+size*nmemb through ret+malloc_usable_bytes (ret)). 2005-09-12 Jakub Jelinek * malloc.c (struct malloc_chunk): Fix comment typo. (public_cALLOc): For mmapped chunks and perturb_byte != 0, don't clear SIZE_SZ bytes more than should be cleared. --- libc/malloc/malloc.c 20 Mar 2005 18:08:52 -0000 1.148 +++ libc/malloc/malloc.c 12 Sep 2005 09:23:27 -0000 @@ -1726,7 +1726,7 @@ struct malloc_chunk { mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | User data starts here... . . . - . (malloc_usable_space() bytes) . + . (malloc_usable_size() bytes) . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of chunk | @@ -3691,8 +3691,12 @@ public_cALLOc(size_t n, size_t elem_size /* Two optional cases in which clearing not necessary */ #if HAVE_MMAP - if (perturb_byte == 0 && chunk_is_mmapped(p)) - return mem; + if (chunk_is_mmapped (p)) + { + if (__builtin_expect (perturb_byte, 0)) + MALLOC_ZERO (mem, sz); + return mem; + } #endif csz = chunksize(p); Jakub From drepper@redhat.com Mon Sep 12 14:02:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 12 Sep 2005 14:02:00 -0000 Subject: [PATCH] Fix calloc with MALLOC_PERTURB_ In-Reply-To: <20050912093708.GG15708@sunsite.mff.cuni.cz> References: <20050912093708.GG15708@sunsite.mff.cuni.cz> Message-ID: <43258A58.3030605@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Tue Sep 13 15:50:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 13 Sep 2005 15:50:00 -0000 Subject: [PATCH] {,U}LLONG_{MIN,MAX} with -D_GNU_SOURCE (BZ #1228) Message-ID: <20050913155038.GH15708@sunsite.mff.cuni.cz> Hi! If /usr/lib/gcc/*/*/include/ comes first in the search path (the default case), LLONG_MAX etc. aren't defined for -D_GNU_SOURCE or -D_ISOC99_SOURCE unless -std=c99 is used. The GCC header only checks for __STDC_VERSION__ >= 199901L. If just -D_ISOC99_SOURCE and not -std=c99, then LLONG_MAX etc. is not defined properly for any inclusion order, as LONG_LONG_MAX etc. aren't defined in that case (GCC limits.h protects them with defined __USE_GNU). The following patch should cure this. But I'm not sure if _ISOC99_SOURCE shouldn't be ammended with __USE_XOPEN2K or something similar, as POSIX2K requires LLONG_MAX etc. in limits.h, so a pure -D_XOPEN_SOURCE=600 (without -std=c99) or -D_POSIX_C_SOURCE=200112L wouldn't bring those macros into the namespace. I have checked GCC limits.h back to 2.96 ages and __LONG_LONG_MAX__ was always defined. 2005-09-13 Jakub Jelinek [BZ #1228] * include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Make sure these are defined for -D_GNU_SOURCE or -D_ISOC99_SOURCE even when not -std=c99. --- libc/include/limits.h 2005-08-15 15:37:07.000000000 +0200 +++ libc/include/limits.h 2005-09-13 17:39:27.000000000 +0200 @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005 + 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 @@ -122,20 +123,20 @@ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ # include_next +#endif /* The files in some gcc versions don't define LLONG_MIN, LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for ages are available. */ -# ifdef __USE_ISOC99 -# ifndef LLONG_MIN -# define LLONG_MIN LONG_LONG_MIN -# endif -# ifndef LLONG_MAX -# define LLONG_MAX LONG_LONG_MAX -# endif -# ifndef ULLONG_MAX -# define ULLONG_MAX ULONG_LONG_MAX -# endif +#if defined __USE_ISOC99 && defined __GNUC__ +# ifndef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX-1) +# endif +# ifndef LLONG_MAX +# define LLONG_MAX __LONG_LONG_MAX__ +# endif +# ifndef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1) # endif #endif Jakub From roland@redhat.com Tue Sep 13 17:37:00 2005 From: roland@redhat.com (Roland McGrath) Date: Tue, 13 Sep 2005 17:37:00 -0000 Subject: [PATCH] {,U}LLONG_{MIN,MAX} with -D_GNU_SOURCE (BZ #1228) In-Reply-To: Jakub Jelinek's message of Tuesday, 13 September 2005 17:50:38 +0200 <20050913155038.GH15708@sunsite.mff.cuni.cz> Message-ID: <20050913173659.56DEB180A1A@magilla.sf.frob.com> I think there was a BZ about this, or maybe an earlier email. That's not sufficient for: #define _GNU_SOURCE #include to dtrt when it gets the GCC one first. I think gcc's file should change: #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L to: #if ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ || defined (__GLIBC__) ? defined (__USE_ISOC99) : !defined (__STRICT_ANSI__)) Thanks, Roland From jakub@redhat.com Tue Sep 13 18:28:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 13 Sep 2005 18:28:00 -0000 Subject: [PATCH] {,U}LLONG_{MIN,MAX} with -D_GNU_SOURCE (BZ #1228) In-Reply-To: <20050913173659.56DEB180A1A@magilla.sf.frob.com> References: <20050913155038.GH15708@sunsite.mff.cuni.cz> <20050913173659.56DEB180A1A@magilla.sf.frob.com> Message-ID: <20050913182821.GI15708@sunsite.mff.cuni.cz> On Tue, Sep 13, 2005 at 10:36:59AM -0700, Roland McGrath wrote: > I think there was a BZ about this, or maybe an earlier email. > That's not sufficient for: > > #define _GNU_SOURCE > #include It is enough to DTRT, I have tested both include orders, i.e. -isystem `dirname $(gcc -print-file-name=include/limits.h)` -isystem /usr/include and -isystem /usr/include -isystem `dirname $(gcc -print-file-name=include/limits.h)` before and after the patch. Jakub From aj@suse.de Fri Sep 16 12:47:00 2005 From: aj@suse.de (Andreas Jaeger) Date: Fri, 16 Sep 2005 12:47:00 -0000 Subject: Fix BZ #987 Message-ID: The functions tan and atan were not declared as weak aliases like all other functions. Ok to commit? Andreas 2005-09-16 Andreas Jaeger , Peter Bergner [BZ #987] * sysdeps/ieee754/dbl-64/s_tan.c: Use weak alias for function. * sysdeps/ieee754/dbl-64/s_atan.c: Likewise. ============================================================ Index: sysdeps/ieee754/dbl-64/s_tan.c --- sysdeps/ieee754/dbl-64/s_tan.c 26 Aug 2002 22:40:36 -0000 1.11 +++ sysdeps/ieee754/dbl-64/s_tan.c 16 Sep 2005 12:40:54 -0000 @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2005 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -42,7 +42,7 @@ static double tanMp(double); void __mptan(double, mp_no *, int); -double tan(double x) { +double __tan(double x) { #include "utan.h" #include "utan.tbl" @@ -481,6 +481,8 @@ static double tanMp(double x) return y; } +weak_alias (__tan, tan) #ifdef NO_LONG_DOUBLE -weak_alias (tan, tanl) +weak_alias (__tan, __tanl) +weak_alias (__tan, tanl) #endif ============================================================ Index: sysdeps/ieee754/dbl-64/s_atan.c --- sysdeps/ieee754/dbl-64/s_atan.c 26 Aug 2002 22:40:36 -0000 1.9 +++ sysdeps/ieee754/dbl-64/s_atan.c 16 Sep 2005 12:40:54 -0000 @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001,2005 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -49,7 +49,7 @@ static double atanMp(double,const int[]) double __signArctan(double,double); /* An ultimate atan() routine. Given an IEEE double machine number x, */ /* routine computes the correctly rounded (to nearest) value of atan(x). */ -double atan(double x) { +double __atan(double x) { double cor,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,u,u2,u3, @@ -225,6 +225,8 @@ for (i=0; i From aj@suse.de Fri Sep 16 13:25:00 2005 From: aj@suse.de (Andreas Jaeger) Date: Fri, 16 Sep 2005 13:25:00 -0000 Subject: Patches from bugzilla Message-ID: Bugzilla contains a number of patches that we might want to add directly, I propose to add these: http://sources.redhat.com/bugzilla/show_bug.cgi?id=1224 http://sources.redhat.com/bugzilla/show_bug.cgi?id=1051 http://sources.redhat.com/bugzilla/show_bug.cgi?id=1060 http://sources.redhat.com/bugzilla/show_bug.cgi?id=1061 http://sources.redhat.com/bugzilla/show_bug.cgi?id=1062 Uli, I can apply them, test them and commit them if you are approve them, Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From aj@suse.de Sat Sep 17 13:33:00 2005 From: aj@suse.de (Andreas Jaeger) Date: Sat, 17 Sep 2005 13:33:00 -0000 Subject: Fix warning in zdump Message-ID: The appended patch fixes these warnings: zdump.c:208: warning: implicit declaration of function ?isascii? zdump.c:208: warning: implicit declaration of function ?isalpha? zdump.c:218: warning: implicit declaration of function ?isdigit? Ok to commit? Andreas 2005-09-17 Andreas Jaeger * timezone/zdump.c: Include ctype.h. ============================================================ Index: timezone/zdump.c --- timezone/zdump.c 7 Sep 2005 07:03:08 -0000 1.11 +++ timezone/zdump.c 17 Sep 2005 13:32:39 -0000 @@ -12,6 +12,7 @@ static char elsieid[] = "@(#)zdump.c 7.6 #include "time.h" /* for struct tm */ #include "stdlib.h" /* for exit, malloc, atoi */ #include "float.h" /* for FLT_MAX and DBL_MAX */ +#include /* for isascii, isalpha, isdigit */ #ifndef ZDUMP_LO_YEAR #define ZDUMP_LO_YEAR (-500) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: -------------- next part -------------- -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From aj@suse.de Sat Sep 17 13:56:00 2005 From: aj@suse.de (Andreas Jaeger) Date: Sat, 17 Sep 2005 13:56:00 -0000 Subject: Fix BZ#1053 Message-ID: Ok to commit the appended patch which fixes "xtrace -v"? Andreas 2005-09-17 Andreas Jaeger [BZ #1053] * debug/xtrace.sh: Quote correctly. Patch Peter Breitenlohner . ============================================================ Index: debug/xtrace.sh --- debug/xtrace.sh 12 Jan 2005 23:39:52 -0000 1.14 +++ debug/xtrace.sh 17 Sep 2005 13:54:38 -0000 @@ -107,7 +107,7 @@ while test $# -gt 0; do --d=* | --da=* | --dat=* | --data=*) data=${1##*=} ;; - -? | --h | --he | --hel | --help) + -\? | --h | --he | --hel | --help) do_help ;; -V | --v | --ve | --ver | --vers | --versi | --versio | --version) -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From aj@suse.de Sat Sep 17 14:07:00 2005 From: aj@suse.de (Andreas Jaeger) Date: Sat, 17 Sep 2005 14:07:00 -0000 Subject: Fix sockatmark implementation Message-ID: Sockatmark was not implemented correctly at all, the ioctl needs an extra argument. Ok to commit? Andreas 2005-09-17 Andreas Jaeger [BZ #1010] * sysdeps/unix/sysv/linux/sockatmark.c: New file. ============================================================ Index: sysdeps/unix/sysv/linux/sockatmark.c --- sysdeps/unix/sysv/linux/sockatmark.c created +++ sysdeps/unix/sysv/linux/sockatmark.c 2005-09-17 16:06:06.000000000 +0200 1.1 @@ -0,0 +1,33 @@ +/* Copyright (C) 2005 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +/* Determine wheter socket is at a out-of-band mark. */ +int +sockatmark (int fd) +{ + int arg, retval; + + retval = INLINE_SYSCALL (ioctl, 3, fd, SIOCATMARK, &arg); + if (retval == -1) + return -1; + + return arg; +} -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From drepper@redhat.com Sat Sep 17 15:34:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 17 Sep 2005 15:34:00 -0000 Subject: Fix warning in zdump In-Reply-To: References: Message-ID: <432C3730.9060009@redhat.com> Andreas Jaeger wrote: > Ok to commit? Yes. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Sat Sep 17 18:14:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 17 Sep 2005 18:14:00 -0000 Subject: Patches from bugzilla In-Reply-To: References: Message-ID: <432C5CD0.5060901@redhat.com> The two acceptable patches are in. The rest does not fall into this category. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Sat Sep 17 20:42:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 17 Sep 2005 20:42:00 -0000 Subject: Fix BZ#1053 In-Reply-To: References: Message-ID: <432C7F77.7010105@redhat.com> Andreas Jaeger wrote: > Ok to commit the appended patch which fixes "xtrace -v"? Already done, I stumbled across the bz myself. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From drepper@redhat.com Sat Sep 17 23:38:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 17 Sep 2005 23:38:00 -0000 Subject: Fix sockatmark implementation In-Reply-To: References: Message-ID: <432CA8CF.3020808@redhat.com> Andreas Jaeger wrote: > Sockatmark was not implemented correctly at all, the ioctl needs an > extra argument. Ok to commit? This use of ioctl() isn't Linux specific, I fixed the implementation. No need to introduce a Linux version. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Tue Sep 20 20:07:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 20 Sep 2005 20:07:00 -0000 Subject: [PATCH] Use fopen64 rather than fopen for nscd log file Message-ID: <20050920200651.GN15708@sunsite.mff.cuni.cz> Hi! Some users sometimes create awfully huge log files... 2005-09-20 Jakub Jelinek * nscd/dbg_log.c (init_logfile): Use fopen64 rather than fopen. --- libc/nscd/dbg_log.c.jj 2005-09-20 21:15:16.000000000 +0200 +++ libc/nscd/dbg_log.c 2005-09-20 21:52:39.000000000 +0200 @@ -44,7 +44,7 @@ init_logfile (void) { if (logfilename) { - dbgout = fopen (logfilename, "a"); + dbgout = fopen64 (logfilename, "a"); return dbgout == NULL ? 0 : 1; } return 1; Jakub From roland@redhat.com Tue Sep 20 20:15:00 2005 From: roland@redhat.com (Roland McGrath) Date: Tue, 20 Sep 2005 20:15:00 -0000 Subject: [PATCH] Use fopen64 rather than fopen for nscd log file In-Reply-To: Jakub Jelinek's message of Tuesday, 20 September 2005 22:06:51 +0200 <20050920200651.GN15708@sunsite.mff.cuni.cz> Message-ID: <20050920201505.8663A180E1F@magilla.sf.frob.com> Applied. Thanks, Roland From sjmunroe@us.ibm.com Wed Sep 21 14:06:00 2005 From: sjmunroe@us.ibm.com (Steve Munroe) Date: Wed, 21 Sep 2005 14:06:00 -0000 Subject: Dealing with multiple page sizes in NPTL Message-ID: The recently announced POWER5+ hardware now supports 4KB, 64KB, and 16KB pages sizes. For large systems used in High Performance Computing or large scale data base applications a larger page size makes the TLB more effective and boosts performance. At this year's OLS there was discussion of adding a kernel option to support 64KB (vs 4KB) as the base page size in these environments. I suspect that a larger base page is an issue for IA64 as well. This raises the possibility that the page size may change depending on which kernel was booted for that machine. This page size will be reported via AT_PAGESZ but the question is how well does glibc respond to that value not be a constant 4096. Amazing well. Most of glibc depends on GLRO(dl_pagesize), __getpagesize() , or _sysconf(_SC_PAGESIZE), which are derived from AT_PAGESZ either directly or indirectly. Even Linuxthreads behaves correctly because it uses the following definition: /* The page size we can get from the system. This should likely not be changed by the machine file but, you never know. */ #ifndef PAGE_SIZE #define PAGE_SIZE (sysconf (_SC_PAGE_SIZE)) #endif NPTL however has a problem where I found pthread_create was returning EINVAL due to the following code in allocate_stack() in glibc/nptl/allocatestack.c. guardsize = (attr->guardsize + pagesize_m1) & ~pagesize_m1; if (__builtin_expect (size < (guardsize + __static_tls_size + MINIMAL_REST_STACK + pagesize_m1 + 1), 0)) /* The stack is too small (or the guard too large). */ return EINVAL; I found that the minimum stack size that allowed a thread to be created on a 64K-page kernel is 135296, which equals 65536 + 128 + 4096 + 65535 + 1. The guardsize and pagesize_m1 are computed from __getpagesize() but the default value of size is not. If the pthread_attr does no provide the stacksize attribute the __default_stacksize value is used: /* Get the stack size from the attribute if it is set. Otherwise we use the default we determined at start time. */ size = attr->stacksize ?: __default_stacksize; The problem is the initialization of __default_stacksize which occurs in nptl/init.c and nptl/vars.c. It looks like vars.c handles initialization for the static case: /* Default stack size. */ size_t __default_stacksize attribute_hidden #ifdef SHARED ; #else = PTHREAD_STACK_MIN; #endif And init.c (__pthread_initialize_minimal_internal) handles initialization for the dynamic case: if (getrlimit (RLIMIT_STACK, &limit) != 0 || limit.rlim_cur == RLIM_INFINITY) /* The system limit is not usable. Use an architecture-specific default. */ __default_stacksize = ARCH_STACK_DEFAULT_SIZE; else if (limit.rlim_cur < PTHREAD_STACK_MIN) /* The system limit is unusably small. Use the minimal size acceptable. */ __default_stacksize = PTHREAD_STACK_MIN; else .... The default value of PTHREAD_STACK_MIN is 16384 which too small for a 64KB page. The minimum needs to be at least 2 pages (128KB) one for the guardpage and one or more pages to hold the; minimum stack, thread struct, and static TLS storage. The seemingly simple solution is to use something like: #define PTHREAD_STACK_MIN (2 * __getpagesize()) but this causes other problems. The conditional: #if PTHREAD_STACK_MIN == 16384 weak_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize) #else versioned_symbol (libpthread, __pthread_attr_setstacksize, pthread_attr_setstacksize, GLIBC_2_3_3); ... #endif is used in several places to determine if versioning is required. These and the static assignment in nptl/vars.c will not compile unless PTHREAD_STACK_MIN is constant. So there is a structual problem of how make a variable or at least how to set __default_stacksize correctly when AT_PAGESZ > __default_stacksize. The dynamic case can be addressed with: if (__default_stacksize < (2 * __getpagesize())) /* The default_stacksize must be at least 2 pages. */ __default_stacksize = (2 * __getpagesize()); .... in __pthread_initialize_minimal_internal. It is not clear how best to address the static case. It also seems that the formula in allocatestack() needs to change to something like: guardsize = (attr->guardsize + pagesize_m1) & ~pagesize_m1; if (__builtin_expect (size < ((guardsize + __static_tls_size + MINIMAL_REST_STACK + pagesize_m1) & ~pagesize_m1, 0)) /* The stack is too small (or the guard too large). */ return EINVAL; Steven J. Munroe Linux on Power Toolchain Architect IBM Corporation, Linux Technology Center From jakub@redhat.com Sat Sep 24 19:02:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Sat, 24 Sep 2005 19:02:00 -0000 Subject: [PATCH] innetgr fixes Message-ID: <20050924190228.GO15708@sunsite.mff.cuni.cz> Hi! Two problems: 1) there is a memory leak - if result != 0 (-1 means allocation failure, 1 that we found the netgroup entry we are looking for), innetgr did not call endnetgrent hook, so resources in the NSS module weren't freed. 2) innetgr return value is supposed to be 1 for match and 0 for non-match or error (from info libc): The return value is `1' if an entry matching the given triple is found in the netgroup. The return value is `0' if the netgroup itself is not found, the netgroup does not contain the triple or internal errors occurred. result variable internally is 0 for non-match, 1 for match and -1 for internal error (the distinction is needed to find out if the loop should continue), so return result == 1; which is what getnetgrent_r.c used until August last year is IMHO correct. 2005-09-24 Jakub Jelinek References: <20050924190228.GO15708@sunsite.mff.cuni.cz> Message-ID: <43372A60.3000108@redhat.com> Applied. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: From jakub@redhat.com Fri Sep 30 13:58:00 2005 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 30 Sep 2005 13:58:00 -0000 Subject: [PATCH] Small fixes Message-ID: <20050930135825.GQ15708@sunsite.mff.cuni.cz> Hi! The uninitialized warnings in regexec.c seems to be real, so needed fixing. Additionally warning fix for memusage.c on 32-bitters and i386 ulps update (well, merge between what we had before and what is needed now). 2005-09-30 Jakub Jelinek * posix/regexec.c (update_cur_sifted_state, check_arrival, check_arrival_add_next_nodes): Avoid using uninitialized variable. * malloc/memusage.c (dest): Fix a bunch of warnings on 32-bit arches. * sysdeps/i386/fpu/libm-test-ulps: Update for GCC 4.0.x. --- libc/posix/regexec.c.jj 2005-09-29 10:42:44.000000000 +0200 +++ libc/posix/regexec.c 2005-09-30 14:43:47.000000000 +0200 @@ -1798,7 +1798,7 @@ update_cur_sifted_state (mctx, sctx, str re_node_set *dest_nodes; { const re_dfa_t *const dfa = mctx->dfa; - reg_errcode_t err; + reg_errcode_t err = REG_NOERROR; const re_node_set *candidates; candidates = ((mctx->state_log[str_idx] == NULL) ? NULL : &mctx->state_log[str_idx]->nodes); @@ -2932,7 +2932,7 @@ check_arrival (mctx, path, top_node, top int top_node, top_str, last_node, last_str, type; { const re_dfa_t *const dfa = mctx->dfa; - reg_errcode_t err; + reg_errcode_t err = REG_NOERROR; int subexp_num, backup_cur_idx, str_idx, null_cnt; re_dfastate_t *cur_state = NULL; re_node_set *cur_nodes, next_nodes; @@ -3096,7 +3096,7 @@ check_arrival_add_next_nodes (mctx, str_ const re_dfa_t *const dfa = mctx->dfa; int result; int cur_idx; - reg_errcode_t err; + reg_errcode_t err = REG_NOERROR; re_node_set union_set; re_node_set_init_empty (&union_set); for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx) --- libc/malloc/memusage.c.jj 2005-09-12 09:29:03.000000000 +0200 +++ libc/malloc/memusage.c 2005-09-30 15:39:11.000000000 +0200 @@ -793,14 +793,21 @@ dest (void) \e[00;34m free|\e[0m %10lu %12llu\n", (unsigned long long int) grand_total, (unsigned long int) peak_heap, (unsigned long int) peak_stack, - calls[idx_malloc], (unsigned long long int) total[idx_malloc], - failed[idx_malloc] ? "\e[01;41m" : "", failed[idx_malloc], - calls[idx_realloc], (unsigned long long int) total[idx_realloc], - failed[idx_realloc] ? "\e[01;41m" : "", failed[idx_realloc], - inplace, decreasing, - calls[idx_calloc], (unsigned long long int) total[idx_calloc], - failed[idx_calloc] ? "\e[01;41m" : "", failed[idx_calloc], - calls[idx_free], (unsigned long long int) total[idx_free]); + (unsigned long int) calls[idx_malloc], + (unsigned long long int) total[idx_malloc], + failed[idx_malloc] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_malloc], + (unsigned long int) calls[idx_realloc], + (unsigned long long int) total[idx_realloc], + failed[idx_realloc] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_realloc], + (unsigned long int) inplace, (unsigned long int) decreasing, + (unsigned long int) calls[idx_calloc], + (unsigned long long int) total[idx_calloc], + failed[idx_calloc] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_calloc], + (unsigned long int) calls[idx_free], + (unsigned long long int) total[idx_free]); if (trace_mmap) fprintf (stderr, "\ @@ -809,17 +816,28 @@ dest (void) \e[00;34mmmap(a)|\e[0m %10lu %12llu %s%12lu\e[00;00m\n\ \e[00;34m mremap|\e[0m %10lu %12llu %s%12lu\e[00;00m (in place: %ld, dec: %ld)\n\ \e[00;34m munmap|\e[0m %10lu %12llu %s%12lu\e[00;00m\n", - calls[idx_mmap_r], (unsigned long long int) total[idx_mmap_r], - failed[idx_mmap_r] ? "\e[01;41m" : "", failed[idx_mmap_r], - calls[idx_mmap_w], (unsigned long long int) total[idx_mmap_w], - failed[idx_mmap_w] ? "\e[01;41m" : "", failed[idx_mmap_w], - calls[idx_mmap_a], (unsigned long long int) total[idx_mmap_a], - failed[idx_mmap_a] ? "\e[01;41m" : "", failed[idx_mmap_a], - calls[idx_mremap], (unsigned long long int) total[idx_mremap], - failed[idx_mremap] ? "\e[01;41m" : "", failed[idx_mremap], - inplace_mremap, decreasing_mremap, - calls[idx_munmap], (unsigned long long int) total[idx_munmap], - failed[idx_munmap] ? "\e[01;41m" : "", failed[idx_munmap]); + (unsigned long int) calls[idx_mmap_r], + (unsigned long long int) total[idx_mmap_r], + failed[idx_mmap_r] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_mmap_r], + (unsigned long int) calls[idx_mmap_w], + (unsigned long long int) total[idx_mmap_w], + failed[idx_mmap_w] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_mmap_w], + (unsigned long int) calls[idx_mmap_a], + (unsigned long long int) total[idx_mmap_a], + failed[idx_mmap_a] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_mmap_a], + (unsigned long int) calls[idx_mremap], + (unsigned long long int) total[idx_mremap], + failed[idx_mremap] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_mremap], + (unsigned long int) inplace_mremap, + (unsigned long int) decreasing_mremap, + (unsigned long int) calls[idx_munmap], + (unsigned long long int) total[idx_munmap], + failed[idx_munmap] ? "\e[01;41m" : "", + (unsigned long int) failed[idx_munmap]); /* Write out a histoogram of the sizes of the allocations. */ fprintf (stderr, "\e[01;32mHistogram for block sizes:\e[0;0m\n"); @@ -836,7 +854,7 @@ dest (void) { percent = (histogram[cnt / 16] * 100) / calls_total; fprintf (stderr, "%5d-%-5d%12lu ", cnt, cnt + 15, - histogram[cnt / 16]); + (unsigned long int) histogram[cnt / 16]); if (percent == 0) fputs (" <1% \e[41;37m", stderr); else @@ -853,7 +871,7 @@ dest (void) if (large != 0) { percent = (large * 100) / calls_total; - fprintf (stderr, " large %12lu ", large); + fprintf (stderr, " large %12lu ", (unsigned long int) large); if (percent == 0) fputs (" <1% \e[41;37m", stderr); else --- libc/sysdeps/i386/fpu/libm-test-ulps.jj 2005-05-04 10:32:11.000000000 +0200 +++ libc/sysdeps/i386/fpu/libm-test-ulps 2005-09-30 15:42:35.000000000 +0200 @@ -149,7 +149,9 @@ float: 1 idouble: 1 ifloat: 1 Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 # cexp @@ -354,7 +356,9 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -377,7 +381,9 @@ Test "Real part of: ctan (0.75 + 1.25 i) ildouble: 1 ldouble: 1 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 3 ldouble: 3 @@ -395,7 +401,9 @@ Test "Imaginary part of: ctanh (0 + pi/4 float: 1 ifloat: 1 Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": double: 1 @@ -504,7 +512,9 @@ Test "j1 (0.75) == 0.3492436021748621925 double: 1 idouble: 1 Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -551,7 +561,9 @@ Test "jn (1, 0.75) == 0.3492436021748621 double: 1 idouble: 1 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -682,6 +694,7 @@ ldouble: 1 # sinh Test "sinh (0.75) == 0.822316731935829980703661634446913849": +double: 1 ildouble: 1 # tan @@ -1087,7 +1100,9 @@ ildouble: 3 ldouble: 3 Function: Real part of "ctanh": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 5 ldouble: 5 @@ -1179,6 +1194,7 @@ ildouble: 1 ldouble: 1 Function: "sinh": +double: 1 ildouble: 1 Function: "tan": Jakub From drepper@redhat.com Fri Sep 30 15:46:00 2005 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 30 Sep 2005 15:46:00 -0000 Subject: [PATCH] Small fixes In-Reply-To: <20050930135825.GQ15708@sunsite.mff.cuni.cz> References: <20050930135825.GQ15708@sunsite.mff.cuni.cz> Message-ID: <433D5D87.3010709@redhat.com> Applied. But your ChangeLog formatting is off. Unrelated entries should be separated by an empty line. -- ? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 251 bytes Desc: OpenPGP digital signature URL: