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: <4A22BB99.1070104@cs.helsinki.fi>
Date:	Sun, 31 May 2009 20:17:13 +0300
From:	Pekka Enberg <penberg@...helsinki.fi>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
CC:	Alan Cox <alan@...rguk.ukuu.org.uk>,
	"Larry H." <research@...reption.com>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] Use kzfree in tty buffer management to enforce data 
 sanitization

Hi Linus,

On Sun, 31 May 2009, Alan Cox wrote:
>>>>        memset(buf->data, 0, N_TTY_BUF_SIZE);
>>>>        if (PAGE_SIZE != N_TTY_BUF_SIZE)
>>>>                kfree(...)
>>>>        else
>>>>                free_page(...)
>>>>
>>>>
>>>> but quite frankly, I'm not convinced about these patches at all.
>>> I wonder why the tty code has that N_TTY_BUF_SIZE special casing in
>>> the first place? I think we can probably just get rid of it and thus
>>> we can use kzfree() here if we want to.
>> Some platforms with very large page sizes override the use of page based
>> allocators (eg older ARM would go around allocating 32K). The normal path
>> is 4K or 8K page sized buffers.

Linus Torvalds wrote:
> I think Pekka meant the other way around - why don't we always just use 
> kmalloc(N_TTY_BUF_SIZE)/kfree(), and drop the whole conditional "use page 
> allocator" entirely?
> 
> I suspect the "use page allocator" is historical - ie the tty layer 
> originally always did that, and then when people wanted to suppotr smaller 
> areas than one page, they added the special case. I have this dim memory 
> of the _original_ kmalloc not handling page-sized allocations well (due to 
> embedded size/pointer overheads), but I think all current allocators are 
> perfectly happy to allocate PAGE_SIZE buffers without slop.
> 
> If I'm right, then we could just use kmalloc/kfree unconditionally. Pekka?

Yup, that's what I meant. Even SLAB moves metadata off-slab to make sure 
  we support PAGE_SIZE allocations nicely. SLUB even used to pass 
kmalloc(PAGE_SIZE) directly to the page allocator and will likely do 
that again once Mel Gorman's page allocator optimization patches hit 
mainline.

			Pekka
--
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