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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

- Another fix to avoid allocating pages that overlap with ERR_PTR,
which manifests on rv32

- A revert for the badaccess patch I incorrectly picked up an early
version of

* tag 'riscv-for-linus-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
Revert "riscv: mm: accelerate pagefault when badaccess"
riscv: fix overlap of allocated page and PTR_ERR

+13 -12
+2 -2
arch/riscv/mm/fault.c
··· 293 293 if (unlikely(access_error(cause, vma))) { 294 294 vma_end_read(vma); 295 295 count_vm_vma_lock_event(VMA_LOCK_SUCCESS); 296 - tsk->thread.bad_cause = SEGV_ACCERR; 297 - bad_area_nosemaphore(regs, code, addr); 296 + tsk->thread.bad_cause = cause; 297 + bad_area_nosemaphore(regs, SEGV_ACCERR, addr); 298 298 return; 299 299 } 300 300
+11 -10
arch/riscv/mm/init.c
··· 250 250 kernel_map.va_pa_offset = PAGE_OFFSET - phys_ram_base; 251 251 252 252 /* 253 - * memblock allocator is not aware of the fact that last 4K bytes of 254 - * the addressable memory can not be mapped because of IS_ERR_VALUE 255 - * macro. Make sure that last 4k bytes are not usable by memblock 256 - * if end of dram is equal to maximum addressable memory. For 64-bit 257 - * kernel, this problem can't happen here as the end of the virtual 258 - * address space is occupied by the kernel mapping then this check must 259 - * be done as soon as the kernel mapping base address is determined. 253 + * Reserve physical address space that would be mapped to virtual 254 + * addresses greater than (void *)(-PAGE_SIZE) because: 255 + * - This memory would overlap with ERR_PTR 256 + * - This memory belongs to high memory, which is not supported 257 + * 258 + * This is not applicable to 64-bit kernel, because virtual addresses 259 + * after (void *)(-PAGE_SIZE) are not linearly mapped: they are 260 + * occupied by kernel mapping. Also it is unrealistic for high memory 261 + * to exist on 64-bit platforms. 260 262 */ 261 263 if (!IS_ENABLED(CONFIG_64BIT)) { 262 - max_mapped_addr = __pa(~(ulong)0); 263 - if (max_mapped_addr == (phys_ram_end - 1)) 264 - memblock_set_current_limit(max_mapped_addr - 4096); 264 + max_mapped_addr = __va_to_pa_nodebug(-PAGE_SIZE); 265 + memblock_reserve(max_mapped_addr, (phys_addr_t)-max_mapped_addr); 265 266 } 266 267 267 268 min_low_pfn = PFN_UP(phys_ram_base);