linux-mips-fnet
[Top] [All Lists]

Problems w/ 2.1.131 on r3k

To: linux-mips@fnet.fr, ralf@uni-koblenz.de
Subject: Problems w/ 2.1.131 on r3k
From: Vladimir Roganov <roganov@niisi.msk.ru>
Date: Tue, 26 Jan 1999 13:40:03 +0300
Organization: NIISI
Sender: vladimir@niisi.msk.ru
Hello All, Hello Ralf !

We are testing 2.1.131 on our r3k and still have a problem
with correct signal handling.

Despite of we applied Ralf's patch (listed below), it unfortunately
does not eliminates all problems.  Syscall 'wait' still returns
"Bad address" error, and (what looks even more cool)
system becames to crash during execution of "kill -9 %1" command.

We have traced problem with 4th syscall argument, so Ralf's additions
with 'a3' saving looks reasonable, but same time they produce a
question:


   Is it all/right places where 'a3' must be saved/restored ?


Namely, signal.c contains one more place where 'epc' will rolling back
to 8 bytes. Until we put 'a3' restoring to that place, we still
got our checkpoint in 'sys_wait4' (listed below) catching 'a3 == 1'.
(I also will happy to get explanation why other syscall parameters
are saved correctly in current code :-)

One more change we made in sources (to simplify code, for debug
purposes) we switched off irix-related code (but it looks can't 
involve any problem from naive point of view).


We suppose to get your answer/advice due code implicated this error
is shared for all mips-based systems, and hope the true reason is not
very distanciated from Ralf's idea about syscall restart support in
the mips-specific code.
 


With Best Regards,
Vladimir




Code references:
================

Ralf's patch with 'a3' saving we got is a following:
----------------------------------------------------

following changes to arch/mips/kernel/{signal.c,scall_o32.S} should fix
that:

[...]
        case ERESTARTNOINTR:            /* Userland will reload $v0.  */
                regs->regs[7] = regs->regs[26];
                regs->cp0_epc -= 8;
        }
[...]
stack_done:
        sw      a3, PT_R26($28)         # save for syscall restart
        lw      t0, TASK_FLAGS($28)     # syscall tracing enabled?
        andi    t0, PF_TRACESYS
[...]


For test we are using following program:
---------------------------------------

#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <signal.h>

main()
{
    pid_t p;
    int s;
    static struct rusage r;

    for(;;)
    {
        printf( "Run  \n" );

        switch( fork() )
        {
        case 0:
            pause();
            printf( "exit\n" );
            exit(10);
        break;
        case -1:
            perror( "fork" );
            exit( 1 );
        }
        printf( "Wait %d\n", getpid() );

        signal( SIGINT, SIG_IGN );
        p = wait3( &s, 0, &r );
        if( p < 0 )
            perror( "wait" );
        if( WIFEXITED( s ) )
            printf( "child %d exits %d \n", p, WEXITSTATUS( s ) );
        if( WIFSIGNALED( s ) )
            printf( "child %d gets signal %d \n", p, WTERMSIG( s ) );
        if( WIFSTOPPED( s ) )
            printf( "child %d stoped %d \n", p, WSTOPSIG( s ) );
        signal( SIGINT, SIG_DFL );
    }
}


Our checkpoint in 'sys_wait4' is a following:
---------------------------------------------

asmlinkage int sys_wait4(pid_t pid,unsigned int * stat_addr, int
options, struct rusage * ru)
{
        int flag, retval;
        struct wait_queue wait = { current, NULL };
        struct task_struct *p;

        //DELME
        if(1 == (int)ru/*4th argument*/) {
          static unsigned long ra = 0x17171717; 
          __asm__("move $27, %0\n"
                  "sw $31, ($27)\n"
                  : : "r" (&ra));
          printk("<pid=%d,cmd=(%s),ru=lx,ra=%lx>", 
                 current->pid, current->comm, /*ru,*/
                 ra); 
        }

<Prev in Thread] Current Thread [Next in Thread>