To: linux-axp@redhat.com
Date: 21 May 1997 18:45:53 -0400
Message-ID: <sjm67wcwiji.fsf@incommunicado.ihtfp.org>
Lines: 121
X-Mailer: Gnus v5.2.37/Emacs 19.30
I'm not on this list, so please send any replies directly to me.
Hi. I'm still trying to port Linux-AFS to Linux/alpha. My most
recent problem is that the kernel segfaults my process when I try to
execute an installed syscall. I have some example code below which
shows the problem. Does anyone have any ideas about how to fix this?
Is there some magic alpha voodoo which I'm missing? FWIW, this code
works on Linux/x86 and Linux/sparc.
Basically, what happens is that the LKM installs a new syscall
(afs_syscall) in the sys_call_table. Then afsd calls that syscall.
Currently, there is an oops when returning from the afs_syscall, and
afsd seg faults. If you run afsd without the afs module installed,
it just returns -1 and errno is set to EPERM.
I'm running RedHat 4.1 with the stock redhat 2.0.27 kernel, glibc
0.961212, gcc 2.7.2.1, and insmod-bfd 0.2 with the debug patches. I
can't find the System.map for this kernel, so tracking this crash is a
little difficult for me. It _looks_ like the crash is happening in
entSys() or ret_from_syscall() in arch/alpha/kernel/entry.S, but I'm
not sure. The crash I get is:
AFS module unloaded (fffffc0000313230)
AFS test module loaded (fffffc0000313230->fffffe000008a008)
In afs_syscall
set args
Unable to handle kernel paging request at virtual address 0000000000000000
food(547): Oops 0
pc = [<fffffc0000311958>] ps = 0000
rp = [<fffffc0000311944>] sp = fffffc000133df30
r0=0 r1=0 r2=0 r3=fffffc0003a53bf0
r8=1f0
r16=fffffc000046a7d8 r17=0 r18=50 r19=0
r20=0 r21=0 r22=0 r23=fffffc000047cfe8
r24=0 r25=200 r26=fffffc0000311944 r27=fffffc000031b148
r28=7 r29=fffffe00000921c0 r30=fffffc000133df30
Code: b7fe0048 474014d3 a41d8350 <a4200000> f4200007 a45d83b8 a4620000 a45d83c0 a4820000
I include the code that causes this crash below. Again, this code
works fine on Linux/x86 and Linux/sparc. I compiled the two files
using the following commands:
afs.c cc -g -c -DMODULE -DKERNEL -D__KERNEL__ afs.c
afsd.c cc -g -o afsd afsd.c
The following is a "shell archive" which should (hopefully) extract
the files afs.c and afsd.c. Compile the files, load afs.o into the
kernel, and then run afsd to cause the oops. You should just be able
to execute the rest of this file -- or you can cut-and-paste by hand.
I'd appreciate it if someone could explain why this code fails on
Linux/alpha.
Thanks in advance!
-derek
#!/bin/sh
#
# This should self-extract into afs.c and afsd.c, I hope.
#
cat > afs.c <<EOF
#include <sys/syscall.h>
#include <linux/module.h>
#include <linux/kernel.h>
extern void *sys_call_table[];
static void (*saved_afs_syscall)();
static int afs_syscall()
{
printk("In afs_syscall\n");
return 0;
}
int
init_module(void)
{
saved_afs_syscall = sys_call_table[SYS_afs_syscall];
sys_call_table[SYS_afs_syscall] = afs_syscall;
printk ("AFS test module loaded (%p->%p)\n", saved_afs_syscall,
sys_call_table[SYS_afs_syscall]);
return 0;
}
void
cleanup_module(void)
{
sys_call_table[SYS_afs_syscall] = saved_afs_syscall;
printk ("AFS module unloaded (%p)\n", sys_call_table[SYS_afs_syscall]);
}
EOF
cat > afsd.c <<EOF
#include <stdlib.h>
#include <syscall.h>
#include <errno.h>
int
main (void)
{
long retval;
printf ("Running test AFS daemon\n");
retval = syscall(SYS_afs_syscall);
printf ("Syscall returned %d (errno=%d)\n", retval, errno);
return 0;
}
EOF
exit 0
#
# End of shell archive
#
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL N1NWH
warlord@MIT.EDU PGP key available