Skip to main content

TECH VEDA

Corporate on-site training - Submit proposal Pick your modulesSharpen your kernel skills: deep dives, drivers, Yocto, CVEs, careers — updated daily. Read the blog →
Kernel Features

Linux 7.4 Renames CONFIG_DEBUG_WX to CONFIG_CHECK_WX

Linux 7.4 renames CONFIG_DEBUG_WX to CONFIG_CHECK_WX and enables it by default. See what an old config file does to the check for writable executable mappings.

Linux 7.4 Renames CONFIG_DEBUG_WX to CONFIG_CHECK_WX

Linux 7.4-rc1 renames CONFIG_DEBUG_WX, the option that checks the kernel page tables for writable executable mappings at boot, to CONFIG_CHECK_WX. The new option is enabled by default when CONFIG_STRICT_KERNEL_RWX is enabled. Kconfig ignores a line that uses the old name and prints no message by default. Linux 7.4 has not been released yet, so this affects teams that plan to update arm64, RISC-V or 32-bit Arm boards to it.

Many embedded teams keep one kernel configuration file for each board and reuse it for every kernel update. Some of these files enable the boot check for writable executable mappings, and some do not. In Linux 7.4-rc1 the name of that option changes, and the default value changes too. On arm64, a file that did not enable the check now produces a kernel with the check enabled. On 32-bit Arm, a file that enabled the check now produces a kernel with the check disabled. Teams that stay on Linux 7.3 or on a longterm kernel are not affected.

What teams do today

A writable executable mapping is a page table entry that allows both writing and execution. The kernel calls it a W+X mapping. Such a mapping makes other kernel bugs easier to exploit. For this reason, CONFIG_STRICT_KERNEL_RWX makes kernel text and read-only data read-only, and makes other kernel memory non-executable.

A second option checks that no writable executable mappings remain. Up to and including Linux 7.3, that option is named CONFIG_DEBUG_WX. It is defined in mm/Kconfig.debug and has no default line, so it is disabled unless a configuration file enables it. The arm64 and RISC-V defconfig files in Linux 7.3 do not enable it. A team that wants the check adds one line to the board configuration file:

CONFIG_DEBUG_WX=y

On 32-bit Arm, a separate option, CONFIG_ARM_DEBUG_WX, is defined in arch/arm/Kconfig.debug.

What was added in Linux 7.4

One commit, with the subject “arch, mm: promote DEBUG_WX to CHECK_WX”, makes three changes. It renames DEBUG_WX to CHECK_WX and ARCH_HAS_DEBUG_WX to ARCH_HAS_CHECK_WX. It moves the definition from mm/Kconfig.debug to mm/Kconfig. It adds a default value. This is the start of the new entry in mm/Kconfig:

config CHECK_WX
	bool "Warn on W+X mappings at boot"
	default STRICT_KERNEL_RWX
	depends on ARCH_HAS_CHECK_WX
	depends on ARCH_HAS_PTDUMP
	depends on MMU
	select PTDUMP

The commit message gives the reason. It says that this check detects security risks and is not only a debug feature. The option still has a prompt, so a team that builds a small kernel can disable it.

For 32-bit Arm the commit only renames the option. The commit message says that the option is not widely enabled on 32-bit Arm. CONFIG_ARM_CHECK_WX has no default line, so it stays disabled unless a configuration file enables it.

How the check for writable executable mappings works

The check for writable executable mappings runs once, late in the boot process. The function mark_readonly() in init/main.c runs after the kernel frees its init memory. It calls mark_rodata_ro(), which applies the final page permissions, and then calls pgtable_checkwx(). For this reason the check code stays in memory after boot. The commit message says that the option adds a few kilobytes to the kernel binary. We did not measure the size, and we did not measure the time that the check adds to boot.

pgtable_checkwx() calls the architecture function ptdump_check_wx(). On arm64 and RISC-V this function walks the kernel page tables with the generic walker in mm/ptdump.c and checks each mapped range. On RISC-V a range fails when both _PAGE_WRITE and _PAGE_EXEC are set. On arm64 a range fails when it is writable and PTE_PXN is not set. The arm64 code also fails the check for a kernel mapping that does not have PTE_UXN set, with a separate warning.

