Go to file
Linus Torvalds 13f4fa2c72 samples: work around glibc redefining some of our defines wrong
[ Upstream commit a48f822908 ]

Apparently as of version 2.42, glibc headers define AT_RENAME_NOREPLACE
and some of the other flags for renameat2() and friends in <stdio.h>.

Which would all be fine, except for inexplicable reasons glibc decided
to define them _differently_ from the kernel definitions, which then
makes some of our sample code that includes both kernel headers and user
space headers unhappy, because the compiler will (correctly) complain
about redefining things.

Now, mixing kernel headers and user space headers is always a somewhat
iffy proposition due to namespacing issues, but it's kind of inevitable
in our sample and selftest code.  And this is just glibc being stupid.

Those defines come from the kernel, glibc is exposing the kernel
interfaces, and glibc shouldn't make up some random new expressions for
these values.

It's not like glibc headers changed the actual result values, but they
arbitrarily just decided to use a different expression to describe those
values.  The kernel just does

    #define AT_RENAME_NOREPLACE  0x0001

while glibc does

    # define RENAME_NOREPLACE (1 << 0)
    # define AT_RENAME_NOREPLACE RENAME_NOREPLACE

instead.  Same value in the end, but very different macro definition.

For absolutely no reason.

This has since been fixed in the glibc development tree, so eventually
we'll end up with the canonical expressions and no clashes.  But in the
meantime the broken headers are in the glibc-2.42 release and have made
it out into distributions.

Do a minimal work-around to make the samples build cleanly by just
undefining the affected macros in between the user space header include
and the kernel header includes.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-01-11 15:18:16 +01:00
arch LoongArch: Mask all interrupts during kexec/kdump 2026-01-11 15:18:16 +01:00
block block: fix race between set_blocksize and read paths 2025-12-07 06:12:14 +09:00
certs sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3 2025-04-25 10:44:04 +02:00
crypto crypto: essiv - Check ssize for decryption and in-place encryption 2025-10-19 16:23:10 +02:00
Documentation Documentation: process: Also mention Sasha Levin as stable tree maintainer 2026-01-11 15:18:13 +01:00
drivers HID: elecom: Add support for ELECOM M-XT3URBK (018F) 2026-01-11 15:18:16 +01:00
fs bfs: Reconstruct file type when loading from disk 2026-01-11 15:18:15 +01:00
include Revert "xfrm: destroy xfrm_state synchronously on net exit path" 2026-01-11 15:18:12 +01:00
init init: handle bootloader identifier in kernel parameters 2025-10-19 16:23:13 +02:00
io_uring io_uring: correct __must_hold annotation in io_install_fixed_file 2025-10-29 14:04:38 +01:00
ipc ipc: fix to protect IPCS lookups using RCU 2025-06-27 11:07:30 +01:00
kernel ftrace: bpf: Fix IPMODIFY + DIRECT in modify_ftrace_direct() 2026-01-11 15:18:14 +01:00
lib maple_tree: fix tracepoint string pointers 2025-12-07 06:12:40 +09:00
LICENSES
mm filemap: cap PTE range to be created to allowed zero fill in folio_map_range() 2025-12-07 06:12:41 +09:00
net xfrm: flush all states in xfrm_state_fini 2026-01-11 15:18:12 +01:00
rust mm/ksm: fix flag-dropping behavior in ksm_madvise 2025-10-29 14:04:43 +01:00
samples samples: work around glibc redefining some of our defines wrong 2026-01-11 15:18:16 +01:00
scripts kconfig/nconf: Initialize the default locale at startup 2025-12-07 06:12:39 +09:00
security KEYS: trusted_tpm1: Compare HMAC values in constant time 2025-10-19 16:23:14 +02:00
sound ALSA: usb-audio: Add native DSD quirks for PureAudio DAC series 2026-01-11 15:18:15 +01:00
tools selftests: mptcp: join: endpoints: longer transfer 2025-12-07 06:12:45 +09:00
usr kbuild: uapi: Strip comments before size type check 2025-12-07 06:12:28 +09:00
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS staging: rtl8712: Remove driver using deprecated API wext 2025-12-07 06:12:45 +09:00
Makefile Linux 6.1.159 2025-12-07 06:12:46 +09:00
README

Linux kernel

There are several guides for kernel developers and users. These guides can be rendered in a number of formats, like HTML and PDF. Please read Documentation/admin-guide/README.rst first.

In order to build the documentation, use make htmldocs or make pdfdocs. The formatted documentation can also be read online at:

https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory, several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the requirements for building and running the kernel, and information about the problems which may result by upgrading your kernel.