3 ms·
That's fair, sorry for my casual language in a technically nuanced discussion. I hadn't looked at this in quite a while, but it was good to review. Thanks for
by opello 1y ago
That's fair, sorry for my casual language in a technically nuanced discussion. I hadn't looked at this in quite a while, but it was good to review. Thanks for the prompting.
https://github.com/bminor/glibc/blob/glibc-2.41/sysdeps/unix/sysv/linux/gettimeofday.c https://github.com/bminor/glibc/blob/glibc-2.41/sysdeps/unix...
https://github.com/bminor/glibc/blob/glibc-2.41/sysdeps/unix/sysv/linux/dl-vdso.h https://github.com/bminor/glibc/blob/glibc-2.41/sysdeps/unix...
- wahern 1y agoI also double-checked the glibc and musl code to make sure I wasn't misremembering, and ended up learning about IFUNC.[1] Previously I had avoided going down the rabbit hole to understand what glibc's libc_ifunc was doing. I don't think musl uses IFUNC, at least not for clock_gettime; it seems to always link the wrapper which calls the vdso through an internally managed pointer.[2] And now I'm wondering how safe all this indirection is. For the PLT/GOT approach I think you can disable lazy binding and force the GOT table to be read-only so exploits can't overwrite the symbol addresses. But for musl's approach it doesn't seem like you can make it's internal function pointer read-only, though maybe it's more difficult to find the address of than GOT table slots. [1] https://sourceware.org/glibc/wiki/GNU_IFUNC https://sourceware.org/glibc/wiki/GNU_IFUNC [2] https://git.musl-libc.org/cgit/musl/tree/src/time/clock_gettime.c https://git.musl-libc.org/cgit/musl/tree/src/time/clock_gett...