[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251109161342.497e7e7e@pumpkin>
Date: Sun, 9 Nov 2025 16:13:42 +0000
From: David Laight <david.laight.linux@...il.com>
To: Masaharu Noguchi <nogunix@...il.com>
Cc: jesperjuhl76@...il.com, Jeff Layton <jlayton@...nel.org>, Chuck Lever
<chuck.lever@...cle.com>, Alexander Aring <alex.aring@...il.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] uapi: fcntl: guard AT_RENAME_* aliases
On Sun, 9 Nov 2025 16:13:03 +0900
Masaharu Noguchi <nogunix@...il.com> wrote:
> Signed-off-by: Masaharu Noguchi <nogunix@...il.com>
> ---
> include/uapi/linux/fcntl.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
> index 3741ea1b73d8..e3026381fbe7 100644
> --- a/include/uapi/linux/fcntl.h
> +++ b/include/uapi/linux/fcntl.h
> @@ -157,9 +157,15 @@
> */
>
> /* Flags for renameat2(2) (must match legacy RENAME_* flags). */
> +#ifndef AT_RENAME_NOREPLACE
> #define AT_RENAME_NOREPLACE 0x0001
> +#endif
> +#ifndef AT_RENAME_EXCHANGE
> #define AT_RENAME_EXCHANGE 0x0002
> +#endif
> +#ifndef AT_RENAME_WHITEOUT
> #define AT_RENAME_WHITEOUT 0x0004
> +#endif
That looks like the start of an 'accident waiting to happen'.
Either #undef the constants so that code is guaranteed to get the 'uapi' values,
or do explicit checks, eg:
/* stdio.h may have defined AT_RENAME_NOREPLACE */
#if !defined(AT_RENAME_NOREPLACE) || AT_RENAME_NOREPLACE != 0x0001
#define AT_RENAME_NOREPLACE 0x0001
#endif
David
>
> /* Flag for faccessat(2). */
> #define AT_EACCESS 0x200 /* Test access permitted for
Powered by blists - more mailing lists