From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20746 invoked by alias); 8 Mar 2006 19:21:23 -0000 Received: (qmail 20426 invoked by uid 48); 8 Mar 2006 19:21:20 -0000 Date: Wed, 08 Mar 2006 19:21:00 -0000 Message-ID: <20060308192120.20425.qmail@sourceware.org> From: "rsa at us dot ibm dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20040610193839.214.dlstevens@us.ibm.com> References: <20040610193839.214.dlstevens@us.ibm.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/214] sbrk() doesn't detect brk() failures. Malloc doesn't handle sbrk() failures X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00046.txt.bz2 List-Id: ------- Additional Comments From rsa at us dot ibm dot com 2006-03-08 19:21 ------- Found the 'issue'. In the Linux kernel in the sys_brk syscall handler: mm/mmap.c:sys_brk ... if (brk < mm->end_code) goto out; newbrk = PAGE_ALIGN(brk); oldbrk = PAGE_ALIGN(mm->brk); if (oldbrk == newbrk) goto set_brk; ... set_brk: mm->brk = brk; out: retval = mm->brk; up_write(&mm->mmap_sem); return retval; The Linux kernel operates in pages. It checks the page boundary of the current brk and the new brk and if they're the same it simply increment's the brk the requested amount and returns. It never checks the soft-limit if the brk request falls within the same page of the current brk. -- http://sourceware.org/bugzilla/show_bug.cgi?id=214 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.