Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757722AbXJZNZs (ORCPT ); Fri, 26 Oct 2007 09:25:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752189AbXJZNZk (ORCPT ); Fri, 26 Oct 2007 09:25:40 -0400 Received: from extu-mxob-2.symantec.com ([216.10.194.135]:59875 "EHLO extu-mxob-2.symantec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbXJZNZj (ORCPT ); Fri, 26 Oct 2007 09:25:39 -0400 Date: Fri, 26 Oct 2007 14:24:44 +0100 (BST) From: Hugh Dickins X-X-Sender: hugh@blonde.wat.veritas.com To: Jan Engelhardt cc: Jiri Kosina , Andrew Morton , Sami Farin , Linux kernel Mailing List , Jiri Kosina , Arjan van de Ven Subject: Re: [PATCH] [RFC] brk randomization: compute RLIMIT_DATA properly (was Re: x86: randomize brk() and RLIMIT_DATA) In-Reply-To: Message-ID: References: <20071025134124.wc44gdud7ixghfxv@m.safari.iki.fi> <20071025071324.2eac21d6@laptopd505.fenrus.org> <20071025171942.pjff7jbpempfcuri@m.safari.iki.fi> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 933 Lines: 24 On Fri, 26 Oct 2007, Jan Engelhardt wrote: > On Oct 26 2007 13:30, Hugh Dickins wrote: > >> @@ -251,7 +251,8 @@ asmlinkage unsigned long sys_brk(unsigned long brk) > >> * not page aligned -Ram Gupta > >> */ > >> rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; > >> - if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim) > >> + if (rlim < RLIM_INFINITY && (brk - mm->start_brk) + > >> + (mm->end_data - mm->start_data) > rlim) > >> goto out; > >> > >> newbrk = PAGE_ALIGN(brk); > > Parentheses around (brk - mm->start_brk) + (mm->end_data - mm->start_data) > not strictly necessary. Yes, but don't you find they make it easier to understand the expression? Hugh - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/