RE: mremap vulnerability patch for WOLK

"Mike Bethune" <[email protected]> Wed, 14 Jan 2004 09:13:06 -0800
Newsgroups gmane.linux.wolk.devel
Message-ID <[email protected]>
> you can fix up WOLK (most kernels, in fact) with regard to 
> the security flaw described by CAN-2003-0985 by using the 
> patch below. Note that this is the "proper" patch approved by 
> Linus, not the deprecated one which unfortunately made it 
> into the official 2.4.24 release.

Hi, I was waiting for a follow up on this because as Marc pointed out:

> > that fix from Linus is bogus.
> I've said so ;)
> http://marc.theaimsgroup.com/?l=linux-kernel&m=107352619815208&w=2


Anyway, here's a patch that "works for me" and applies to wolk 4.9s and 4.10pre7 at least:

--- linux/mm/mremap.c.orig      Wed Jan 14 08:16:39 2004
+++ linux/mm/mremap.c   Wed Jan 14 08:16:40 2004
@@ -297,6 +297,9 @@ unsigned long do_mremap(unsigned long ad
                if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
                        goto out;
+               if (unlikely(!new_len && new_addr != addr))
+                       goto out;
+
 #ifdef CONFIG_GRKERNSEC_PAX_SEGMEXEC
                if ((current->flags & PF_PAX_SEGMEXEC) &&
                    (new_len > SEGMEXEC_TASK_SIZE || new_addr > SEGMEXEC_TASK_SIZE-new_len))


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
WOLK - Working Overloaded Linux Kernel
[email protected]
https://lists.sourceforge.net/lists/listinfo/wolk-devel