lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8bd0f97a0910052156o7aeb704cpf72586ca2e196277@mail.gmail.com>
Date:	Tue, 6 Oct 2009 00:56:19 -0400
From:	Mike Frysinger <vapier.adi@...il.com>
To:	David Woodhouse <dwmw2@...radead.org>
Cc:	David Howells <dhowells@...hat.com>,
	Linux kernel mailing list <linux-kernel@...r.kernel.org>,
	uclinux-dist-devel <uclinux-dist-devel@...ckfin.uclinux.org>
Subject: Re: userspace firmware loader, vmap, and nommu

On Tue, Oct 6, 2009 at 00:38, David Woodhouse wrote:
> On Tue, 2009-10-06 at 00:25 -0400, Mike Frysinger wrote:
>>  the firmware loader used to work before this
>> change because it would handle the realloc steps itself (allocate
>> larger contiguous memory, copy over older data, release older memory)
>> and vmalloc() on nommu is simply kmalloc().
>>
>> this could be handled transparently on nommu systems by moving this
>> scatter gathering of pages into vmap:
>> void *vmap(struct page **pages, unsigned int count, unsigned long
>> flags, pgprot_t prot)
>> {
>>     unsigned int i;
>>     void *new_map, *page_data;
>>
>>     new_map = kmalloc(count << PAGE_SHIFT, GFP_KERNEL);
>>     if (!new_map)
>>         return NULL;
>>
>>     for (i = 0; i < count; ++i) {
>>         page_data = kmap(pages[i]);
>>         memcpy(new_map + (i << PAGE_SHIFT), page_data, PAGE_SIZE);
>>         kunmap(page_data);
>>     }
>>
>>     return new_map;
>
> I wouldn't necessarily want to do that for _all_ vmap() calls,

there arent any vmap() callers currently on nommu systems since the
functions currently BUG().  looking at lxr for 2.6.31 indicates that
there are very few relevant vmap() callers in general.

> but doing
> it just for the firmware loader might make some sense. It does mean you
> have to have _twice_ as much memory available as the size of the
> firmware in question. And you have to have a contiguous chunk even
> _after_ allocating it once piecemeal.

yes, but this is how it worked before and no one complained ;).
firmware files after all tend to be on the "small" side, so getting a
small physically contiguous mapping isnt that hard.

>> void vunmap(const void *addr)
>> {
>>     kfree(addr);
>> }
>>
>> or we could add nommu-specific code to the firmware loader to not use
>> vmap().  how would you like to go David (Howells) ?
>
> Or we could add _generic_ code not to use vmap(). Just teach the users
> that you don't get a virtually contiguous blob back from
> request_firmware(); you get an array of pages instead.

wouldnt that non-trivially increase the code work for callers of the
firmware functions ?  seems like a hefty penalty for a minority
(nommu) to impose on the majority (mmu).
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