Linux kernel source tree
Go to file
Linus Torvalds f8eb5bd9a8 mm: fix build on 32-bit targets without MAX_PHYSMEM_BITS
The merge resolution to deal with the conflict between commits
ea72ce5da2 ("x86/kaslr: Expose and use the end of the physical memory
address space") and 99185c10d5 ("resource, kunit: add test case for
region_intersects()") ended up being broken in configurations didn't
define a MAX_PHYSMEM_BITS and that had a 32-bit 'phys_addr_t'.

The fallback to using all bits set (ie "(-1ULL)") ended up causing a
build error:

    kernel/resource.c: In function ‘gfr_start’:
    include/linux/minmax.h:93:30: error: conversion from ‘long long unsigned int’ to ‘resource_size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]

this was reported by Geert for m68k, but he points out that it happens
on other 32-bit architectures too, eg mips, xtensa, parisc, and powerpc.

Limiting 'PHYSMEM_END' to a 'phys_addr_t' (which is the same as
'resource_size_t') fixes the build, but Geert points out that it will
then cause a silent overflow in mm/sparse.c:

	unsigned long max_sparsemem_pfn = (PHYSMEM_END + 1) >> PAGE_SHIFT;

so we actually do want PHYSMEM_END to be defined a 64-bit type - just
not all ones, and not larger than 'phys_addr_t'.

The proper fix is probably to not have some kind of default fallback at
all, but just make sure every architecture has a valid MAX_PHYSMEM_BITS.
But in the meantime, this just applies the rule that PHYSMEM_END is the
largest value that fits in a 'phys_addr_t', but does not have the high
bit set in 64 bits.

Ugly, ugly.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-23 08:58:31 -07:00
arch hexagon: vdso: Fix build failure 2024-09-23 08:17:50 -07:00
block vfs-6.12.blocksize 2024-09-20 17:53:17 -07:00
certs
crypto crypto: aegis128 - Fix indentation issue in crypto_aegis128_process_crypt() 2024-09-13 18:26:52 +08:00
Documentation ring-buffer: Updates for v6.12: 2024-09-22 09:47:16 -07:00
drivers sched_ext: Initial pull request for v6.12 2024-09-21 09:44:57 -07:00
fs Merge branch 'address-masking' 2024-09-22 11:19:35 -07:00
include mm: fix build on 32-bit targets without MAX_PHYSMEM_BITS 2024-09-23 08:58:31 -07:00
init sched_ext: Initial pull request for v6.12 2024-09-21 09:44:57 -07:00
io_uring slab updates for 6.12 2024-09-18 08:53:53 +02:00
ipc ipc/shm, mm: drop do_vma_munmap() 2024-09-03 21:15:52 -07:00
kernel ring-buffer: Updates for v6.12: 2024-09-22 09:47:16 -07:00
lib Merge branch 'address-masking' 2024-09-22 11:19:35 -07:00
LICENSES LICENSES: add 0BSD license text 2024-09-01 20:43:24 -07:00
mm Many singleton patches - please see the various changelogs for details. 2024-09-21 08:20:50 -07:00
net bpf-next-6.12 2024-09-21 09:27:50 -07:00
rust Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-05 20:37:20 -07:00
samples bpf-next-6.12 2024-09-21 09:27:50 -07:00
scripts bpf-next-6.12 2024-09-21 09:27:50 -07:00
security bpf-next-6.12 2024-09-21 09:27:50 -07:00
sound sound updates for 6.12-rc1 2024-09-17 17:03:43 +02:00
tools ring-buffer: Updates for v6.12: 2024-09-22 09:47:16 -07:00
usr
virt KVM: use follow_pfnmap API 2024-09-17 01:06:59 -07:00
.clang-format
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap drm next for 6.12-rc1 2024-09-19 10:18:15 +02:00
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: Mark powerpc spufs as orphaned 2024-08-19 21:27:56 +10:00
Kbuild
Kconfig
MAINTAINERS sched_ext: Initial pull request for v6.12 2024-09-21 09:44:57 -07:00
Makefile Linux 6.11 2024-09-15 16:57:56 +02: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 reStructuredText 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.