[PATCH] debug: Fix fortified realpath C++ ODR violation (BZ 30516)
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Jul 3 16:50:47 GMT 2023
On 03/07/23 13:03, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> @@ -41,10 +35,6 @@ __NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
>> if (sz == (size_t) -1)
>> return __realpath_alias (__name, __resolved);
>>
>> -#if defined _LIBC_LIMITS_H_ && defined PATH_MAX
>> - if (__glibc_unsafe_len (PATH_MAX, sizeof (char), sz))
>> - return __realpath_chk_warn (__name, __resolved, sz);
>> -#endif
>> return __realpath_chk (__name, __resolved, sz);
>> }
>
> The issue is tje _LIBC_LIMITS_H_ conditional, right?
>
> I suggest we just define PATH_MAX to the correct value in a Linux header
> (in a namespace-clean fashion), and add a check of that constant against
> the Linux UAPI value. This constant is ABI anyway, and it's good to
> know if the kernel decides to change it underneath us.
>
> Regressing C diagnostics for experimental C++ module support does not
> seem the right trade-off, sorry.
Ok, this makes sense. I will send an updated version.
More information about the Libc-alpha
mailing list