Zachary Amsden wrote:
Invoke black magic to relocate the VDSO even when COMPAT_VDSO is enabled
by fixing up the ELF object.
So does it actually work? Can you boot the broken distros with this in
place?
Using sections is wrong; you should be going through the phdrs, and
looking for PT_DYNAMIC for relocation.
Does anyone expect the symbolic info to be correct? It might be better
to just stomp it so nobody gets any ideas.
On the other hand, we don't want to break compatibility with anything...
+ } else if (strcmp(secstrings+sechdrs[i].sh_name, ".dynamic") == 0) {
+ Elf32_Dyn *dyn = (void *)hdr + sechdrs[i].sh_offset;
+ int tag;
+ while ((tag = (++dyn)->d_tag) != DT_NULL)
Um, no.
+ } else if (strcmp(secstrings+sechdrs[i].sh_name, ".useless") == 0) {
+ /* This is demonic; see vsyscall.lds.S; it puts the
+ * .got in a section named .useless */
+ uint32_t *got = (void *)hdr + sechdrs[i].sh_offset;
+ *got += VDSO_HIGH_BASE;
+ }
This won't get relocated with one of the other relocations? It's in the
text phdr.