Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
[parent not found: <Pine.LNX.3.95L01at.970523001215.15876A-100000@wopr.campus.luth.se>]
[parent not found: <sjmzptnuvu2.fsf@incommunicado.ihtfp.org>]
* Re: LKMs and installing syscalls on Linux/alpha 2.0.27 (resend)
@ 1997-05-22 19:53 Derek Atkins
  0 siblings, 0 replies; 8+ messages in thread
From: Derek Atkins @ 1997-05-22 19:53 UTC (permalink / raw)


Andreas Johansson <ajo@wopr.campus.luth.se> writes:

> To me it seems like a bug in Linux/alpha, see below.

Not surprising...

> 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:

That sounds reasonable...

[patch removed]

I applied what of this patch I could to the 2.0.27 kernel..  No
problems here.  But this didn't solve the problem (not surprising --
it shouldn't have solved it).

> 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
> -----------------------------------------------------------------------

This unfortunately sends the machine into a looping sereis of oopses.
So, no, this didn't work.  However...

> 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 tried following this suggestion by putting the ldgp before the
cmovne...  But again it just looped in a series of oopses.  So, thanks
for the idea, but it didn't work.

Any other ideas?

> 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.

Thats ok.. I appreciate the help.  To whom should I report this bug
to get it put into 2.0.31/2.1.x as appropriate???

> 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.

Shouldn't matter...  I suspect that all -mno-fp-regs does is speed
things up a bit, rather than functionally change anything.

-derek

-- 
       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

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* LKMs and installing syscalls on Linux/alpha 2.0.27 (resend)
@ 1997-05-21 22:45 Derek Atkins
  1997-05-22 15:57 ` Andreas Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Derek Atkins @ 1997-05-21 22:45 UTC (permalink / raw)


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

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1997-05-23 12:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.3.95L01at.970522170543.13615C-100000@wopr.campus.luth.se>
1997-05-22 20:40 ` LKMs and installing syscalls on Linux/alpha 2.0.27 (resend) 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
     [not found] <sjmzptnuvu2.fsf@incommunicado.ihtfp.org>
1997-05-22 20:12 ` Andreas Johansson
1997-05-22 19:53 Derek Atkins
  -- strict thread matches above, loose matches on Subject: below --
1997-05-21 22:45 Derek Atkins
1997-05-22 15:57 ` Andreas Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox