diff options
| author | Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com> | 2026-11-13 16:38:12 -0300 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-22 22:24:12 -0800 |
| commit | fe7e4ee305cf62f86e2545b7f657949399af8aeb (patch) | |
| tree | 381b183c550f646b24840bafb3622695c381954c /tools/perf/scripts/python | |
| parent | 642abe8448674a953675486596f68060bd6c7fb6 (diff) | |
mm: use PFN_PHYS() in phys_mem_access_prot()
phys_mem_access_prot() stores "pfn << PAGE_SHIFT" in a phys_addr_t. The
shift is evaluated as unsigned long, so on a 32-bit kernel with
CONFIG_PHYS_ADDR_T_64BIT an address above 4 GiB is truncated before
uncached_access() compares it with __pa(high_memory).
mmap_mem_prepare() already shifts in phys_addr_t, so the mapping is
accepted and then left cacheable. PFN_PHYS() casts before the shift.
On a MIPS32 XPA Malta guest, mmap of /dev/mem at 0xf00000000 without
O_DSYNC used the boot CCA. The same mapping with O_DSYNC was uncached.
With PFN_PHYS() both are uncached.
Link: https://patch.msgid.link/20261113193812.1239880-1-ivanrwcm25@gmail.com
Fixes: 7e6735c3578e ("/dev/mem: use phys_addr_t for physical addresses")
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: <stable@vger.kernel.org>
mm/char-mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
