[09/11] util-vdso: Check chain for STN_UNDEF

Submitted by Dmitry Safonov on May 22, 2019, 6:18 p.m.

Details

Message ID 20190522181825.15064-10-dima@arista.com
State New
Series "vdso: arm32 support"
Headers show

Commit Message

Dmitry Safonov May 22, 2019, 6:18 p.m.
Rather than chain[chain] != STN_UNDEF.
Seems like, on !ARM32 vdso there are more symbols and less chance to hit
this "feature".

Fixes parsing of __vdso_clock_gettime symbol on v5.1 arm kernel.

Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 criu/pie/util-vdso.c      | 2 +-
 test/zdtm/static/vdso01.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/pie/util-vdso.c b/criu/pie/util-vdso.c
index 6213df9a42d0..104da0633240 100644
--- a/criu/pie/util-vdso.c
+++ b/criu/pie/util-vdso.c
@@ -242,7 +242,7 @@  static void parse_elf_symbols(uintptr_t mem, size_t size, Phdr_t *load,
 		const char * symbol = vdso_symbols[i];
 		k = elf_hash((const unsigned char *)symbol);
 
-		for (j = bucket[k % nbucket]; j < nchain && chain[j] != STN_UNDEF; j = chain[j]) {
+		for (j = bucket[k % nbucket]; j < nchain && j != STN_UNDEF; j = chain[j]) {
 			addr = mem + dyn_symtab->d_un.d_ptr - load->p_vaddr;
 			Sym_t *sym;
 			char *name;
diff --git a/test/zdtm/static/vdso01.c b/test/zdtm/static/vdso01.c
index be733663cd36..269688c5e00b 100644
--- a/test/zdtm/static/vdso01.c
+++ b/test/zdtm/static/vdso01.c
@@ -246,7 +246,7 @@  static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
 	for (i = 0; i < ARRAY_SIZE(vdso_symbols); i++) {
 		k = elf_hash((const unsigned char *)vdso_symbols[i]);
 
-		for (j = bucket[k % nbucket]; j < nchain && chain[j] != STN_UNDEF; j = chain[j]) {
+		for (j = bucket[k % nbucket]; j < nchain && j != STN_UNDEF; j = chain[j]) {
 			Sym_t *sym = (void *)&mem[dyn_symtab->d_un.d_ptr - load->p_vaddr];
 			char *name;