All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Masaharu Noguchi <nogunix@gmail.com>
Cc: jesperjuhl76@gmail.com, Jeff Layton <jlayton@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>,
	Alexander Aring <alex.aring@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] uapi: fcntl: guard AT_RENAME_* aliases
Date: Sun, 9 Nov 2025 16:13:42 +0000	[thread overview]
Message-ID: <20251109161342.497e7e7e@pumpkin> (raw)
In-Reply-To: <20251109071304.2415982-2-nogunix@gmail.com>

On Sun,  9 Nov 2025 16:13:03 +0900
Masaharu Noguchi <nogunix@gmail.com> wrote:

> Signed-off-by: Masaharu Noguchi <nogunix@gmail.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


  reply	other threads:[~2025-11-09 16:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-12 23:47 Building a allyesconfig kernel fails because macros are being redefined Jesper Juhl
2025-10-13  1:24 ` Nathan Chancellor
2025-11-09  7:13 ` [PATCH 0/2] fix AT_RENAME_* redefinitions with glibc < 2.43 Masaharu Noguchi
2025-11-09  7:13   ` [PATCH 1/2] uapi: fcntl: guard AT_RENAME_* aliases Masaharu Noguchi
2025-11-09 16:13     ` David Laight [this message]
2025-11-09  7:13   ` [PATCH 2/2] samples: vfs: avoid libc AT_RENAME_* redefinitions Masaharu Noguchi
2025-11-09 16:04     ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251109161342.497e7e7e@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=alex.aring@gmail.com \
    --cc=chuck.lever@oracle.com \
    --cc=jesperjuhl76@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nogunix@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.