Skip to content

Commit

Permalink
Remove "Unable to get section data." message
Browse files Browse the repository at this point in the history
This message may happen if library does not contain either .dynsym or
.symtab sections, which may happen and is fine. So do not issue an
error because of that.

Signed-off-by: Giuliano Belinassi <[email protected]>
  • Loading branch information
giulianobelinassi committed May 3, 2024
1 parent 5c0da8f commit 5ea49df
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion tests/asunsafe_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
errors = 0
try:
# Apply the live patch.
child.livepatch('.libs/libblocked_livepatch1.so', retries=100)
child.livepatch('.libs/libblocked_livepatch1.so', retries=2000)
except subprocess.TimeoutExpired:
print('Deadlock while live patching - AS-Unsafe conversion not tested')
# The deadlock test (tests/deadlock) has a far greater chance of
Expand Down
1 change: 0 additions & 1 deletion tools/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ get_list_of_symbols_in_section(Elf *elf, Elf_Scn *s)
nsyms = sh.sh_size / sh.sh_entsize;
data = elf_getdata(s, NULL);
if (!data) {
WARN("Unable to get section data.");
return NULL;
}

Expand Down
27 changes: 0 additions & 27 deletions tools/packer.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,33 +948,6 @@ parse_build_id(Elf_Scn *s, char **result, int *length)
return 0;
}

void *
get_symbol_addr(Elf *elf, Elf_Scn *s, const char *search)
{
int nsyms, i;
char *sym_name;
Elf_Data *data;
GElf_Shdr sh;
GElf_Sym sym;

gelf_getshdr(s, &sh);

nsyms = sh.sh_size / sh.sh_entsize;
data = elf_getdata(s, NULL);
if (!data) {
WARN("Unable to get section data.");
return 0;
}

for (i = 0; i < nsyms; i++) {
gelf_getsym(data, i, &sym);
sym_name = elf_strptr(elf, sh.sh_link, sym.st_name);
if (strcmp(sym_name, search) == 0)
return (void *)sym.st_value;
}
return 0;
}

int
write_patch_id(struct ulp_metadata *ulp, const char *description,
const char *livepatch)
Expand Down

0 comments on commit 5ea49df

Please sign in to comment.