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

From: Matt Fleming
Date: Mon Nov 07 2016 - 07:59:03 EST


On Sun, 30 Oct, at 09:21:29AM, Andy Lutomirski wrote:
> > @@ -251,7 +277,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
> > if (!page)
> > panic("Unable to allocate EFI runtime stack < 4GB\n");
> >
> > - efi_scratch.phys_stack = virt_to_phys(page_address(page));
> > + addr = page_address(page);
> > + efi_scratch.phys_stack = virt_to_phys_or_null_size(addr, PAGE_SIZE);
>
> This can't be on the stack -- you just allocated it with alloc_page().

Oh good point. I was too eager with search and replace.

> > +static unsigned long efi_name_size(efi_char16_t *name)
> > +{
> > + return ucs2_strsize(name, EFI_VAR_NAME_LEN) + 1;
> > +}
>
> If this is really dynamic, I'm surprised that anything ends up
> aligned. Can't this be a number like 6? It might pay to extend that
> warning to also check that, if the variable is on the stack, its size
> is a power of two. But maybe none of the users of this are on the
> stack, in which case it might pay to try to prevent a new user on the
> stack from showing up.

I can't find any existing users that place strings on the stack, no.

OK, let's try this one.

---