Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2006 16:37:02 +0200
From:      Marcin Cieslak <saper@SYSTEM.PL>
To:        emulation@freebsd.org
Subject:   Fix for errno 2 - expected 14 (EFAULT) problems
Message-ID:  <450C0C0E.8060402@SYSTEM.PL>

next in thread | raw e-mail | index | archive | help

LTP tests illegal memory by mmaping one-byte area region with PROT_NONE.
Old FreeBSD (before 1.333 version of /sys/vm/vm_map.c) always silently allowed
reada access - see http://www.freebsd.org/cgi/query-pr.cgi?pr=64573.
Linux emulation (initial version of linux_machdep.c) always added PROT_READ
to match FreeBSD behaviour, I think this is no longer necessary.

The fix for i386 is easy:

--- /usr/home/saper/b/src/sys/i386/linux/linux_machdep.c        Fri Aug  5 
01:25:32 2005
+++ /sys/i386/linux/linux_machdep.c     Sat Sep 16 15:13:47 2006
@@ -549,7 +549,7 @@
                 bsd_args.len  = linux_args->len;
         }

-       bsd_args.prot = linux_args->prot | PROT_READ;   /* always required */
+       bsd_args.prot = linux_args->prot;
         if (linux_args->flags & LINUX_MAP_ANON)
                 bsd_args.fd = -1;
         else

However comment in the amd64 file indicates that for some Java applications 
PROT_EXEC should be added as well. I think we can remove PROT_READ also from 
amd64 part anyway.

This fixes access03, chdir04, chmod06, chown04, chroot03 and many others.

-- 
               << Marcin Cieslak // saper@system.pl >>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?450C0C0E.8060402>