Linux emulation on FreeBSD AMD64
kostikbel at gmail.com
Mon Nov 5 01:51:15 PST 2007
On Sun, Nov 04, 2007 at 07:50:50PM +0200, Valery V.Chikalov wrote:
> Kostik Belousov wrote:
> >>>This are only addresses which are arguments for linux_mprotect.
> >>>I have suspected linux_mmap_common but it not called either.
> >>the protection can be set from mmap(), can you see if there is a mmap
> >>call with 0x50....0 ?
> >SysV shm is mapped by the shmat(2) syscall. linux compat implementation,
> >linux_shmat(), calls shmat() (this shall be fixed to use kern_shmat).
> >Look for the VM_PROT_READ_IS_EXEC in the sys/kern/sysv_shm.c. I think that
> >would explain both reason for the fault and missing mmap() calls.
> >It should be fixed by acting as if VM_PROT_READ_IS_EXEC is enabled if
> >kern_shmat() is called from linux_shmat(). This might cause some
> >problems when shared segment is being attached both by freebsd and
> >linux processes.
> Yes, you are right.
> This issue was resolved already due to kindly help of rdivacky at .
> I just tried to know little more before posting the results.
> That is proposed by him patch:
> Index: vmparam.h
> RCS file: /home/ncvs/src/sys/amd64/include/vmparam.h,v
> retrieving revision 1.49
> diff -u -r1.49 vmparam.h
> --- vmparam.h 25 Sep 2007 06:25:04 -0000 1.49
> +++ vmparam.h 4 Nov 2007 14:43:39 -0000
> @@ -45,6 +45,10 @@
> #ifndef _MACHINE_VMPARAM_H_
> #define _MACHINE_VMPARAM_H_ 1
> +#ifdef COMPAT_IA32
> +#define VM_PROT_READ_IS_EXEC /* if you can read -- then you can exec */
No, this is wrong fix. It changes the ABI for freebsd binaries, and does
this not only for SysV shm, but for any readable mapping.
Instead, the following things shall be made:
1. linux_shmat() shall call kern_shmat().
2. kern_shmat() shall take the flag that would force the read mapping
to be also executable.
3. this flag shall be set when kern_shmat() is called from linux_shmat(),
and not set when called from shmat().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20071105/cc3a1a36/attachment.pgp
More information about the freebsd-emulation