From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965131AbcHJS40 (ORCPT ); Wed, 10 Aug 2016 14:56:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45758 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752820AbcHJS4X (ORCPT ); Wed, 10 Aug 2016 14:56:23 -0400 Subject: Re: [PATCH v3] powerpc: Do not make the entire heap executable To: Kees Cook References: <20160809190822.28856-1-dvlasenk@redhat.com> Cc: "linuxppc-dev@lists.ozlabs.org" , Jason Gunthorpe , Benjamin Herrenschmidt , Paul Mackerras , Oleg Nesterov , Michael Ellerman , Florian Weimer , Linux-MM , LKML From: Denys Vlasenko Message-ID: <3e1336d7-d0c1-beec-7526-af4eebc199fa@redhat.com> Date: Wed, 10 Aug 2016 14:56:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 10 Aug 2016 12:56:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/10/2016 12:43 AM, Kees Cook wrote: >> -static int do_brk(unsigned long addr, unsigned long len) >> +static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags) >> { >> struct mm_struct *mm = current->mm; >> struct vm_area_struct *vma, *prev; >> - unsigned long flags; >> struct rb_node **rb_link, *rb_parent; >> pgoff_t pgoff = addr >> PAGE_SHIFT; >> int error; >> @@ -2666,7 +2665,7 @@ static int do_brk(unsigned long addr, unsigned long len) >> if (!len) >> return 0; >> >> - flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; >> + flags |= VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; > > For sanity's sake, should a mask be applied here? i.e. to be extra > careful about what flags can get passed in? Maybe... I am leaving it to mm experts. > Otherwise, this looks okay to me: > > Reviewed-by: Kees Cook > > -Kees