summaryrefslogtreecommitdiffstats
path: root/lib/elf_py.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-11-10 15:30:07 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2021-11-10 15:30:56 +0100
commit3942ee1f7bc754dd0dd9ae79f89d0f2635be334f (patch)
tree9325f2076a5d28a08d871a4a1ea13eaf074ced77 /lib/elf_py.c
parentlib: avoid include loop with assert.h (diff)
downloadfrr-3942ee1f7bc754dd0dd9ae79f89d0f2635be334f.tar.xz
frr-3942ee1f7bc754dd0dd9ae79f89d0f2635be334f.zip
lib: fix elf_py TLS section handling
... need to ignore TLS sections, their address is effectively meaningless but can overlap other sections we actually need to access. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/elf_py.c')
-rw-r--r--lib/elf_py.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/elf_py.c b/lib/elf_py.c
index 1c306893a..f230add69 100644
--- a/lib/elf_py.c
+++ b/lib/elf_py.c
@@ -636,6 +636,9 @@ static Elf_Scn *elf_find_addr(struct elffile *ef, uint64_t addr, size_t *idx)
Elf_Scn *scn = elf_getscn(ef->elf, i);
GElf_Shdr _shdr, *shdr = gelf_getshdr(scn, &_shdr);
+ /* virtual address is kinda meaningless for TLS sections */
+ if (shdr->sh_flags & SHF_TLS)
+ continue;
if (addr < shdr->sh_addr ||
addr >= shdr->sh_addr + shdr->sh_size)
continue;