V5 [PATCH 2/2] x86: Add a LD_PRELOAD IFUNC resolver test for CPU_FEATURE_USABLE

H.J. Lu hjl.tools@gmail.com
Wed Oct 24 23:50:00 GMT 2018


On 10/24/18, Florian Weimer <fweimer@redhat.com> wrote:
> * H. J. Lu:
>
>> On 10/24/18, Florian Weimer <fweimer@redhat.com> wrote:
>>> * H. J. Lu:
>>>
>>>> I guess you knew that this issue was independent of my new functions.
>>>> You will get the same error regardless of what the get_free body has.
>>>
>>> Yes, the check is certainly overly conservative.  I thought we want to
>>> remove it.  Don't we trigger it in glibc in a few places?  If the check
>>> is gone, then I think we will see incorrect results from the new
>>> interface.
>>>
>>> I think we are very consistent right now when it comes to relocations in
>>> IFUNC handlers.  I want to see this settled before adding something that
>>> requires a relocation which is (among other things) targeted at IFUNC
>>> resolvers.
>>>
>>
>> <sys/platform/x86.h> isn't targeted for IFUNC.   My first use is to add
>> x86_tsc_to_ns and x86_ns_to_tsc.   I am enclosing 2 patches here.
>
> That's a generic interface which should rely on internal CPU flags.
> What's worse, the cached flag isn't updated by the kernel TSC watchdog,
> so applications will use a known-broken time source.
>
> What's wrong with clock_gettime?  It handles all these details.
>

These are for cases where RDTSC/RDTSCP are preferred over
clock_gettime.


-- 
H.J.



More information about the Libc-alpha mailing list