[PATCH] stdlib: Support malloc-managed environ arrays for compatibility
Florian Weimer
fweimer@redhat.com
Wed Jan 22 21:47:09 GMT 2025
* Andreas K. Huettel:
> [...]
>> The interim approach was more compatible with other libcs because
>> it does not assume that the incoming environ pointer is allocated
>> as if by malloc (if it was written by the application). However,
>> it seems to be more important to stay compatible with previous
>> glibc version: assume the incoming pointer is heap allocated,
>> and preserve this property after setenv calls.
>>
>> Tested on x86_64-linux-gnu.
>>
>> I'd prefer to get this into the upcoming
>> release if possible, assuming that I can get a review in a timely
>> fashion.
>
> Makes sense. [Where did you find this, and how big is the impact?]
It's in usermode, a polkit (pkexec)/sudo variant. It basically does
free (environ[i]) (which has always been invalid) followed by free
(environ). Only the latter crashes, and the posted patch papers over
that.
userhelper dumped core when running subscription-manager
<https://issues.redhat.com/browse/RHEL-73769>
> I guess you know who to poke for the review.
Adhemerval, could you review this? Carlos probably won't be able to
have a look this week.
Thanks,
Florian
More information about the Libc-alpha
mailing list