[PATCH v6] linux: Add openat2 (BZ 31664)
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue Nov 18 19:49:35 GMT 2025
On 18/11/25 16:12, Paul Eggert wrote:
> On 2025-11-10 08:19, Adhemerval Zanella wrote:
>> +extern int openat2 (int __dfd, const char *__restrict __filename,
>> + const struct open_how *__restrict __how,
>> + size_t __usize)
>> + __nonnull ((2, 3));
>
> Shouldn't this be fortified at compile time, by using __builtin_object_size to check that __usize <= sizeof *__how, when fortify checking is enabled?
I am not sure how useful this would be, the kernel will return an error
if user pass an invalid value and in theory if the open_how is extended
user still make a valid call with '__ussize <= sizeof *__how' as long
the size refers to a valid size.
The fortify wrapper would need to handle all the open_how possible
versions, or just support the latest one.
More information about the Libc-alpha
mailing list