mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bobby Bingham <koorogi@koorogi.info>
To: musl@lists.openwall.com
Subject: [PATCH 1/3] treat null vdso base same as missing
Date: Mon, 25 Jul 2016 22:52:58 -0500	[thread overview]
Message-ID: <20160726035300.10255-1-koorogi@koorogi.info> (raw)

On s390x, the kernel provides AT_SYSINFO_EHDR, but sets it to zero, if the
program being run does not have a program interpreter.  This causes
problems when running the dynamic linker directly.
---
 ldso/dynlink.c      | 2 +-
 src/internal/vdso.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index e458f38..5a9e2ba 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -1549,7 +1549,7 @@ _Noreturn void __dls3(size_t *sp)
 	}
 
 	/* Attach to vdso, if provided by the kernel */
-	if (search_vec(auxv, &vdso_base, AT_SYSINFO_EHDR)) {
+	if (search_vec(auxv, &vdso_base, AT_SYSINFO_EHDR) && vdso_base) {
 		Ehdr *ehdr = (void *)vdso_base;
 		Phdr *phdr = vdso.phdr = (void *)(vdso_base + ehdr->e_phoff);
 		vdso.phnum = ehdr->e_phnum;
diff --git a/src/internal/vdso.c b/src/internal/vdso.c
index 6ae0212..ff392bc 100644
--- a/src/internal/vdso.c
+++ b/src/internal/vdso.c
@@ -44,6 +44,7 @@ void *__vdsosym(const char *vername, const char *name)
 	size_t i;
 	for (i=0; libc.auxv[i] != AT_SYSINFO_EHDR; i+=2)
 		if (!libc.auxv[i]) return 0;
+	if (!libc.auxv[i+1]) return 0;
 	Ehdr *eh = (void *)libc.auxv[i+1];
 	Phdr *ph = (void *)((char *)eh + eh->e_phoff);
 	size_t *dynv=0, base=-1;
-- 
2.9.0



             reply	other threads:[~2016-07-26  3:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  3:52 Bobby Bingham [this message]
2016-07-26  3:52 ` [PATCH 2/3] allow different size hash table entries Bobby Bingham
2016-07-27 16:49   ` Alexander Monakov
2016-07-26  3:53 ` [PATCH 3/3] add s390x port Bobby Bingham
2016-10-21 20:27   ` Rich Felker
2016-10-22  0:15     ` Bobby Bingham
2016-10-22  2:59       ` 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=20160726035300.10255-1-koorogi@koorogi.info \
    --to=koorogi@koorogi.info \
    --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).