From: Ilya Matveychikov <matvejchikov@gmail.com>
To: musl@lists.openwall.com
Cc: dalias@glibc.org
Subject: [PATCH] Fix the use of syscall result in dl_mmap
Date: Sat, 9 Feb 2019 18:56:17 +0400 [thread overview]
Message-ID: <915E241F-3931-49F5-88C6-17888CBE5022@gmail.com> (raw)
In-Reply-To: <DAE287BF-0962-4B40-9711-716E5738D0F2@gmail.com>
Correct version of the change thanks to Rich Felker!
I was not cc-ed, so here is the discussion:
https://www.openwall.com/lists/musl/2019/02/09/2
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
ldso/dynlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index ec921df..76e8c06 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -904,7 +904,7 @@ static void *dl_mmap(size_t n)
#else
p = (void *)__syscall(SYS_mmap, 0, n, prot, flags, -1, 0);
#endif
- return p == MAP_FAILED ? 0 : p;
+ return (unsigned long)p > -4096UL ? 0 : p;
}
static void makefuncdescs(struct dso *p)
—
2.7.4
> On Feb 9, 2019, at 5:34 PM, Ilya Matveychikov <matvejchikov@gmail.com> wrote:
>
> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> ---
> ldso/dynlink.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ldso/dynlink.c b/ldso/dynlink.c
> index ec921df..329b42a 100644
> --- a/ldso/dynlink.c
> +++ b/ldso/dynlink.c
> @@ -904,6 +904,7 @@ static void *dl_mmap(size_t n)
> #else
> p = (void *)__syscall(SYS_mmap, 0, n, prot, flags, -1, 0);
> #endif
> + p = (void *)__syscall_ret((unsigned long)p);
> return p == MAP_FAILED ? 0 : p;
> }
>
> --
> 2.7.4
>
next prev parent reply other threads:[~2019-02-09 14:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 13:34 [PATCH] Add missing __syscall_ret " Ilya Matveychikov
2019-02-09 14:35 ` Rich Felker
2019-02-09 14:56 ` Ilya Matveychikov [this message]
2019-04-06 13:40 ` [PATCH] Fix the use of syscall result " 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=915E241F-3931-49F5-88C6-17888CBE5022@gmail.com \
--to=matvejchikov@gmail.com \
--cc=dalias@glibc.org \
--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).