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: <20150113161751.a33361d60cf2627ed079d4bc@linux-foundation.org>
Date:	Tue, 13 Jan 2015 16:17:51 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Craig Milo Rogers <rogers@....edu>
Cc:	Andrzej Hajda <a.hajda@...sung.com>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Linux MM <linux-mm@...ck.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>, Andreas Mohr <andi@...as.de>,
	Mike Turquette <mturquette@...aro.org>,
	Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 0/5] kstrdup optimization

On Tue, 13 Jan 2015 16:10:57 -0800 Craig Milo Rogers <rogers@....edu> wrote:

> > As kfree_const() has the exact same signature as kfree(), the risk of
> > accidentally passing pointers returned from kstrdup_const() to kfree() seems
> > high, which may lead to memory corruption if the pointer doesn't point to
> > allocated memory.
> ...
> >> To verify if the source is in .rodata function checks if the address is between
> >> sentinels __start_rodata, __end_rodata. I guess it should work with all
> >> architectures.
> 
> 	kfree() could also check if the region being freed is in .rodata, and
> ignore the call; kfree_const() would not be needed.  If making this check all
> the time leads to a significant decrease in performance (numbers needed here),
> another option is to keep kfree_const() but add a check to kfree(), when
> compiled for debugging, that issues a suitable complaint if the region being
> freed is in .rodata.
> 

Adding overhead to kfree() would be a show-stopper - it's a real
hotpath.

kstrdup_const() is only used in a small number of places.  Just don't
screw it up.


btw, I have vague memories that gcc used to put some strings into .text
under some circumstances.

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