Bug 160812

Summary: fixes exec-shield to not randomize to between end-of-binary and start-of-brk
Product: Red Hat Enterprise Linux 4 Reporter: Tim Burke <tburke>
Component: kernelAssignee: Ingo Molnar <mingo>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: kernel-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2005-514 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-05 13:32:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 156322    

Description Tim Burke 2005-06-17 14:18:41 UTC
Refer to rhkernel-list, $subject:
[rhel4 patch] heap-gap-fix2.patch
-----------------------------------
this patch fixes exec-shield to not randomize to between end-of-binary and
start-of-brk, if the first 16MB is full with DSOs. This is a rare but
possible condition that decreases exec-shield protection. (The max() is
there to make sure we have a minimum end-area of 128MB, as start_brk can
be low on PIE binaries) This patch improves the nonexec coverage of the
exec-shield when the segment limit is used. Build and boot tested.

	Ingo

--- mm/mmap.c.orig
+++ mm/mmap.c
@@ -1303,7 +1303,7 @@ unsigned long arch_get_unmapped_exec_are
 			 * as much as possible:
 			 */
 			if (addr >= 0x01000000) {
-				tmp = randomize_range(0x01000000, mm->brk, len);
+				tmp = randomize_range(0x01000000, PAGE_ALIGN(max(mm->start_brk,
0x08000000)), len);
 				vma = find_vma(mm, tmp);
 				if (TASK_SIZE - len >= tmp &&
 				    (!vma || tmp + len <= vma->vm_start))

Comment 1 Jason Baron 2005-06-20 19:28:14 UTC

*** This bug has been marked as a duplicate of 161136 ***

Comment 4 Red Hat Bugzilla 2005-10-05 13:32:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-514.html