From: Sven Schnelle <svens@linux.ibm.com>
To: Shuah Khan <shuah@kernel.org>
Cc: svens@stackframe.org, Thomas Gleixner <tglx@linutronix.de>,
Steve Winslow <swinslow@gmail.com>,
Alexios Zavras <alexios.zavras@intel.com>,
Allison Randal <allison@lohutok.net>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Sven Schnelle <svens@linux.ibm.com>
Subject: [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero
Date: Sat, 4 Apr 2020 22:37:03 +0200 [thread overview]
Message-ID: <20200404203704.69412-1-svens@linux.ibm.com> (raw)
If vdso_info can't be parsed correctly, vdso_info.nbucket might
contain zero. Add a check and return NULL which will fail the
symbol lookup.
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
---
tools/testing/selftests/vDSO/parse_vdso.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 1dbb4b87268f..8e5a70a24d9a 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -226,6 +226,9 @@ void *vdso_sym(const char *version, const char *name)
return 0;
ver_hash = elf_hash(version);
+ if (!vdso_info.nbucket)
+ return NULL;
+
ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket];
for (; chain != STN_UNDEF; chain = vdso_info.chain[chain]) {
--
2.17.1
next reply other threads:[~2020-04-04 20:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-04 20:37 Sven Schnelle [this message]
2020-04-04 20:37 ` [PATCH 2/2] selftests/vDSO: make vDSO test work on s390x Sven Schnelle
2020-04-28 6:21 ` Sven Schnelle
2020-04-28 6:20 ` [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Sven Schnelle
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=20200404203704.69412-1-svens@linux.ibm.com \
--to=svens@linux.ibm.com \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=svens@stackframe.org \
--cc=swinslow@gmail.com \
--cc=tglx@linutronix.de \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox