From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout-webserver.scc.kit.edu (mailout-webmail.scc.kit.edu [129.13.185.232]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s79F4p5l031166 for ; Sat, 9 Aug 2014 11:04:51 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-02.scc.kit.edu with esmtp (Exim 4.72 #1) id 1XG8CQ-0004Tt-2Q; Sat, 09 Aug 2014 17:04:50 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1XG8CQ-0000aG-1X for tech@mdocml.bsd.lv; Sat, 09 Aug 2014 17:04:50 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1XG8CP-0007tl-WD for tech@mdocml.bsd.lv; Sat, 09 Aug 2014 17:04:50 +0200 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1XG8Bf-0003dy-Cu for tech@mdocml.bsd.lv; Sat, 09 Aug 2014 17:04:03 +0200 Date: Sat, 9 Aug 2014 17:04:03 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: OSX + mmap + mansearch.c + documentation Message-ID: <20140809150403.GB30999@iris.usta.de> References: <53E60B48.5000003@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53E60B48.5000003@bsd.lv> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Kristaps, Kristaps Dzonsons wrote on Sat, Aug 09, 2014 at 01:51:36PM +0200: > Small thing noticed in OSX: > > % /usr/local/bin/apropos find > mmap: Invalid argument > > According to the Mac OSX manpage for mmap(2), this is because: > > [EINVAL] flags does not include either MAP_PRIVATE or MAP_SHARED. Fixed in rc3. That release candidate contains another fix for an issue reported by Thomas Klausner: config.h was forgotten in mansearch_const.c. > It's easy enough to add a mmap_flags variable as MAP_ANON | blah and > ifdef it to do one or the other. (I hesitate to say which, but am > guessing MAP_PRIVATE since the page cache isn't (???) shared across > processes.) Well, even on OpenBSD the manual says that either MAP_PRIVATE or MAP_SHARED is required, it just doesn't seem to be enforced by the implementation, so i simply added MAP_SHARED like in all three other places where we use mmap(2), for minimum disruption for the release. Now i do wonder why we use MAP_SHARED and not MAP_PRIVATE. But that's a question for after release, i have taken a note in the TODO file. > In general, the section scares me--I vaguely guess at what's > happening, but have no idea why. Unfortunately, at one point, i accidentally deleted my gprof(1) logs, but off the top of my head, i'm quite sure the point was that without SQLITE_CONFIG_PAGECACHE, apropos(1) spends considerable extra time, that is, about 10-25% of the total time it needs, in malloc(3) and free(3) called from within sqlite3_*() functions. > So more pertinently than the bit-field would be to document > this section! Ingo mentions the speed reduction in his talk > (pg. 20, http://www.openbsd.org/papers/bsdcan14-mandoc.pdf), > but not /why/ there's a speed reduction. It scares you - you mean tedu@ might suspect exploit mitigation countermeasures? That might be worth investigating, too. While espie@ holds the chief SQLite developer in high esteem, deraadt@ hates the code quality. Myself, i didn't form an opinion on the SQLite code, yet. But for this release, i'll keep the lid on that can of worms. Yours, Ingo -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv