From: "Minqiang Chen (ptpt52)" <ptpt52@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] BUG fix: mmap pass wrong offset to kernel
Date: Tue, 16 Nov 2021 11:56:57 +0800 [thread overview]
Message-ID: <1F85A2EF-1942-48CE-989E-7552970E6877@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]
From 146066a9794b8e39c53337b71a8476b86e79e7d4 Mon Sep 17 00:00:00 2001
From: Chen Minqiang <ptpt52@gmail.com>
Date: Mon, 16 Oct 2017 08:57:41 +0800
Subject: [PATCH] musl: fix mmap pass wrong offset to kernel
on 32bit platform for example off_t x=0x8d9eb000, the x/4096 result
is 0xfff8d9eb, but the sys_mmap2() is expecting 0x8d9eb to be pass to
this happens on 32bit platform or 64bit platform when
x > = 0x80000000 (32bit platform)
or
x > = 0x8000000000000000 (64bit platform)
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
---
src/mman/mmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mman/mmap.c b/src/mman/mmap.c
index eff88d82..f225cdbb 100644
--- a/src/mman/mmap.c
+++ b/src/mman/mmap.c
@@ -26,7 +26,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);
#else
ret = __syscall(SYS_mmap, start, len, prot, flags, fd, off);
#endif
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 9119 bytes --]
next reply other threads:[~2021-11-16 11:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 3:56 Minqiang Chen (ptpt52) [this message]
2021-11-16 16:18 ` Rich Felker
2022-01-09 6:00 ` 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=1F85A2EF-1942-48CE-989E-7552970E6877@gmail.com \
--to=ptpt52@gmail.com \
--cc=musl@lists.openwall.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).