public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero
@ 2020-04-04 20:37 Sven Schnelle
  2020-04-04 20:37 ` [PATCH 2/2] selftests/vDSO: make vDSO test work on s390x Sven Schnelle
  2020-04-28  6:20 ` [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Sven Schnelle
  0 siblings, 2 replies; 4+ messages in thread
From: Sven Schnelle @ 2020-04-04 20:37 UTC (permalink / raw)
  To: Shuah Khan
  Cc: svens, Thomas Gleixner, Steve Winslow, Alexios Zavras,
	Allison Randal, linux-kselftest, linux-kernel, Sven Schnelle

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28  6:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-04 20:37 [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Sven Schnelle
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox