From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3024 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: pthread_getattr_np Date: Sun, 31 Mar 2013 23:37:59 +0200 Message-ID: <20130331213759.GJ30576@port70.net> References: <20130331173518.GH30576@port70.net> <20130331180717.GI20323@brightrain.aerifal.cx> <20130331205139.GI30576@port70.net> <20130331210005.GJ20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1364765888 24432 80.91.229.3 (31 Mar 2013 21:38:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Mar 2013 21:38:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3025-gllmg-musl=m.gmane.org@lists.openwall.com Sun Mar 31 23:38:36 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1UMPxT-0007TP-ID for gllmg-musl@plane.gmane.org; Sun, 31 Mar 2013 23:38:35 +0200 Original-Received: (qmail 30164 invoked by uid 550); 31 Mar 2013 21:38:10 -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 30156 invoked from network); 31 Mar 2013 21:38:10 -0000 Content-Disposition: inline In-Reply-To: <20130331210005.GJ20323@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3024 Archived-At: * Rich Felker [2013-03-31 17:00:05 -0400]: > > to get a 'precize' lowend one can: > > 1) parse /proc/self/maps which gives the current [low,high] mapping > > and 'prev' the high end of the last mapping below the stack > > 2) if we are the main thread check if low <= sp <= high > > 3) check rlimit > > Parsing /proc/self/maps is utterly useless for non-main-thread. Unless > the thread has a guard page, its stack mapping can be adjacent to > another thread's stack mapping, and thus they can get merged into a > single mapping. i was only talking about the main thread case, because you said the other case is simple what i meant in 2) is if another thread tries to query the stack of the main thread the /proc/self/maps works for that too, but then you cannot check if sp is really in the given intervall