From: Andreas Johansson <ajo@wopr.campus.luth.se>
Subject: Re: LKMs and installing syscalls on Linux/alpha 2.0.27 (resend)
Date: Thu, 22 May 1997 17:57:17 +0200 (CEST) [thread overview]
Message-ID: <2e0ae0600bbf467d1ea9925a4351139b.axp-list@archive.invalid> (raw)
In-Reply-To: <sjm67wcwiji.fsf@incommunicado.ihtfp.org>
On 21 May 1997, Derek Atkins wrote:
> 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.
To me it seems like a bug in Linux/alpha, see below.
> 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:
I can confirm that the crash is in ret_from_syscall(). Here is my oops:
May 22 17:10:24 wopr kernel: In afs_syscall
May 22 17:10:24 wopr kernel: Unable to handle kernel paging request at
virtual address 0000000000000000
May 22 17:10:24 wopr kernel: afsd(13711): Oops 0
May 22 17:10:24 wopr kernel: pc = [<fffffc0000310ae4>] ps = 0000
May 22 17:10:24 wopr kernel: rp = [<fffffc0000310ac8>] ra =
[<0000000000000000>]
May 22 17:10:24 wopr kernel: r0 = 0000000000000000 r1 = 0000000000000000
May 22 17:10:24 wopr kernel: r2 = fffffc000346d810 r3 = 0000000000000000
May 22 17:10:24 wopr kernel: r4 = 0000000000000000 r5 = fffffc0000413000
May 22 17:10:24 wopr kernel: r6 = fffffc000042be00 r7 = fffffc0000412ff8
May 22 17:10:24 wopr kernel: r8 = fffffc00037fb018 r9 = 0000000000000001
May 22 17:10:24 wopr kernel: r10= 000000011ffffb80 r11= 000000011ffffb90
May 22 17:10:24 wopr kernel: r12= 000000012018a608 r13= 00000001201a88e8
May 22 17:10:24 wopr kernel: r14= 000000012016e288 r15= 000000011ffffb58
May 22 17:10:24 wopr kernel: r16= 0000000000000000 r17= fffffc01c0007f20
May 22 17:10:24 wopr kernel: r18= fffffc00033dded8 r19= 0000000000000000
May 22 17:10:24 wopr kernel: r20= 0000000000000000 r21= 0000000000000000
May 22 17:10:24 wopr kernel: r22= 0000000000000000 r23= 000001555580625c
May 22 17:10:24 wopr kernel: r24= fffffc0000310a20 r25= 0000000000002000
May 22 17:10:24 wopr kernel: r27= fffffc000031ada0 r28= 0000000000000000
May 22 17:10:24 wopr kernel: gp = fffffe000008e208 sp = fffffc00033ddf18
May 22 17:10:24 wopr kernel: Code: 474014d3 f4200006 a47d95a0 <a4630000>
a49d8e50 a4840000 44640002 f440005e a41e00b8
Here is a little output from gdb (note that I am using linux 2.1.36):
(gdb) disassemble 0xfffffc0000310ae4
Dump of assembler code for function ret_from_sys_call:
0xfffffc0000310ad8 <ret_from_sys_call>:
474014d3 cmovne ra,0,a3
0xfffffc0000310adc <ret_from_sys_call+4>:
f4200006 bne t0,0xfffffc0000310af8 <ret_from_handle_bh>
0xfffffc0000310ae0 <ret_from_sys_call+8>:
a47d95a0 ldq t2,-27232(gp) <= t2 is loaded here
0xfffffc0000310ae4 <ret_from_sys_call+12>:
a4630000 ldq t2,0(t2) <= PC is here
0xfffffc0000310ae8 <ret_from_sys_call+16>:
a49d8e50 ldq t3,-29104(gp)
0xfffffc0000310aec <ret_from_sys_call+20>:
a4840000 ldq t3,0(t3)
0xfffffc0000310af0 <ret_from_sys_call+24>:
44640002 and t2,t3,t1
0xfffffc0000310af4 <ret_from_sys_call+28>:
f440005e bne t1,0xfffffc0000310c70 <handle_bottom_half>
End of assembler dump.
So it seems gp is f*cked up (not loaded in ret_from_sys_call()). I remember
a similar problem with the nfs module some time ago (concerning
kernel_thread()). I even have the patch for that problem left:
-------------------------------------------------------------------------
--- linux/arch/alpha/kernel/entry.S.orig Fri Feb 7 12:47:02 1997
+++ linux/arch/alpha/kernel/entry.S Fri Feb 7 12:51:14 1997
@@ -228,11 +228,12 @@ kernel_clone:
.ent __kernel_thread
__kernel_thread:
.frame $30, 4*8, $26
+ ldgp $29,0($27)
subq $30,4*8,$30
stq $10,16($30)
stq $9,8($30)
stq $26,0($30)
- .prologue 0
+ .prologue 1
bis $17,$17,$9 /* save fn */
bis $18,$18,$10 /* save arg */
bsr $26,kernel_clone
@@ -244,8 +245,6 @@ __kernel_thread:
ret $31,($26),1
/* this is in child: look out as we don't have any stack here.. */
1: bis $9,$9,$27 /* get fn */
- br $29,2f
-2: ldgp $29,0($29)
bis $10,$10,$16 /* get arg */
ldq $8,current_set
jsr $26,($27)
-----------------------------------------------------------------------
My guess as to fixing your problem is this small patch:
-----------------------------------------------------------------------
--- arch/alpha/kernel/entry.S.orig Thu May 22 17:38:29 1997
+++ arch/alpha/kernel/entry.S Thu May 22 17:41:24 1997
@@ -521,6 +521,7 @@
cmovne $26,0,$19 /* $19 = 0 => non-restartable */
+ ldgp $29,0($27)
/* check bottom half interrupts */
bne $1,ret_from_handle_bh
ldq $3,bh_active
ldq $4,bh_mask
and $3,$4,$2
-----------------------------------------------------------------------
I have no idea if ret_from_sys_call looks the same in 2.0.27, but if not,
just try to add
ldgp $29,0($27)
in the beginning of the function.
I am only guessing here, I am not pretending to be an expert on kernel
issues. Try this patch on your own risk, I haven't even tried it myself :)
If you are having great difficulcy compiling your own kernel I could be
persuaded to try the patch myself.
> 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
I think you should add the -mno-fp-regs compile flag. This is used on all
modules in the kernel, and I have had modules malfunctioning without it.
This does not solve your problem though.
/Andreas
--
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
: E-mail: ajo@wopr.campus.luth.se :
: S-mail: Andreas Johansson, Karhusvagen 5 6:618, 977 54 Lulea, SWEDEN :
: Have you had your dose of 261.62 BogoMIPS today? - Run Alpha! :
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next prev parent reply other threads:[~1997-05-22 15:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-21 22:45 LKMs and installing syscalls on Linux/alpha 2.0.27 (resend) Derek Atkins
1997-05-22 15:57 ` Andreas Johansson [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-05-22 19:53 Derek Atkins
[not found] <sjmzptnuvu2.fsf@incommunicado.ihtfp.org>
1997-05-22 20:12 ` Andreas Johansson
[not found] <Pine.LNX.3.95L01at.970522170543.13615C-100000@wopr.campus.luth.se>
1997-05-22 20:40 ` Richard Henderson
1997-05-22 22:20 ` Andreas Johansson
1997-05-23 12:14 ` Andreas Johansson
[not found] <Pine.LNX.3.95L01at.970523001215.15876A-100000@wopr.campus.luth.se>
1997-05-23 3:54 ` Richard Henderson
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox