diff options
author | Bryan Cantrill <bryan@joyent.com> | 2015-03-10 17:44:06 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2016-04-10 10:16:48 -0700 |
commit | beee6fc0eea41662170c4dea38a7e5605ab59507 (patch) | |
tree | e3322dfe16c0da586e15d27eedffde9eb31c57df /usr/src/lib | |
parent | 9498083eeaed1aacdde41369b7fa6f3b84870791 (diff) | |
download | illumos-joyent-beee6fc0eea41662170c4dea38a7e5605ab59507.tar.gz |
6849 failure in PLT processing induces spurious fake_elf() failure
Reviewed by: Richard PALO <richard@netbsd.org>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libproc/common/Psymtab_machelf32.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr/src/lib/libproc/common/Psymtab_machelf32.c b/usr/src/lib/libproc/common/Psymtab_machelf32.c index 13ee1ac8de..1e85b39179 100644 --- a/usr/src/lib/libproc/common/Psymtab_machelf32.c +++ b/usr/src/lib/libproc/common/Psymtab_machelf32.c @@ -24,6 +24,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2015, Joyent, Inc. All rights reserved. + */ + #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -635,7 +639,7 @@ done_with_plt: if (Pread(P, &ndx, sizeof (ndx), (uintptr_t)hash) != sizeof (ndx)) { dprintf("Pread of .hash at %lx failed\n", (long)hash); - goto bad; + goto badplt; } while (ndx) { @@ -643,7 +647,7 @@ done_with_plt: (uintptr_t)&symtabptr[ndx]) != sizeof (sym)) { dprintf("Pread of .symtab at %lx failed\n", (long)&symtabptr[ndx]); - goto bad; + goto badplt; } strtabname = strtabptr + sym.st_name; @@ -651,7 +655,7 @@ done_with_plt: strtabname) < 0) { dprintf("Pread of .strtab at %lx failed\n", (long)strtabname); - goto bad; + goto badplt; } if (strcmp("_PROCEDURE_LINKAGE_TABLE_", strbuf) == 0) @@ -662,7 +666,7 @@ done_with_plt: sizeof (ndx)) { dprintf("Pread of .hash at %lx failed\n", (long)hash); - goto bad; + goto badplt; } } @@ -678,7 +682,7 @@ done_with_plt: if (ndx == 0) { dprintf( "Failed to find \"_PROCEDURE_LINKAGE_TABLE_\"\n"); - goto bad; + goto badplt; } sp->sh_name = SHSTR_NDX_plt; @@ -698,12 +702,13 @@ done_with_plt: sp->sh_size) { dprintf("failed to read .plt at %lx\n", (long)sp->sh_addr); - goto bad; + goto badplt; } off += roundup(sp->sh_size, SH_ADDRALIGN); sp++; } +badplt: /* make sure we didn't write past the end of allocated memory */ sp++; assert(((uintptr_t)(sp) - 1) < ((uintptr_t)elfdata + size)); |