From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8526 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: pthread_getattr_np() vs explicit runtime loader Date: Sun, 20 Sep 2015 14:27:28 -0400 Message-ID: <20150920182728.GM17773@brightrain.aerifal.cx> References: <20150920063909.GO12087@example.net> <20150920163405.GK17773@brightrain.aerifal.cx> <20150920172237.GR12087@example.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jho1yZJdad60DJr+" X-Trace: ger.gmane.org 1442773666 5771 80.91.229.3 (20 Sep 2015 18:27:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Sep 2015 18:27:46 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8538-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 20 20:27:46 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 1ZdjKy-0000j2-RZ for gllmg-musl@m.gmane.org; Sun, 20 Sep 2015 20:27:45 +0200 Original-Received: (qmail 20311 invoked by uid 550); 20 Sep 2015 18:27:42 -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 20290 invoked from network); 20 Sep 2015 18:27:41 -0000 Content-Disposition: inline In-Reply-To: <20150920172237.GR12087@example.net> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8526 Archived-At: --jho1yZJdad60DJr+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Sep 20, 2015 at 07:22:37PM +0200, u-wsnj@aetey.se wrote: > On Sun, Sep 20, 2015 at 12:34:05PM -0400, Rich Felker wrote: > > On Sun, Sep 20, 2015 at 08:39:09AM +0200, u-wsnj@aetey.se wrote: > > > Would you comment on whether this guess is correct and hopefully make > > > pthread_getattr_np() work even with the explicit loader? > > > > I reviewed the code and there are no assumptions about how the program > > is loaded made there. And the original test program I used to test > > pthread_getattr_np runs fine both normally and with an explicit loader > > command. So I think the actual problem must be elsewhere, likely in > > whatever the application is doing right after pthread_getattr_np. > > Thanks for checking, sorry that the hypothesis seems to be wrong. > > May I run a test with that program of yours? Test program attached. It's just a very basic functionality check. > > What triggered the crash to start happening? Upgrading musl? Upgrading > > It is the behaviour of gcc 5. This was the case when I built 5.1.0 but > 5.2.0 was supposed to be more compatible with musl, so I did not research > 5.1.0. Now gcc 5.2.0 behaves identically in this respect. And both musl and the crashing app were compiled with gcc 5? If so the problem could be on either side. > > gcc? Have you used gdb to get a backtrace and see where the program > > actually crashes? > > Not yet, going to. Rebuilding gcc with '-g', this takes some time. Unless gcc is the program crashing I don't see why you need to rebuild gcc with -g... Rich --jho1yZJdad60DJr+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="getstack.c" #define _GNU_SOURCE #include #include #include void *start(void *p) { for (;;) pause(); } void printstack(pthread_attr_t *a) { void *base; size_t size; pthread_attr_getstack(a, &base, &size); printf("%p - %p (%zu)\n", base, (char *)base+size, size); } char buf[12345]; int main() { pthread_t td; pthread_attr_t a; pthread_attr_init(&a); pthread_attr_setstack(&a, buf, sizeof buf); printf("buf = %p\n", buf); pthread_create(&td, &a, start, 0); pthread_getattr_np(td, &a); printstack(&a); pthread_getattr_np(pthread_self(), &a); printstack(&a); } --jho1yZJdad60DJr+--