Linux emulation on FreeBSD AMD64

Valery V.Chikalov valera at chikalov.dp.ua
Sun Nov 4 09:53:38 PST 2007


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 */
+#endif
+
  /*
   * Machine dependent constants for AMD64.
   */

There are no more missing execute bits.

But now I'm trying to investigate why from some time linux_ipc begin to 
return "-1 errno 34 Result too large", which results in oracle coredumps 
(as usual :-))

  1011 oracle   CALL 
linux_ipc(0x15,0x30000,0,0xffffac08,0x50000000,0xffffac18)
   1011 oracle   RET   linux_ipc 0
   1011 oracle   CALL  linux_ipc(0x2,0,0x1,0x780,0,0xffffaca8)
   1011 oracle   RET   linux_ipc 589824/0x90000
   1011 oracle   CALL  linux_ipc(0x3,0x90000,0,0x10,0xffffac5c,0xffffaca8)
   1011 oracle   RET   linux_ipc -1 errno 34 Result too large
   1011 oracle   CALL  linux_ipc(0x3,0x90000,0,0x10,0xffffac5c,0xffffaca8)
   1011 oracle   RET   linux_ipc -1 errno 34 Result too large
   1011 oracle   CALL  linux_ipc(0x3,0x90000,0,0x10,0xffffac5c,0xffffaca8)


Thank you for help.
Valery.


More information about the freebsd-emulation mailing list