From: Szabolcs Nagy <nsz@port70.net>
To: Minqiang Chen <ptpt52@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [PATCH v1] mman: fix mmap pass wrong offset to kernel
Date: Mon, 16 Oct 2017 13:03:18 +0200 [thread overview]
Message-ID: <20171016110318.GQ15263@port70.net> (raw)
In-Reply-To: <CAE-jjv7YFQBjE1LGy2MGLBPa2enpcysnnrJw+mSkGwJKmupjAA@mail.gmail.com>
* Minqiang Chen <ptpt52@gmail.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.
> this happens on arm_cortex-a15 with gcc 6.3.x
>
>
>
> Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
>
>
> *diff --git a/src/mman/mmap.c b/src/mman/mmap.c*
>
> *index 1592403..a09c901 100644*
>
> *--- a/src/mman/mmap.c*
>
> *+++ b/src/mman/mmap.c*
>
> *@@ -27,7 +27,7 @@* void *__mmap(void *start, size_t len, int prot, int
> flags, int fd, off_t off)
>
> __vm_wait();
>
> }
>
> #ifdef SYS_mmap2
>
> *- ret = __syscall(SYS_mmap2, start, len, prot, flags, fd, off/UNIT);*
>
> *+* *ret = __syscall(SYS_mmap2, start, len, prot, flags, fd,
> (unsigned long)off/UNIT);*
this is wrong, off is 64bit signed int, it can have values
outside of the range of unsigned long.
(and your email client ruined the patch with random '*' and '\n')
next prev parent reply other threads:[~2017-10-16 11:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 1:09 Minqiang Chen
2017-10-16 11:03 ` Szabolcs Nagy [this message]
2017-10-16 16:27 ` Rich Felker
[not found] ` <94E25077-4463-454D-96BF-BA1DA9166F60@gmail.com>
2017-10-21 4:20 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171016110318.GQ15263@port70.net \
--to=nsz@port70.net \
--cc=musl@lists.openwall.com \
--cc=ptpt52@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).