|
|
Message-ID: <83f76256-3320-4395-a462-dcea8b3cdae8@foss.arm.com>
Date: Thu, 13 Nov 2025 19:59:17 -0600
From: Bill Roberts <bill.roberts@...s.arm.com>
To: musl@...ts.openwall.com, Thorsten Glaser <tg@...bsd.de>
Cc: Bill Roberts <bill.roberts@....com>
Subject: Re: [PATCH 1/3] dso/aarch64: add PROT_BTI support for mem maps
On 11/13/25 5:09 PM, Thorsten Glaser wrote:
> On Thu, 13 Nov 2025, Bill Roberts wrote:
>
>> --- a/ldso/dynlink.c
>> +++ b/ldso/dynlink.c
>> @@ -693,7 +708,7 @@ static void *map_library(int fd, struct dso *dso)
>> off_t off_start;
>> Ehdr *eh;
>> Phdr *ph, *ph0;
>> - unsigned prot;
>> + unsigned prot, arch_prot, arch_mask;
>
> You might want to zero-initialise these, as you changed
> the = to |= below. (Unless there’s already an explicit
> =0 in the part that’s not shown, I didn’t check.)
They all should have explicit initializers before the |= like the
below snippet:
```C
prot = (((ph->p_flags&PF_R) ? PROT_READ : 0) |
((ph->p_flags&PF_W) ? PROT_WRITE: 0) |
((ph->p_flags&PF_X) ? PROT_EXEC : 0));
prot |= prot&arch_mask ? arch_prot : 0;
```
I poured over these uses to ensure there is an explicit initialization,
if I missed one, please call that out.
For initialization, since prot is used in the loop, would be to
initialize it to 0 in the start of the loop body. I left that out
of my patch since it's unrelated for now.
>
>> unsigned char *map=MAP_FAILED, *base;
>> size_t dyn=0;
>> size_t tls_image=0;
>
> bye,
> //mirabilos
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.