Re: [PATCH 3/5] mips: sanitize restart logics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 28, 2010 at 11:50 AM, Al Viro <viro@xxxxxxxxxxxxxxxx> wrote:
>
> Put the original syscall number into ->regs[0] when we leave syscall
> with error.  Use it in restart logics.  Everything else will have
> it 0 since we pass through SAVE_SOME on all the ways in.  Note that
> in places like bad_stack and inllegal_syscall we leave it 0 - it's
> not restartable.
>
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

Building 2.6.36-rc8 on a 32-bit mipsel system gives me
the following compile failure:

  LD      .tmp_vmlinux1
arch/mips/built-in.o:/home/shane/linux-mips.org/linux/arch/mips/kernel/scall32-o32.S:66:
undefined reference to `PR_R2'
arch/mips/built-in.o:/home/shane/linux-mips.org/linux/arch/mips/kernel/scall32-o32.S:66:
undefined reference to `PR_R2'
make: *** [.tmp_vmlinux1] Error 1

I tracked it down to this patch.  In particular, I believe the change
to scall32-o32.S is causing the problem.

> diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
> index 17202bb..d3edb9f 100644
> --- a/arch/mips/kernel/scall32-o32.S
> +++ b/arch/mips/kernel/scall32-o32.S
> @@ -63,9 +63,9 @@ stack_done:
>        sw      t0, PT_R7(sp)           # set error flag
>        beqz    t0, 1f
>
> +       lw      t1, PR_R2(sp)           # syscall number

Should this be PT_R2(sp), rather than PR_R2(sp)?

>        negu    v0                      # error
> -       sw      v0, PT_R0(sp)           # set flag for syscall
> -                                       # restarting
> +       sw      t1, PT_R0(sp)           # save it for syscall restarting
>  1:     sw      v0, PT_R2(sp)           # result
>
>  o32_syscall_exit:
> @@ -104,9 +104,9 @@ syscall_trace_entry:
>        sw      t0, PT_R7(sp)           # set error flag
>        beqz    t0, 1f
>
> +       lw      t1, PT_R2(sp)           # syscall number
>        negu    v0                      # error
> -       sw      v0, PT_R0(sp)           # set flag for syscall
> -                                       # restarting
> +       sw      t1, PT_R0(sp)           # save it for syscall restarting
>  1:     sw      v0, PT_R2(sp)           # result
>
>        j       syscall_exit
> @@ -170,7 +170,6 @@ stackargs:
>         */
>  bad_stack:
>        negu    v0                              # error
> -       sw      v0, PT_R0(sp)
>        sw      v0, PT_R2(sp)
>        li      t0, 1                           # set error flag
>        sw      t0, PT_R7(sp)

Changing PR_R2(sp) to PT_R2(sp) allows me to compile
and successfully boot 2.6.36-rc8.  I'll whip up a quick patch
to make this change and submit it.

Shane
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux