Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/Kconfig: Define non-zero ILLEGAL_POINTER_VALUE

Define CONFIG_ILLEGAL_POINTER_VALUE to the eye-catching non-zero value
of 0xdead000000000000, consistent with other architectures. Assert at
compile-time that the poison pointers that include/linux/poison.h
defines based on this illegal pointer are beyond the largest useful
virtual addresses. Also, assert at compile-time that the range of poison
pointers per include/linux/poison.h (currently a range of less than
0x10000 addresses) does not overlap with the range used for address
handles for s390's non-MIO PCI instructions.

This enables s390 to track the DMA mappings by the network stack's
page_pool that was introduced with [0]. Other functional changes are not
intended.

Other archictectures have introduced this for various other reasons with
commit 5c178472af24 ("riscv: define ILLEGAL_POINTER_VALUE for 64bit")
commit f6853eb561fb ("powerpc/64: Define ILLEGAL_POINTER_VALUE for 64-bit")
commit bf0c4e047324 ("arm64: kconfig: Move LIST_POISON to a safe value")
commit a29815a333c6 ("core, x86: make LIST_POISON less deadly")

[0] https://lore.kernel.org/all/20250409-page-pool-track-dma-v9-0-6a9ef2e0cba8@redhat.com/

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Gerd Bayer and committed by
Heiko Carstens
0d453ba0 0875816a

+12
+4
Documentation/arch/s390/mm.rst
··· 109 109 | KASAN shadow | KASAN untracked 110 110 | | 111 111 +------------------+ ASCE limit 112 + | | 113 + | CONFIG_ILLEGAL_POINTER_VALUE causes memory access fault 114 + | | 115 + +------------------+
+4
arch/s390/Kconfig
··· 719 719 config ARCH_SPARSEMEM_DEFAULT 720 720 def_bool y 721 721 722 + config ILLEGAL_POINTER_VALUE 723 + hex 724 + default 0xdead000000000000 725 + 722 726 config MAX_PHYSMEM_BITS 723 727 int "Maximum size of supported physical memory in bits (42-53)" 724 728 range 42 53
+1
arch/s390/boot/startup.c
··· 336 336 BUILD_BUG_ON(!IS_ALIGNED(TEXT_OFFSET, THREAD_SIZE)); 337 337 BUILD_BUG_ON(!IS_ALIGNED(__NO_KASLR_START_KERNEL, THREAD_SIZE)); 338 338 BUILD_BUG_ON(__NO_KASLR_END_KERNEL > _REGION1_SIZE); 339 + BUILD_BUG_ON(CONFIG_ILLEGAL_POINTER_VALUE < _REGION1_SIZE); 339 340 vsize = get_vmem_size(ident_map_size, vmemmap_size, vmalloc_size, _REGION3_SIZE); 340 341 boot_debug("vmem size estimated: 0x%016lx\n", vsize); 341 342 if (IS_ENABLED(CONFIG_KASAN) || __NO_KASLR_END_KERNEL > _REGION2_SIZE ||
+1
arch/s390/include/asm/pci_io.h
··· 18 18 #define ZPCI_IOMAP_SHIFT 48 19 19 #define ZPCI_IOMAP_ADDR_SHIFT 62 20 20 #define ZPCI_IOMAP_ADDR_BASE (1UL << ZPCI_IOMAP_ADDR_SHIFT) 21 + #define ZPCI_IOMAP_ADDR_MAX ((1UL << (ZPCI_IOMAP_ADDR_SHIFT + 1)) - 1) 21 22 #define ZPCI_IOMAP_ADDR_OFF_MASK ((1UL << ZPCI_IOMAP_SHIFT) - 1) 22 23 #define ZPCI_IOMAP_MAX_ENTRIES \ 23 24 (1UL << (ZPCI_IOMAP_ADDR_SHIFT - ZPCI_IOMAP_SHIFT))
+2
arch/s390/pci/pci.c
··· 1065 1065 { 1066 1066 BUILD_BUG_ON(!is_power_of_2(__alignof__(struct zpci_fmb)) || 1067 1067 __alignof__(struct zpci_fmb) < sizeof(struct zpci_fmb)); 1068 + BUILD_BUG_ON((CONFIG_ILLEGAL_POINTER_VALUE + 0x10000 > ZPCI_IOMAP_ADDR_BASE) && 1069 + (CONFIG_ILLEGAL_POINTER_VALUE <= ZPCI_IOMAP_ADDR_MAX)); 1068 1070 1069 1071 zdev_fmb_cache = kmem_cache_create("PCI_FMB_cache", sizeof(struct zpci_fmb), 1070 1072 __alignof__(struct zpci_fmb), 0, NULL);