[PATCH] RFC: Provide a function to reset IFUNC PLTs
Jan Kratochvil
jkratochvil@azul.com
Wed Mar 8 11:03:02 GMT 2023
On Wed, 08 Mar 2023 18:44:45 +0800, Florian Weimer wrote:
> This code resets the data queried by <sys/platform/x86.h>. But GCC and
> others do not use these interfaces, they use CPUID/XGETBV directly and
> cache the result, so this reset does not alter the outcome of their
> IFUNC resolvers.
We are on glibc mailing list so this patch and mail thread is about glibc.
I am aware other programs and libraries need their own reset. For OpenJDK JIT
compiler I wrote the CPU reset already; but that is offtopic here:
https://github.com/openjdk/crac/pull/41
> > The question is how to implement it. I have found
> > https://github.com/ddcc/libcpuidoverride
> > but it is not compatible with latest glibc (maybe its loader code needs to
> > implement ELF relocations, it would be definitely fixable).
>
> It needs kernel support for sure. I do not know to what extent CPUID
> can be context-switched at the silicon level, maybe the masking is
> system-wide (or per-guest in a virtualized configuration).
There is already its kernel support - ARCH_SET_CPUID. It is per process.
> > Another option is GLIBC_TUNABLES=glibc.cpu.hwcaps=... although then one has to
> > translate cpuid feature bits into the glibc names like SSE4_2 etc.
> > Also re-exec() after setenv("GLIBC_TUNABLES") is not too nice.
>
> Again, that's not going to work in practice because libraries and
> applications do not use <sys/platform/x86.h>.
This mailing list is for glibc so let's talk about glibc.
Thanks,
Jan
More information about the Libc-alpha
mailing list