From owner-freebsd-hackers Fri Dec 29 18:02:42 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA03811 for hackers-outgoing; Fri, 29 Dec 1995 18:02:42 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id SAA03804 for ; Fri, 29 Dec 1995 18:02:30 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id MAA07930; Sat, 30 Dec 1995 12:58:38 +1100 Date: Sat, 30 Dec 1995 12:58:38 +1100 From: Bruce Evans Message-Id: <199512300158.MAA07930@godzilla.zeta.org.au> To: creilly@maths.tcd.ie, freebsd-hackers@FreeBSD.ORG Subject: Re: Linux emulator and Mathematica. Sender: owner-hackers@FreeBSD.ORG Precedence: bulk >Using a vanilla 2.1R installation: >I've been trying to make Linux Mathematica using a network license,run >under the linux emulator, and after adding a trivial implementation of >... >The problem now is that mathclient crashes. Looking at the syslog output >and the system calls, it would appearing to be crashing on a sigreturn: > 791 mathclient CALL sigreturn(0xefbfc0e0,0xe,0) > 791 mathclient RET sigreturn -1 errno 1 Operation not permitted > 791 mathclient PSIG SIGBUS SIG_DFL > 791 mathclient NAMI "mathclient.core" >The signal it is responding to is a sigalarm. >Now, from my reading of the sigreturn stuff and the Design and Implementation of >4.3BSD, it would seem that what is happening is that the sigreturn is trying The Linux sigreturn() isn't fully implemented in the Linux emulator. It returns ENOSYS. The problem here is probably quite different. Few applications call sigreturn() directly. It is normally called as part of returning from a signal handler. The kernel builds a signal trampoline with a sigreturn() syscall at the end of it. The Linux emulator should replace the code that builds the trampoline so that the syscall is the Linux sigreturn() and not the BSD sigreturn(). It should also convert the BSD sigcontext struct to the Linux sigcontext sigcontext struct. It doesn't do this, so the Linux syscall that happens to have the same number as the BSD sigreturn (#103 = Linux syslog()) is called instead. This is fudged to work by breaking the Linux syslog() by pretending that it is the Linux sysreturn(). >to restore some part of the state that it is not permitted to manipulate. Would >this seem reasonable to the kernel experts out there? One problem with this Yes, it's quite likely that Mathematica is sophisticated enough to manipulate the signal context. Since the sigcontext struct is incompatible, this is unlikely to work, and could easily attempt to change a protected register. However, this should result in errno EINVAL, not EPERM. Bruce