[PATCH][aarch64] Fix glibc.tune.cpu tunable handling

Siddhesh Poyarekar siddhesh@gotplt.org
Mon Sep 4 05:37:00 GMT 2017


On Saturday 02 September 2017 01:10 AM, Steve Ellcey wrote:
> While working on a gcc patch I realized that the glibc tunable
> 'glibc.tune.cpu' was not working on aarch64.  I tracked it down to
> get_midr_from_mcpu and at first I thought I should remove the '== 0'
> from the if statement because tunable_is_name returns true/false, not
> -1/0/1 like strcmp.  But then I realized we shouldn't be using
> tunable_is_name at all because we are comparing two null terminated
> strings and tunable_is_name is trying to compare a null terminated
> string with a '=' terminated string which is not what we have.
> 
> I tested this by running a program that calls memcpy and checking what
> memcpy gets run after setting glibc.tune.cpu to generic, thunderx,
> and falkor.

Right, tunable_is_name is the wrong function to call but using strcmp
there may not be safe.  Please verify that it does not go through a PLT,
i.e. it calls the ld.so version at all times.

Siddhesh



More information about the Libc-alpha mailing list