This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add Prefer_MAP_32BIT_EXEC for Silvermont

On Mon, Dec 14, 2015 at 9:16 AM, Zack Weinberg <> wrote:
> On Mon, Dec 14, 2015 at 11:43 AM, H.J. Lu <> wrote:
>> How about
>> @@ -161,6 +195,14 @@ init_cpu_features (struct cpu_features *cpu_features)
>>      cpu_features->feature[index_I686] |= bit_I686;
>> +  /* For 64-bit applications, branch prediction performance may be
>> +     negatively impacted when the target of a branch is more than 4GB
>> +     away from the branch.  Set the Prefer_MAP_32BIT_EXEC bit so that
>> +     mmap will try to map executable pages with MAP_32BIT first.
>> +     NB: MAP_32BIT will map to lower 2GB, not lower 4GB, address.  */
>> +  cpu_features->feature[index_Prefer_MAP_32BIT_EXEC]
>> +    |= get_prefer_map_32bit_exec ();
> Uh, what I'm saying is I don't think this belongs in cpu_features[] *at all*.

If other 64-bit architectures want to support LD_ENABLE_PREFER_MAP_32BIT_EXEC,
I will make it generic.  Otherwise, I will leave it in x86 cpu_features.

>>> variable.  Also, why are you open-coding a loop over the contents of
>>> __environ?  Isn't this what __secure_getenv is for?
>> It is bcause get_prefer_map_32bit_exec is called very early in when
>> __secure_getenv/getenv aren't available yet.
> Then we should fix that instead of duplicating security-sensitive logic. has its own functions to process environment variables. Since
only sysdeps/x86/cpu-features.c needs it,  I left  __secure_getenv out of


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]