The first range that fails produces a WARN_ONCE() with the text “Found insecure W+X mapping at address” and a stack trace. At the end, the function prints one summary line. The line contains “Checked W+X mappings: passed, no W+X pages found” when the count is zero. It contains the number of pages when the count is not zero.

What the same configuration file produces on Linux 7.4

We ran olddefconfig on the Linux 7.4-rc3 source with old lines added to the defconfig output. These are the results:

  • arm64, old file has CONFIG_DEBUG_WX=y: the result has CONFIG_CHECK_WX=y. The check stays enabled. The reason is the new default, not the old line.
  • arm64, old file has # CONFIG_DEBUG_WX is not set, or has no line for this option: the result has CONFIG_CHECK_WX=y. The check is now enabled. CONFIG_PTDUMP is enabled with it.
  • 32-bit Arm, old file has CONFIG_ARM_DEBUG_WX=y: the result has # CONFIG_ARM_CHECK_WX is not set. The check is now disabled.

The RISC-V defconfig file also produces CONFIG_CHECK_WX=y. On RISC-V this requires CONFIG_MMU and CONFIG_STRICT_KERNEL_RWX, and a configuration file can disable the second one. A similar change of defaults is under review for the memory split on 32-bit Arm. We described it in our article on the proposed memory split defaults.

Try it

First, find the old lines in the configuration file. Kconfig can report them. Copy the board configuration file to .config in a Linux 7.4 source tree. Then run this command from the top directory of that tree:

raghu@techveda.org:~$ make ARCH=arm KCONFIG_WARN_UNKNOWN_SYMBOLS=1 olddefconfig
.config:11118:warning: unknown symbol: ARM_DEBUG_WX
#
# configuration written to .config
#
raghu@techveda.org:~$ grep CHECK_WX .config
# CONFIG_ARM_CHECK_WX is not set

This output is from our run on Linux 7.4-rc3 with multi_v7_defconfig and one old line added. The line number depends on the file. To keep the check enabled on 32-bit Arm, replace the old line with CONFIG_ARM_CHECK_WX=y. To disable the check on arm64 or RISC-V, add # CONFIG_CHECK_WX is not set. A configuration fragment that is used for both Linux 7.3 and Linux 7.4 can contain the old line and the new line. Each kernel ignores the name that it does not know.

Next, confirm the result on the board. The first command requires CONFIG_IKCONFIG_PROC to be enabled.

root@beagleplay:~# zcat /proc/config.gz | grep CHECK_WX
root@beagleplay:~# dmesg | grep "Checked W+X"

The second command prints the summary line from the boot check. The check can also be run again at any time. The file check_wx_pages in debugfs runs ptdump_check_wx() each time it is read and returns SUCCESS or FAILED. The file is available only to root, and only when CONFIG_DEBUG_FS and CONFIG_PTDUMP are enabled and debugfs is mounted. CONFIG_CHECK_WX selects CONFIG_PTDUMP, so an arm64 kernel with debugfs now has this file by default.

root@beagleplay:~# cat /sys/kernel/debug/check_wx_pages
SUCCESS

Each read prints the summary line to the kernel log. The warning with the address and the stack trace is printed only the first time after boot. The boot check runs only once. This file can find writable executable mappings that appear later, for example after an out-of-tree module is loaded. A comment in init/main.c says that loading a module creates writable executable mappings for a short time. The boot path waits until they are removed, and the debugfs path does not. Wait a short time after insmod before you read the file. If the check fails, CONFIG_PTDUMP_DEBUGFS adds the file kernel_page_tables, which lists each mapped range with its permissions.

Which kernels have it

The commit that introduces this change is 2e83e2ce34ff. It first appears in the tag v7.4-rc1. On 18 November 2026, kernel.org lists 7.4-rc3 as the mainline version, so Linux 7.4 has not been released yet.

