Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Sat, 21 Oct 2017 00:20:05 -0400
From: Rich Felker <dalias@...c.org>
To: Minqiang Chen <ptpt52@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH v1] mman: fix mmap pass wrong offset to kernel

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 <dalias@...c.org> 写道:
> > 
> > On Mon, Oct 16, 2017 at 01:03:18PM +0200, Szabolcs Nagy wrote:
> >> * Minqiang Chen <ptpt52@...il.com> [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
> 

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.