Re: [tip:x86/asm] x86/mm/64: Enable vmapped stacks (CONFIG_HAVE_ARCH_VMAP_STACK=y)

From: Matt Fleming
Date: Mon Oct 24 2016 - 09:10:05 EST


On Fri, 21 Oct, at 05:18:30PM, Andy Lutomirski wrote:
>
> This is asking for trouble if any of the variable length parameters
> are on the stack. How about adding a "size_t size" parameter and
> doing:
>
> if (!va) {
> return 0;
> } else if (virt_addr_valid(va)) {
> return virt_to_phys(va);
> } else {
> /* A fully aligned variable on the stack is guaranteed not to cross
> a page boundary. */
> WARN_ON(!IS_ALIGNED((uintptr_t)va, size) || size > PAGE_SIZE);
> return slow_virt_to_phys(va);
> }

Ah, good catch. Something like this?

---