No stable or longterm kernel has the new names. We checked mm/Kconfig at v7.3.5, v6.18.64, v6.12.118, v6.6.162, v6.1.192, v5.15.225 and v5.10.274. None of them contains CHECK_WX. A team that uses a vendor BSP based on one of these series must continue to use CONFIG_DEBUG_WX or CONFIG_ARM_DEBUG_WX. The new names are needed only when the BSP is updated to Linux 7.4 or later. The debugfs file is older than this change. It is present in v6.12.118, v6.18.64 and v7.3.5, and absent from v6.6.162 and v6.1.192.

Limits

  • The check only reports a mapping. It does not remove the mapping, and the kernel continues to boot.
  • The report is a WARN_ONCE(). The kernel calls panic() for a warning when panic_on_warn=1 is set. On such a system, a writable executable mapping stops the boot. A read of check_wx_pages can stop a running system in the same way. Test this before you use the check and panic_on_warn together in production.
  • A test system that rejects any kernel warning will now reject an arm64 board that has such a mapping.
  • The boot check runs only when CONFIG_STRICT_KERNEL_RWX is enabled and the rodata=off parameter is not given. This includes 32-bit Arm. There, CONFIG_STRICT_KERNEL_RWX is enabled by default only for ARMv7 processors and is not available with CONFIG_XIP_KERNEL.
  • The check walks only the page tables of the kernel. It does not check the page tables of processes.
  • 32-bit Arm uses its own page table dump code. It does not select ARCH_HAS_PTDUMP, so the check_wx_pages file is not built on 32-bit Arm.
  • The Kconfig entry does not depend on PREEMPT_RT and does not conflict with it.

What was checked and what could not be verified

We read the commit that introduces this change. We read mm/Kconfig, mm/ptdump.c and init/main.c at Linux 7.4-rc3. We also read the page table dump code for arm64, RISC-V and 32-bit Arm, and we ran Kconfig on the Linux 7.4-rc3 source for these three architectures. We checked the stable and longterm versions listed above.

We did not boot a Linux 7.4-rc kernel on a board. The dmesg and debugfs steps are taken from the source and were not captured on hardware. We did not measure the size of the check or the time that it adds to boot. We could not read the mailing-list discussion for this article, so the reasons given here are from the commit message only.

Key takeaways

  • From Linux 7.4-rc1, the boot check for writable executable mappings is CONFIG_CHECK_WX. It is enabled by default when CONFIG_STRICT_KERNEL_RWX is enabled.
  • An arm64 configuration file that did not enable the check for writable executable mappings now produces a kernel with the check enabled.
  • A 32-bit Arm configuration file that enabled the check with the old name now produces a kernel with the check disabled. Kconfig prints no message by default.
  • KCONFIG_WARN_UNKNOWN_SYMBOLS=1 makes Kconfig report the old lines.
Was this worth your time?

Frequently asked questions

Does my arm64 kernel check for writable executable mappings after I update to Linux 7.4?

Yes, unless you disable the check. CONFIG_CHECK_WX is enabled by default when CONFIG_STRICT_KERNEL_RWX is enabled.

What happens to CONFIG_ARM_DEBUG_WX=y in a 32-bit Arm configuration file?

Kconfig ignores the line because the option no longer exists. CONFIG_ARM_CHECK_WX has no default, so the check is disabled until you add CONFIG_ARM_CHECK_WX=y.

Can I use the new option names on a longterm kernel?

No. None of the stable and longterm versions that we checked, from v5.10.274 to v7.3.5, contains CHECK_WX. Use CONFIG_DEBUG_WX or CONFIG_ARM_DEBUG_WX there.

References

RB
Raghu Bharadwaj

Founder, TECH VEDA — 20+ years teaching the Linux kernel, device drivers and embedded systems.

Follow on LinkedIn

Get the best of TECH VEDA by email

The best of our kernel and embedded Linux writing, a few emails a month. No spam.

We email occasionally and never share your address.