From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14058 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Fix the use of syscall result in dl_mmap Date: Sat, 6 Apr 2019 09:40:35 -0400 Message-ID: <20190406134035.GQ23599@brightrain.aerifal.cx> References: <915E241F-3931-49F5-88C6-17888CBE5022@gmail.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="57434"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: Ilya Matveychikov Original-X-From: musl-return-14074-gllmg-musl=m.gmane.org@lists.openwall.com Sat Apr 06 15:40:52 2019 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.89) (envelope-from ) id 1hClYy-000Eql-6m for gllmg-musl@m.gmane.org; Sat, 06 Apr 2019 15:40:52 +0200 Original-Received: (qmail 7550 invoked by uid 550); 6 Apr 2019 13:40:49 -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 7532 invoked from network); 6 Apr 2019 13:40:48 -0000 Content-Disposition: inline In-Reply-To: <915E241F-3931-49F5-88C6-17888CBE5022@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14058 Archived-At: On Sat, Feb 09, 2019 at 06:56:17PM +0400, Ilya Matveychikov wrote: > 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 Thanks! Sorry I overlooked this before. I'm applying it now. Rich > Signed-off-by: Ilya V. Matveychikov > --- > 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 wrote: > > > > Signed-off-by: Ilya V. Matveychikov > > --- > > 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 > >