aboutsummaryrefslogtreecommitdiff
path: root/nscd
AgeCommit message (Collapse)AuthorFilesLines
2009-07-17Revert "Fix lock handling in memory hander of nscd."Ulrich Drepper7-5/+27
This reverts commit 137028b4d7e50f71906c1656c27079eac5a1d085. Conflicts: ChangeLog
2009-07-16Fix lock handling in memory hander of nscd.Petr Baudis7-27/+5
The commit 20e498bd removes the pthread_mutex_rdlock() calls, but not the corresponding pthread_mutex_unlock() calls. Also, the database lock is never unlocked in one branch of the mempool_alloc() if. I think unreproducible random assert(dh->usable) crashes in prune_cache() were caused by this. But an easy way to make nscd threads hang with the broken locking was.
2009-07-16Use correct release semantic in list update.Andreas Schwab1-1/+1
nscd uses lockfree lists and we need to ensure the correct release semantics is used when adding to the list.
2009-06-16Consolidate PIE linking Makefile rules.H.J. Lu1-9/+2
2009-05-18Fix forced loop termination in nscd database lookup.Jakub Jelinek1-3/+13
There are two issues with the forced loop exit in the nscd lookup: 1. the estimate of the entry size isn't pessimistic enough for all databases, resulting potentially is too early exits 2. the combination of 64-bit process and 32-bit nscd would lead to rejecting valid records in the database.
2009-05-16Move BLOCK_ALIGN* macros back.Ulrich Drepper2-5/+5
The move to nscd-client.h was only needed for some interim version of the patch. The final version doesn't need it. Undo the change.
2009-05-16Fix exit condition.Ulrich Drepper1-1/+1
The patch to bound the search in the nscd caches used a wrong exit condition. Fixed now.
2009-05-15Further robustify nscd database lookup.Ulrich Drepper3-7/+8
We can compute an absolute maximum for the number of elements which can fit into the currently mapped database. Stop after that many iterations.
2009-05-15Robustify libc-side nscd database reader.Jakub Jelinek8-22/+41
The nscd database mapped in processes can change at any time. We have to be more vigilant when it comes to using that memory. Test the data entries are valid in their entire size, don't read data again from memory once we verified it, and make sure the trailing pointer is not going off the deep end.
2009-05-15Don't try to cleanup libselinux and libaudit.Jakub Jelinek3-20/+2
Because we are not shutting down the other threads first another thread might work on a query before the process shuts down. In this case the now uninitialized libselinux and libaudit might be used. Just don't free the resources. It's not necessary anyway because the process is about to terminate.
2009-04-26* nscd/connections.c (send_ro_fd): Define temporary variable to avoidUlrich Drepper1-1/+3
warning. * elf/sprof.c: Likewise.
2009-04-26* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inlineUlrich Drepper1-3/+4
from definition. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define label if it is not used. * elf/dl-profile.c (_dl_start_profile): Define real-type variant of gmon_hist_hdr and gmon_hdr structures and use them. * elf/dl-load.c (open_verify): Add temporary variable to avoid warning. * nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings. * sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition to avoid cast. * inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings. * inet/rcmd.c (rcmd_af): Make from a union of the various needed types to avoid warnings. (iruserok_af): Use ss_family instead of casts. * gmon/gmon.c (write_hist): Define real-type variant of gmon_hist_hdr structure and use it. (write_gmon): Likewise for gmon_hdr. * sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement function if we are not going to define it. * sysdeps/unix/sysv/linux/writev.c: Likewise. * inet/inet6_option.c (optin_alloc): Add temporary variable to avoid warning. * libio/strfile.h (struct _IO_streambuf): Use correct type and name of VTable element. * libio/iovsprintf.c: Avoid casts to avoid warnings. * libio/iovsscanf.c: Likewise. * libio/vasprintf.c: Likewise. * libio/vsnprintf.c: Likewise. * stdio-common/isoc99_vsscanf.c: Likewise. * stdlib/strfmon_l.c: Likewise. * debug/vasprintf_chk.c: Likewise. * debug/vsnprintf_chk.c: Likewise. * debug/vsprintf_chk.c: Likewise.
2009-03-16* nscd/connections.c (restart): Try to preserve the process nameUlrich Drepper1-1/+16
by reading the /proc/self/exe symlink and using the return name. Patch by Jeff Bastian <jbastian@redhat.com>.
2009-02-13[BZ #5381]Ulrich Drepper10-236/+57
2009-02-13 Ulrich Drepper <drepper@redhat.com> [BZ #5381] * nscd/nscd.h: Remove definitions and declarations for mem_in_flight. Change mempool_alloc prototype. * nscd/mem.c (gc): Don't handle mem_in_flight. (mempool_alloc): Third parameter now only indicates whether this is the first call (to allocate data) or not. If it is, get db rdlock. Release it on error. Don't handle mem_in_flight. * nscd/aicache.c (addhstaiX): Mark he parameter as const. Adjust third parameter of mempool_alloc calls. Nothing to do here in case mempool_alloc fails. Avoid local variable shadowing parameter. No need to get db rdlock before calling cache_add. * nscd/cache.c (cache_add): Adjust call to mempool_alloc. There is no mem_in_flight array anymore. * nscd/connections.c: Remove definition and handling of mem_in_flight. * nscd/grpcache.c (cache_addgr): Adjust third parameter of mempool_alloc calls. Mark he parameter as const. Nothing to do here in case mempool_alloc fails. No need to get db rdlock before calling cache_add. * nscd/hstcache.c (cache_addhst): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nscd/servicescache.c (cache_addserv): Likewise. * nscd/pwdcache.c (cache_addpw): Likewise. Remove some debugging code.
2009-02-06* debug/xtrace.sh: Unify translatable messages.Ulrich Drepper1-1/+21
* elf/ldd.bash.in: Likewise. * elf/sprof.c: Likewise. * locale/programs/locale.c: Likewise. * malloc/memusage.sh: Likewise. * nss/getent.c: Likewise. 2009-02-06 Joseph Myers <joseph@codesourcery.com> * debug/pcprofiledump.c (print_version, argp_program_version_hook): New function. * elf/ldconfig.c (more_help): New function. (argp): Use it. * elf/sln.c (usage): New function. (main): Support --help and --version. * malloc/memusagestat.c (print_version): New function. (argp_program_version_hook): New variable. * nscd/nscd.c (more_help): New function. (argp): Use it. * posix/getconf.c (main): Send --version output to stdout. Support --help. * sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS arguments. All callers changed. (print_version): New function. (parseargs): Support --help and --version. * sunrpc/rpcinfo.c (usage): Take STREAM argument. All callers changed. (print_version): New function. (main): Use getopt_long. Support --help and --version. * sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and --version. 2009-02-06 Ulrich Drepper <drepper@redhat.com>
2009-01-29[BZ #9750]Ulrich Drepper1-13/+8
* nscd/mem.c (gc): Use alloca_count to get the real stack usage. * include/alloca.h (alloca_account): Define. * sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Define. (stackinfo_sub_sp): Define.
2009-01-28* nscd/connections.c (nscd_init): If database file access beUlrich Drepper1-1/+4
opened check whether this is due to permission problems and bail in that case.
2009-01-28[BZ #9741]Ulrich Drepper1-2/+2
2009-01-28 Ulrich Drepper <drepper@redhat.com> [BZ #9741] * nscd/mem.c (gc): Fix assignment of he_data in case malloc is used. Reported by Jun'ichi Nomura <j-nomura@ce.jp.nec.com>.
2009-01-112009-01-10 Roland McGrath <roland@redhat.com>Roland McGrath1-1/+4
* nscd/nscd.c (parse_opt): Use argp_error for bad -i argument.
2009-01-02* posix/getconf.c: Update copyright year.Ulrich Drepper1-2/+2
* nss/getent.c: Likewise. * iconv/iconvconfig.c: Likewise. * iconv/iconv_prog.c: Likewise. * elf/ldconfig.c: Likewise. * catgets/gencat.c: Likewise. * csu/version.c: Likewise. * elf/ldd.bash.in: Likewise. * elf/sprof.c (print_version): Likewise. * locale/programs/locale.c: Likewise. * locale/programs/localedef.c: Likewise. * nscd/nscd.c (print_version): Likewise. * debug/xtrace.sh: Likewise. * malloc/memusage.sh: Likewise. * malloc/mtrace.pl: Likewise. * debug/catchsegv.sh: Likewise.
2008-12-29* nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd ifUlrich Drepper2-2/+29
LOCALDOMAIN is defined. * nscd/nscd_getai.c (__nscd_getai): Likewise.
2008-12-09[BZ #7067]Ulrich Drepper2-2/+13
2008-12-03 Petr Baudis <pasky@suse.cz> [BZ #7067] * nscd/connections.c (invalidate_cache): Use prune_run_lock instead of prune_lock. (nscd_run_prune): Before calling prune_cache, take prune_run_lock. * nscd/nscd.h (database_dyn): Add prune_run_cache.
2008-12-03* socket/sys/socket.h: Declare accept4.Ulrich Drepper1-19/+36
* socket/accept4.c: New file. * sysdeps/unix/sysv/linux/accept4.c: New file. * sysdeps/unix/sysv/linux/i386/accept4.S: New file. * socket/Makefile (routines): Add accept4. * socket/Versions: Export accept4 with version GLIBC_2.10. * socket/paccept.c: Removed. * sysdeps/unix/sysv/linux/paccept.c: Removed. * sysdeps/unix/sysv/linux/i386/paccept.S: Removed. * Versions.def: Define GLIBC_2.10 for libc. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_ACCEPT4. * nscd/connections.c: Use accept4. * sysdeps/unix/sysv/linux/i386/socket.S: Fix comment.
2008-10-17* elf/Makefile: Add rules to build and run tst-tls17.cvs/fedora-glibc-20081019T1815Ulrich Drepper1-0/+2
* elf/tst-tls17.c: New test. * elf/tst-tlsmod17a.c: New file. * elf/tst-tlsmod17b.c: Likewise.
2008-09-30* nscd/connections.c: Disable use of paccept for now.Ulrich Drepper1-1/+1
2008-08-03(main_loop_poll): Pass a buffer which is guaranteed to be large enough to ↵Ulrich Drepper1-6/+13
read inotify event. Ignore EAGAIN error. Better error message. Add branch predicition. (main_loop_epoll): Likewise.
2008-07-30* nscd/connections.c (nscd_init): Type if preprocessor directive.Ulrich Drepper1-1/+1
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PACCEPT): Define.
2008-07-26* Makeconfig: Define pie-ccflag and PIE-ccflag variables.Ulrich Drepper1-1/+1
* elf/Makefile: Use pie-ccflag variable. * nscd/Makefile: Likewise. * sysdeps/sparc/Makefile: Set $(pie-ccflag) to -fPIE.
2008-07-25* nscd/connections.c (nscd_init): Clean up fcntl call.Ulrich Drepper1-1/+1
2008-07-25* nscd/nscd_helper.c (open_socket): Use SOCK_CLOEXEC andUlrich Drepper1-3/+28
SOCK_NONBLOCK if possible.
2008-07-25* sysdeps/unix/sysv/linux/kernel-features.h: DefineUlrich Drepper1-22/+77
__ASSUME_PACCEPT, __ASSUME_IN_NONBLOCK, and __ASSUME_PACCEPT if appropriate. * nscd/connections.c: Avoid fcntl calls to set close-on-exec flag and non-blocking mode by using socket, paccept, and inotify_init1.
2008-07-12* nscd/connections.c (main_loop_poll): Fix handling of read errorsUlrich Drepper1-29/+83
from inotify. (main_loop_epoll): Likewise.
2008-06-18* nscd/connections.c (main_loop_poll): Fix test for read error.Ulrich Drepper1-2/+2
(main_loop_epoll): Likewise.
2008-06-13* nscd/connections.c: Also recognize and handle changes to theUlrich Drepper1-3/+25
resolver configuration file.
2008-06-12* nscd/nscd.h (struct database_dyn): Add inotify_descr and clear_cacheUlrich Drepper3-15/+132
fields. * nscd/connections.c (inotify_fd): New variable. (nscd_init): Try to open an inotify descriptor. If successful, watch files for databases using inotify instead of having prune threads stat the files. (nscd_run_prune): Recognize clear_cache flag being set and call prune_cache appropriately. (main_loop_poll): Add inotify descriptor to wait set and handle the reported changes. (main_loop_epoll): Likewise. * nscd/cache.c (prune_cache): Don't stat files for databases if inotify is used. * sysdeps/unix/sysv/linux/Makefile [subdir=nscd] (CFLAGS-connections.c): Add -DHAVE_INOTIFY.
2008-06-12* nscd/grpcache.c (cache_addgr): Correctly compute size ofcvs/fedora-glibc-20080612T1619Ulrich Drepper4-6/+27
fixed-size portion of the record. * nscd/servicescache.c (cache_addserv): Likewise. * nscd/pwdcache.c (cache_addpw): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise.
2008-06-12* nscd/mem.c (gc): Initialize obstack earlier so that if we jumpUlrich Drepper2-20/+31
out we don't use uninitialized memory. * nscd/hstcache.c (cache_addhst): Send correct number of bytes to the client.
2008-06-03* nscd/nscd_getserv_r.c (__nscd_getservbyport_r): Pass cp Jakub Jelinek1-1/+1
instead of portstr to nscd_getserv_r. Patch by Roman Kagan <rkagan@mail.ru>. 2008-06-03 Jakub Jelinek <jakub@redhat.com> * nscd/nscd_getserv_r.c (__nscd_getservbyport_r): Pass cp instead of portstr to nscd_getserv_r. Patch by Roman Kagan <rkagan@mail.ru>.
2008-05-18* nscd/cache.c (cache_add): Take additional parameter specifyingUlrich Drepper9-42/+94
whether this is in response of a cache refill. Check alignment of package data. Revamp waking of pruning thread. (prune_cache): Small optimization. * nscd/nscd.h: Adjust cache_add prototypes. * nscd/aicache.c: Adjust cache_add calls. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/pwdcache.c: Likewise. * nscd/servicescache.c: Likewise. * nscd/connections.c (restart): Really disable cache use before exec attempt. If it fails, reenable cache. (nscd_run_prune): Initialize wakeup_time. After wakeup, set wakeup time to max to be able to notice concurrent cache additions. Unlock prune_lock while performing gc. Afterwards compute wakeup time with current wakeup_time value in mind.
2008-05-18* nscd/mem.c (gc): Avoid stack overflow when allocating move list.cvs/fedora-glibc-20080518T1017Ulrich Drepper1-2/+16
2008-05-18* nscd/mem.c (gc): Correctly determine highest used array elementUlrich Drepper1-3/+3
in mark.
2008-05-18* nscd/mem.c (markrange): Add assert to check entries are allUlrich Drepper1-1/+2
aligned. Small cleanup in bitmap use.
2008-05-18* nscd/nscd.h (mem_in_flight): Replace blockaddr field withUlrich Drepper2-11/+13
blockoff of type nscd_ssize_t. * nscd/mem.c (gc): Simplify markrange call for on-flight blocks. (mempoll_alloc): Record block offset and not address.
2008-05-18* nscd/mem.c (gc): Fix test for stack overuse.Ulrich Drepper1-2/+2
2008-05-17* nscd/aicache.c (addhstaiX): Fix a few small problems, cleanups,Ulrich Drepper1-18/+19
more asserts.
2008-05-11* nscd/cache.c (cache_add): Before returning with failure and thisUlrich Drepper6-74/+24
is the first use of the record, mark it as unusable. * nscd/aicache.c: Don't touch the dataset after cache_add returns reporting a failure. * nscd/grpcache.c: Likewise * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/pwdcache.c: Likewise. * nscd/servicecache.c: Likewise.
2008-05-11(cache_add): Before returning with failure and this is the first use of the ↵Ulrich Drepper1-0/+5
record, mark it as unusable.
2008-05-10* include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsendUlrich Drepper1-200/+288
prototypes. * include/arpa/nameser_compat.h: Define T_UNSPEC. * nis/Versions (libnss_nis): Export _nss_nis_gethostbyname4_r. (libnss_nisplus): Export _nss_nisplus_gethostbyname4_r. * nis/nss_nis/nis-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_nis_gethostbyname4_r): New function. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change to also handle af==AF_UNSPEC. (get_tablename): New function. Use it to avoid duplication. (_nss_nisplus_gethostbyname4_r): New function. * nscd/aicache.c (addhstaiX): Use gethostbyname4_r function is available. * nss/Versions (libnss_files): Export _nss_files_gethostbyname4_r. * nss/nss.h: Define struct gaih_addrtuple. * nss/nss_files/files-hosts.c (LINE_PARSER): Change to also handle af==AF_UNSPEC. (_nss_files_gethostbyname4_r): New function. * resolv/Versions (libnss_dns): Export _nss_dns_gethostbyname4_r. * resolv/gethnmaddr.c: Adjust __libc_res_nsearch and __libc_res_nquery calls. * resolv/res_query.c (__libc_res_nquery): Take two additional parameters for second answer buffer. Handle type=T_UNSPEC to mean look up IPv4 and IPv6. Change all callers. * resolv/res_send.c (__libc_res_nsend): Take five aditional parameters for an additional query and answer buffer. Pass to send_vc and send_dg. (send_vc): Send possibly two requests and receive two answers. (send_dg): Likewise. * resolv/nss_dns/dns-host.c: Adjust calls to __libc_res_nsearch and __libc_res_nquery. (_nss_dns_gethostbyname4_r): New function. (gaih_getanswer_slice): Likewise. (gaih_getanswer): Likewise. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Adjust __libc_res_nquery call. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r): Likewise. (_nss_dns_getnetbyname_r): Adjust __libc_res_nsearch call. * sysdeps/posix/getaddrinfo.c: Use gethostbyname4_r function is available.
2008-04-22* nscd/Makefile (nscd-cflags): Set back to -fpie.Ulrich Drepper3-5/+4
* nscd/nscd.h (mem_in_flight): Add attribute_tls_model_ie. * nscd/connections.c (mem_in_flight): Likewise. * nscd/nscd.h (dbs): Make hidden. * sysdeps/unix/sysv/linux/times.c (__times): Fix check for EFAULT. Avoid returning -1, return 0 instead.
2008-04-19[BZ #5209, BZ #5381]Ulrich Drepper11-34/+160
2008-04-15 Ulrich Drepper <drepper@redhat.com> [BZ #5209] * sysdeps/unix/sysv/linux/times.c: New file. [BZ #5381] * nscd/nscd.h: Define enum in_flight, mem_in_flight, and mem_in_flight_list variables. Add new parameter to mempool_alloc prototype. * nscd/mem.c (mempool_alloc): Take additional parameter. Initialize appropriate mem_in_flight element. (gc): Take allocations which have not yet been committed to the database into account. * nscd/cache.c (cache_add): Add new parameter to mempool_alloc call. Reset mem_in_flight before returning. * nscd/connections.c (nscd_run_worker): Initialize mem_in_flight and cue it up in mem_in_flight_list. * nscd/aicache.c: Adjust mempool_alloc call. * nscd/grpcache.c: Likewise. * nscd/hstcache.c: Likewise. * nscd/initgrcache.c: Likewise. * nscd/pwdcache.c: Likewise. * nscd/servicescache.c: Likewise. * nscd/Makefile (nscd-flags): Until ld is fixed, use -fpic instead of -fpie. * nscd/connections.c (handle_request): Provide better error message in case SELinux forbids the service. * version.h (VERSION): Bump to 2.8.90.