fcntl: drop nonnull attribute for openat, openat2's path argument [BZ #34313]

.. and openat64.

Linux 7.2 (31cf44efa6df72a524b40adefb80539f3a4e13ba) allows openat, openat2
to take a NULL path with the new O_EMPTYPATH flag, so the nonnull attribute
is no longer sound. Drop it.

Bug: https://sourceware.org/PR34313
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
This commit is contained in:
Sam James
2026-08-30 03:50:13 +01:00
parent 5bcfeca12b
commit f750ffab2f
5 changed files with 11 additions and 19 deletions
+2 -4
View File
@@ -20,11 +20,9 @@ extern int __fcntl (int __fd, int __cmd, ...);
libc_hidden_proto (__fcntl)
extern int __fcntl64 (int __fd, int __cmd, ...) attribute_hidden;
libc_hidden_proto (__fcntl64)
extern int __openat (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
extern int __openat (int __fd, const char *__file, int __oflag, ...);
libc_hidden_proto (__openat)
extern int __openat64 (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
extern int __openat64 (int __fd, const char *__file, int __oflag, ...);
libc_hidden_proto (__openat64)
extern int __open_2 (const char *__path, int __oflag);
+4 -8
View File
@@ -135,18 +135,14 @@ open64 (__fortify_clang_overload_arg (const char *, ,__path), int __oflag,
#ifdef __USE_ATFILE
# ifndef __USE_FILE_OFFSET64
extern int __openat_2 (int __fd, const char *__path, int __oflag)
__nonnull ((2));
extern int __openat_2 (int __fd, const char *__path, int __oflag);
extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
int __oflag, ...), openat)
__nonnull ((2));
int __oflag, ...), openat);
# else
extern int __REDIRECT (__openat_2, (int __fd, const char *__path,
int __oflag), __openat64_2)
__nonnull ((2));
int __oflag), __openat64_2);
extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
int __oflag, ...), openat64)
__nonnull ((2));
int __oflag, ...), openat64);
# endif
# ifdef __va_arg_pack_len
+3 -5
View File
@@ -230,19 +230,17 @@ extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
This function is a cancellation point and therefore not marked with
__THROW. */
# ifndef __USE_FILE_OFFSET64
extern int openat (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
extern int openat (int __fd, const char *__file, int __oflag, ...);
# else
# ifdef __REDIRECT
extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
...), openat64) __nonnull ((2));
...), openat64);
# else
# define openat openat64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int openat64 (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
extern int openat64 (int __fd, const char *__file, int __oflag, ...);
# endif
#endif
@@ -25,7 +25,7 @@
extern int __REDIRECT (__openat2_alias, (int __dfd, const char *__filename,
const struct open_how *__how,
size_t __usize), openat2)
__nonnull ((2, 3));
__nonnull ((3));
#if !__fortify_use_clang
__errordecl (__openat2_invalid_size,
+1 -1
View File
@@ -485,7 +485,7 @@ extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
extern int openat2 (int __dfd, const char * __filename,
const struct open_how * __how,
__SIZE_TYPE__ __usize)
__nonnull ((2, 3));
__nonnull ((3));
#endif /* use GNU */