Re: m68k libc5 regression

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Geert Uytterhoeven <geert@...>
Cc: Ingo Molnar <mingo@...>, Linux/m68k <linux-m68k@...>, Linux Kernel Development <linux-kernel@...>
Date: Monday, May 26, 2008 - 6:19 pm

On Mon, 26 May 2008, Geert Uytterhoeven wrote:


Hmm, libc5 is known to make broken assumptions about brk location, that's 
why we introduced CONFIG_COMPAT_BRK, do you have that option turned on?


Indeed, this should take CONFIG_COMPAT_BRK into account. Does the patch 
below fix it? (assuming that you have CONFIG_COMPAT_BRK=y):



From: Jiri Kosina <jkosina@suse.cz>

brk: check lower bound properly

The check in sys_brk() on minimum value the brk might have must take 
CONFIG_COMPAT_BRK setting into account. When this option is turned on 
(i.e. we support ancient legacy binaries, e.g. libc5-linked stuff), the 
lower bound on brk value is mm->end_code, otherwise the brk start is 
allowed to be arbitrarily shifted.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

diff --git a/mm/mmap.c b/mm/mmap.c
index fac6633..834118b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -245,10 +245,16 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
 	unsigned long rlim, retval;
 	unsigned long newbrk, oldbrk;
 	struct mm_struct *mm = current->mm;
+	unsigned long min_brk;
 
 	down_write(&mm->mmap_sem);
 
-	if (brk < mm->start_brk)
+#ifdef CONFIG_COMPAT_BRK
+	min_brk = mm->end_code;
+#else
+	min_brk = mm->start_brk;
+#endif
+	if (brk < min_brk)
 		goto out;
 
 	/*
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
m68k libc5 regression, Geert Uytterhoeven, (Mon May 26, 4:38 pm)
Re: m68k libc5 regression, Jiri Kosina, (Mon May 26, 6:19 pm)
Re: m68k libc5 regression, Andrew Morton, (Sun Jun 1, 3:53 am)
Re: m68k libc5 regression, Jiri Kosina, (Mon Jun 2, 6:27 am)
Diagnosing linux-next (Was: Re: m68k libc5 regression), Stephen Rothwell, (Sun Jun 1, 9:26 am)
Re: Diagnosing linux-next (Was: Re: m68k libc5 regression), Paul Mackerras, (Sun Jun 1, 10:12 pm)
Re: m68k libc5 regression, Geert Uytterhoeven, (Sun Jun 1, 4:37 am)
Re: m68k libc5 regression, Andrew Morton, (Sun Jun 1, 4:48 am)
Re: m68k libc5 regression, Geert Uytterhoeven, (Sun Jun 1, 5:56 am)
Re: m68k libc5 regression, Sam Ravnborg, (Sun Jun 1, 5:22 am)
Re: m68k libc5 regression, Andrew Morton, (Sun Jun 1, 5:41 am)
Re: m68k libc5 regression, Sam Ravnborg, (Sun Jun 1, 6:34 am)
Re: m68k libc5 regression, Geert Uytterhoeven, (Thu May 29, 3:38 pm)
Re: m68k libc5 regression, Jiri Kosina, (Mon Jun 2, 6:28 am)
Re: m68k libc5 regression, Jiri Kosina, (Thu May 29, 7:03 am)
Re: m68k libc5 regression, Geert Uytterhoeven, (Thu May 29, 7:28 am)