Re: [PATCH 2/3] mm: update core kernel code to use vm_flags_t consistently

From
Uladzislau Rezki <urezki@gmail.com>
Date
2025-08-27 16:59:23
Also in
kvm, linux-fsdevel, linux-mm, linux-trace-kernel, lkml, nvdimm, sparclinux
Reply to
Kees Cook, 2025-08-25
On Mon, Aug 25, 2025 at 02:37:11PM -0700, Kees Cook wrote:
On Tue, Aug 05, 2025 at 06:13:56PM +0200, Uladzislau Rezki wrote:
quoted
I agree. Also it can be even moved under vmalloc.c. There is only one
user which needs it globally, it is usercopy.c. It uses find_vmap_area()
which is wrong. See:

<snip>
	if (is_vmalloc_addr(ptr) && !pagefault_disabled()) {
		struct vmap_area *area = find_vmap_area(addr);

		if (!area)
			usercopy_abort("vmalloc", "no area", to_user, 0, n);

		if (n > area->va_end - addr) {
			offset = addr - area->va_start;
			usercopy_abort("vmalloc", NULL, to_user, offset, n);
		}
		return;
	}
<snip>

we can add a function which just assign va_start, va_end as input
parameters and use them in the usercopy.c. 
Yes please! I'd must rather use some exported validation routine than
having it hand-coded in usercopy.c. :)
I will do it :)

--
Uladzislau Rezki
Thread (48 messages) 48 messages, 16 authors, last reply 2025-08-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help