From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12025 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v1] mman: fix mmap pass wrong offset to kernel Date: Sat, 21 Oct 2017 00:20:05 -0400 Message-ID: <20171021042005.GV1627@brightrain.aerifal.cx> References: <20171016110318.GQ15263@port70.net> <20171016162743.GP1627@brightrain.aerifal.cx> <94E25077-4463-454D-96BF-BA1DA9166F60@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1508559633 19200 195.159.176.226 (21 Oct 2017 04:20:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Oct 2017 04:20:33 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: Minqiang Chen Original-X-From: musl-return-12038-gllmg-musl=m.gmane.org@lists.openwall.com Sat Oct 21 06:20:28 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1e5lGh-0002cc-BD for gllmg-musl@m.gmane.org; Sat, 21 Oct 2017 06:20:15 +0200 Original-Received: (qmail 6044 invoked by uid 550); 21 Oct 2017 04:20:20 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 6021 invoked from network); 21 Oct 2017 04:20:19 -0000 Content-Disposition: inline In-Reply-To: <94E25077-4463-454D-96BF-BA1DA9166F60@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12025 Archived-At: On Fri, Oct 20, 2017 at 05:06:29PM +0800, Minqiang Chen wrote: > I don’t know why, but this is how I fix it. > on arm_cortex-a15 it is 32bit arch off_t is always 64-bit regardless of whether it's a 32-bit arch. This is definitely a bug in the calling program, not musl. > > 在 2017年10月17日,00:27,Rich Felker 写道: > > > > On Mon, Oct 16, 2017 at 01:03:18PM +0200, Szabolcs Nagy wrote: > >> * Minqiang Chen [2017-10-16 09:09:32 +0800]: > >>> > >>> musl: fix mmap pass wrong offset to kernel > >>> > >>> > >>> > >>> for example off_t x=0x8d9eb000, the x/4096 result is 0xfff8d9eb, > >>> not 0x8d9eb as expecting > >>> > >> > >> off_t is 64bit, not 32bit, so x/4096 should not signextend. > >> you need to investigate this problem more. > > > > I suspect the calling code stored the offset 0x8d9eb000 in a signed > > 32-bit variable (converting it to a negative value) and then passed > > the resulting negative value to mmap. > > > > Rich >