[PATCH] io: statx, fstatat64: allow using NULL as path
Sam James
sam@gentoo.org
Tue Jun 16 19:20:50 GMT 2026
Sam James <sam@gentoo.org> writes:
> On Wed, 25 Sep 2024 22:23:14 +0800, Xi Ruoyao wrote:
>>> [...]
>> I'd suggest to separate this into two patches. The first one drops the
>> __nonnull(...) on the path, the second one implements the fallback. The
>> first patch would be so obvious to be applied then.
>
> Paul has fixed this today in gnulib:
>
> commit 6db27b4dd36eda618db20e997ff56bbed7fce3cb
> Author: Paul Eggert <eggert@cs.ucla.edu>
> AuthorDate: Tue Jun 16 09:45:39 2026 -0700
> Commit: Paul Eggert <eggert@cs.ucla.edu>
> CommitDate: Tue Jun 16 09:53:22 2026 -0700
>
> fstatat etc.: fix wrong machine code for calls
>
> Without this fix, compilers can generate incorrect machine code
> for functions that call to fstatat-like functions, as the
> compilers incorrectly assume that the calls’ arguments cannot be
> null pointers. This assumption became false with the release of
> Linux kernel 6.11 (2024).
> * lib/sys_stat.in.h (fchmodat, fstatat, utimensat):
> * lib/unistd.in.h (faccessat, fchownat): Do not mark file args
> with _GL_ARG_NONNULL, as the args are allowed to be null pointers
> in Linux kernel 6.11+, possibly with glibc 2.41+ involved.
>
> Miao Wang, do you intend to pursue this patch, or Paul, do you intend to
> submit a similar change (the attribute fix is what I care about, anyway)
> on the glibc side? If not, I can look at syncing it.
Ah, I see we had:
commit 55618e13968a60b89e5b226a23afaa8f17c5ef48
Author: Miao Wang <shankerwangmiao@gmail.com>
AuthorDate: Mon Dec 23 10:30:43 2024 +0100
Commit: Florian Weimer <fweimer@redhat.com>
CommitDate: Mon Dec 23 10:30:43 2024 +0100
io: statx, fstatat: Drop nonnull attribute on the path argument
Since Linux 6.11 the kernel allows path to be NULL if flags &
AT_EMPTY_PATH. Let's allow users to take the advantage if they don't
care running on old kernels.
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
But say, fchmodat is still wrong in io/sys/stat.h.
>
> sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 418 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260616/e0a2a252/attachment.sig>
More information about the Libc-alpha
mailing list