From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/373 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: New daily reports - nothing Date: Tue, 9 Aug 2011 21:38:39 -0400 Message-ID: <20110810013839.GU132@brightrain.aerifal.cx> References: <4E39C84F.8060705@gmail.com> <20110803224651.GB11437@openwall.com> <4E3A79B2.8090204@gmail.com> <4E3B331E.7050502@gmail.com> <4E3CC5AC.3070404@gmail.com> <4E3DFB5D.8040008@gmail.com> <20110807073224.GG132@brightrain.aerifal.cx> <4E3F10C7.4060601@gmail.com> <4E40A33F.7090804@gmail.com> <4E41E020.7020109@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1312941096 22453 80.91.229.12 (10 Aug 2011 01:51:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2011 01:51:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-374-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 10 03:51:31 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QqxxD-0004rC-SP for gllmg-musl@lo.gmane.org; Wed, 10 Aug 2011 03:51:31 +0200 Original-Received: (qmail 21755 invoked by uid 550); 10 Aug 2011 01:51:31 -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 21747 invoked from network); 10 Aug 2011 01:51:31 -0000 Content-Disposition: inline In-Reply-To: <4E41E020.7020109@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:373 Archived-At: On Wed, Aug 10, 2011 at 03:34:24AM +0200, Luka Marčetić wrote: > Nothing to report for today, I'm afraid. > Not much time left either. I hoped you'd suggest what to do, but I > had to spend time fixing stuff anyway. And since I still do, my > priorities are: > > - Fix and commit buf.c * > - Fix other tests that are still broken (setuid, alloc) > - Complete the started ones (pthread_eintr) > > * I don't know what's up with this: http://codepad.org/Ysn2roYC. See http://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html The mprotect() function shall change the access protections to be that specified by prot for those whole pages containing any part of the address space of the process starting at address addr and continuing for len bytes. There is no way to protect individual bytes. You could arrange for the first byte past the end of the buffer to be protected by starting the buffer "len" bytes before a page boundary, but if your goal is to detect invalid writes rather than invalid reads, it's just as good to allocate an overly-long buffer, fill the space that should not be used with known content, and check whether that content has been clobbered after the call. This avoids requiring any hacks with signal handlers for SIGSEGV. Especially as you're nearing the deadline, I'd like to ask you to please listen when I make recommendations like this. Sure learning about mprotect is educational, but in terms of getting stuff done, if you'd taken my advice several days (a week now?) back about how to check for writes past the end of the buffer, you would have been able to spend your time today getting something done rather than wondering why mprotect wasn't doing what you wanted.... Rich