[Bug libc/34313] New: Erroneous nonnull attributes for fchmodat, faccessat, and fchownat

sam at gentoo dot org via Glibc-bugs <[email protected]> Tue, 23 Jun 2026 06:25:57 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34313

            Bug ID: 34313
           Summary: Erroneous nonnull attributes for fchmodat, faccessat,
                    and fchownat
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

We need to drop the nonnull attribute for fchmodat, faccessat, and fchownat.

See this commit in gnulib:

commit 6db27b4dd36eda618db20e997ff56bbed7fce3cb
Author:     Paul Eggert <[email protected]>
AuthorDate: Tue Jun 16 09:45:39 2026 -0700
Commit:     Paul Eggert <[email protected]>
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.

We already fixed fstatat in:

commit 55618e13968a60b89e5b226a23afaa8f17c5ef48
Author:     Miao Wang <[email protected]>
AuthorDate: Mon Dec 23 10:30:43 2024 +0100
Commit:     Florian Weimer <[email protected]>
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 <[email protected]>
    Signed-off-by: Xi Ruoyao <[email protected]>
    Reviewed-by: Florian Weimer <[email protected]>

Ref:
https://inbox.sourceware.org/libc-alpha/[email protected]/

-- 
You are receiving this mail because:
You are on the CC list for the bug.