[PATCH 2/2] nptl: Enable MTE for stacks created for threads.

Cupertino Miranda cupertino.miranda@oracle.com
Thu May 15 09:14:11 GMT 2025


Hi Florian,

I am just replying to this thread to call for attention to the patch 
that address this request.
https://patchwork.sourceware.org/project/glibc/patch/20250514151839.111285-1-cupertino.miranda@oracle.com/

Thanks,
Cupertino

On 26-03-2025 18:44, Florian Weimer wrote:
> * Cupertino Miranda:
> 
>> Hi Florian,
>>
>> Thanks for the review!
>>
>> On 14-03-2025 16:35, Florian Weimer wrote:
>>> * Cupertino Miranda:
>>>
>>>> diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
>>>> index 800ca89720..6155157063 100644
>>>> --- a/nptl/allocatestack.c
>>>> +++ b/nptl/allocatestack.c
>>>> @@ -153,7 +153,8 @@ static int allocate_stack_mode = ALLOCATE_GUARD_MADV_GUARD;
>>>>    static inline int stack_prot (void)
>>>>    {
>>>>      return (PROT_READ | PROT_WRITE
>>>> -	  | ((GL(dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
>>>> +	  | ((GL(dl_stack_flags) & PF_X) ? PROT_EXEC : 0)
>>>> +	  | stack_mem_tagging_prot ());
>>>>    }
>>> I think we should clean this up and arrange for the dynamic linker to
>>> determine the PROT_* flags for stacks created at run time, so that we
>>> can use that variable directly without further processing.
> 
>> IMHO, we cannot escape from abstracting somehow the final flags as
>> above with PF_X.  The problem being that each OS would have each own
>> flags and syscalls and dynamic linker is OS agnostic, AFAIK.
> 
> The dynamic linker has both Linux- and architecture-specific code.
> I would like to see
> 
>    GLRO (dl_stack_prot_flags)
> 
> instead of:
> 
>    stack_prot ()
> 
> Then we can remove the GL(dl_stack_flags) variable.
> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list