Date: Tue, 30 Oct 2018 16:39:44 +0100 From: Peter Zijlstra Subject: Re: [PATCH 13/17] prmem: linked list: disable layout randomization Message-ID: <20181030153944.GB13436@hirez.programming.kicks-ass.net> References: <20181023213504.28905-1-igor.stoppa@huawei.com> <20181023213504.28905-14-igor.stoppa@huawei.com> <20181026093205.GD3159@worktop.c.hoisthospitality.com> <20181026101707.GO25444@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181026101707.GO25444@bombadil.infradead.org> To: Matthew Wilcox Cc: Igor Stoppa , Mimi Zohar , Kees Cook , Dave Chinner , James Morris , Michal Hocko , kernel-hardening@lists.openwall.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, igor.stoppa@huawei.com, Dave Hansen , Jonathan Corbet , Laura Abbott , Greg Kroah-Hartman , Andrew Morton , Masahiro Yamada , Alexey Dobriyan , Pekka Enberg , "Paul E. McKenney" , Lihao Liang , linux-kernel@vger.kernel.org List-ID: On Fri, Oct 26, 2018 at 03:17:07AM -0700, Matthew Wilcox wrote: > On Fri, Oct 26, 2018 at 11:32:05AM +0200, Peter Zijlstra wrote: > > On Wed, Oct 24, 2018 at 12:35:00AM +0300, Igor Stoppa wrote: > > > Some of the data structures used in list management are composed by two > > > pointers. Since the kernel is now configured by default to randomize the > > > layout of data structures soleley composed by pointers, this might > > > prevent correct type punning between these structures and their write > > > rare counterpart. > > > > 'might' doesn't really work for me. Either it does or it does not. > > He means "Depending on the random number generator, the two pointers > might be AB or BA. If they're of opposite polarity (50% of the time), > it _will_ break, and 50% of the time it _won't_ break." So don't do that then. If he were to include struct list_head inside his prlist_head, then there is only the one randomization and things will just work. Also, I really don't see why he needs that second type and all that type punning crap in the first place.