From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 30 04:14:12 2014 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C477DDF5 for ; Tue, 30 Sep 2014 04:14:12 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93A493DB for ; Tue, 30 Sep 2014 04:14:12 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id s8U4ECc7060300 for ; Tue, 30 Sep 2014 04:14:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 194025] New: [PATCH] nscd set query timeout properly Date: Tue, 30 Sep 2014 04:14:12 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: dpejesh@yahoo.com X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2014 04:14:12 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194025 Bug ID: 194025 Summary: [PATCH] nscd set query timeout properly Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: Needs Triage Severity: Affects Some People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: dpejesh@yahoo.com Created attachment 147818 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=147818&action=edit set timeout properly So, I've noticed nscd hasn't worked right for awhile now. Since I upgraded to 10.0 it never seemed to cache properly but I never bothered to really dig into it until recently and here's what I've found. In my environment I have nsswitch set to use caching and LDAP as such: group: files cache ldap passwd: files cache ldap The LDAP part works fine, but caching didn't on 10.0 for some reason. On my 9.2 machines it works as expected though. What I've found is in usr.sbin/nscd/query.c struct query_state * init_query_state(int sockfd, size_t kevent_watermark, uid_t euid, gid_t egid) { ... memcpy(&retval->timeout, &s_configuration->query_timeout, sizeof(struct timeval)); ... } s_configuration->query_timeout is an 'int' which is being memcpy'd into a 'struct timeval' causing it to grab other parts of the s_configuration struct along with the query_timeout value and polluting retval->timeout. In this case it appears to be grabbing s_configuration->threads_num and shoving that into timeout.tv_sec along with the query_timeout. This ends up confusing nscd later on (instead of being 8 it ends up being set to 34359738376) and breaks it's ability to cache. I've attached a patch to set the retval->timeout properly and gets nscd working again. I'm guessing gcc was handling this differently from clang which is why it wasn't a problem before 10.0. -- You are receiving this mail because: You are the assignee for the bug.