From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6853 Path: news.gmane.org!not-for-mail From: Sebastian Gottschall Newsgroups: gmane.linux.lib.musl.general Subject: Re: pthreads broken (freeradius testcase) Date: Fri, 16 Jan 2015 09:07:50 +0100 Message-ID: <54B8C6D6.9070009@dd-wrt.com> References: <54B844B4.1000500@dd-wrt.com> <20150116082000.57abc5c9@ncopa-desktop.alpinelinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1421395690 31011 80.91.229.3 (16 Jan 2015 08:08:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2015 08:08:10 +0000 (UTC) Cc: musl@lists.openwall.com To: Natanael Copa Original-X-From: musl-return-6866-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jan 16 09:08:06 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YC1ws-0005nk-6N for gllmg-musl@m.gmane.org; Fri, 16 Jan 2015 09:08:06 +0100 Original-Received: (qmail 27924 invoked by uid 550); 16 Jan 2015 08:08:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 27908 invoked from network); 16 Jan 2015 08:08:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To:References:CC:To:MIME-Version:From:Date:Message-ID; bh=7QTKEd11sSQZG/Ih0ztMcosEGb0wyX9vR4AeMKSeeyc=; b=QVanjJqm0lx3mf8nvLRih+l0fWPB0lh8Ay80QyR25n4rIPuoTS8gICFo7T5E1bi/SXq9ZBygA0mCu6BwlFVU6A5l5mjCiQXYV5ikkqblhPCPb+5BZ7fVGDcKLIjA+6VSecl+huvGvJmXk2qmW1JO5QyAcduacOc9H29fAGYL94Q=; User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <20150116082000.57abc5c9@ncopa-desktop.alpinelinux.org> X-SA-Exim-Connect-IP: 87.155.240.136 X-SA-Exim-Mail-From: s.gottschall@dd-wrt.com X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on webmail.newmedia-net.de X-Spam-Level: X-Spam-Status: No, score=-2.5 required=4.0 tests=ALL_TRUSTED,BAYES_00, DNS_FROM_AHBL_RHSBL,RATWARE_GECKO_BUILD autolearn=no version=3.1.9, No X-SA-Exim-Version: 4.2.1 (built Thu, 26 May 2011 15:22:33 +0200) X-SA-Exim-Scanned: Yes (on webmail.newmedia-net.de) X-NMN-MailScanner-Information: Please contact the ISP for more information X-NMN-MailScanner-ID: 1YC1wb-0005Mu-Pk X-NMN-MailScanner: Found to be clean X-NMN-MailScanner-From: s.gottschall@dd-wrt.com X-Received: from [87.155.240.136] (helo=[10.88.193.128]) by webmail.newmedia-net.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1YC1wb-0005Mu-Pk; Fri, 16 Jan 2015 09:07:50 +0100 Xref: news.gmane.org gmane.linux.lib.musl.general:6853 Archived-At: Am 16.01.2015 um 08:20 schrieb Natanael Copa: > On Thu, 15 Jan 2015 23:52:36 +0100 > Sebastian Gottschall wrote: > >> following test case >> >> configure freeradius with --with-threads (which is on by default) >> if you start radiusd with your radius configuration you will see that >> radius does not listen on any ports. it will hang in the listener thread >> which creates the socket. >> if you configure it as --without-threads, it works >> >> >> tested with musl 1.1.6 on a mips (big endian) system using kernel 3.10 >> >> Sebastian > What version of freeradius is it? latest 2.2.6 if you disable setguid support it will also work again. i tracked it down to the function > > I have had some interesting threading issues with freeradius 2.2.x. > Some modules are marked as non-thread safe but will still run in a > separate thread. It runs main thread + a single non-thread-safe thread. it already hangs in the main application while initializing the udp listeners. this can be also seen if you start it with -xx and write the debug output to a log file. > > They used getgrnam and getpwnam in both main thread and in the > non-thread-safe module so memory got corrupted. (IMHO this should get a > CVE but upstream disagrees because it only happens on a non-recommended > config) > > They fixed that in 3.x.x but AFAIK they didn't fix it in 2.x.x. > > Patches: > http://git.alpinelinux.org/cgit/aports/tree/main/freeradius/0001-Use-threadsafe-wrapper-for-getpwnam-getgrnam.patch > http://git.alpinelinux.org/cgit/aports/tree/main/freeradius/0001-use-threadsafe-rad_getgrnam.patch > > (upstream patched it differently in 3.x.x branch) > > When backporting the fix to 2.x.x I also found that the TLS configure > test is completely broke in 2.x.x branch too. IIRC it will say "TLS > found" but behind the scenes it will still disable TLS support. ouch. thanks. i stumble over that issue too. a user reported that bug recently to me. > > patch: > http://git.alpinelinux.org/cgit/aports/tree/main/freeradius/fix-tls-test.patch > > This is probably not the related the issue you have have at hand, but > I'm would not be surprised if musl libc has unmasked another bug in > freeradius. it has. and you helped me alot just right now thanks Sebastian > > > -nc >