Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2006 09:45:58 -0700
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Alexander Leidinger <Alexander@Leidinger.net>
Cc:        emulation@FreeBSD.org, Marcin Cieslak <saper@SYSTEM.PL>, Marcel Moolenaar <marcel@FreeBSD.org>
Subject:   Re: Fix for errno 2 - expected 14 (EFAULT) problems
Message-ID:  <450C2A46.9010609@FreeBSD.org>
In-Reply-To: <20060916171840.5dd744b7@Magellan.Leidinger.net>
References:  <450C0C0E.8060402@SYSTEM.PL> <20060916171840.5dd744b7@Magellan.Leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexander,

Actually it's confusion on your part. This code was there since version 
1.1 and long before 1.31 (my change that touched this line):

$ cvs ann -r1.30 linux_machdep.c
[...]
1.1          (marcel   22-Aug-00):      bsd_args.prot = linux_args.prot 
| PROT_READ;    /* always required */

So that you are better to ask marcel about why it is "always required" 
(if he remembers of course).

-Maxim

Alexander Leidinger wrote:
> Quoting Marcin Cieslak <saper@SYSTEM.PL> (Sat, 16 Sep 2006 16:37:02 +0200):
> 
> I CCed sobomax@, he committed the code in question.
> 
> Maxim, do you remember why it is always required as the comment suggests?
> 
>> 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:
> 
> Maxim, Marcin noticed it isn't... some other ones (mmap and writev related)
> fail now. But at least we have an idea now where to look for the error.
> 
>> --- /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.
> 
> Anyone with an amd64 system out there and willing to test this (with
> the LTP testsuite as described on
> http://wiki.freebsd.org/linux-kernel)? Because this doesn't seems to be
> the final fix, it isn't necessary to test this particular patch, but it
> would be nice to know if there are some differences between the results
> on i386 (as can be seen in the wiki) and amd64.
> 
>> This fixes access03, chdir04, chmod06, chown04, chroot03 and many others.
> 
> Bye,
> Alexander.
> 




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