[Top] [All Lists]

[PATCH] unaligned.c

To: "" <>
Subject: [PATCH] unaligned.c
From: Zhang Fuxin <>
Date: Fri, 7 Dec 2001 20:18:39 +0800
 This patch does:
  1.As Mr. Atsushi Nemoto has pointed out,the newest unaligned.c leave out 
several jb in
the sw/sh emulation code.It will lead to oops if someone use unaligned 
addresses as syscall 
arguments to be stored to.Because the fixup code won't return to 
emulate_load_store_insn then.

  2.when search_exception_table does find a fixup in emulate_load_store_insn,I 
think we should
   skip compute_return_epc(regs) in do_ade then.Or it will jump to wrong fixup 
position later.
   ltp failed the getsockname syscall test in this way:
           getsockname(fd,&sock,(int *)1)         1 is used at the position of 
       then,kernel will finally call get_user to fetch the user provided len and
       cause a AdeL exception: 
              (a fixup installed for the lw)
                       ---> do_ade
                                 emulate fail
                                 search_exception_table find the handler
                                 installed by get_user and change 
                                  regs->cp0_epc to the fixup position
                          compute_return_epc(regs) ADD another 4 to epc!
               execution continues from fixup + 4,this omit the code to load 
-EFAULT to return
               value of get_user,may lead to further failures
   so i propose watch epc during emulate_load_store_insn,if it changes,then 
skip compute_return
  3.(optional,implemented)it may be better for search_exception_table & 
   to use PC instead of regs->cp0_epc as arguments. PC points to the actual 
   instruction anyway, although this is for kernel code so it is almost 
impossible for 
   user space accessing code to put load/store in a branch delay.
  4.(optional,unimplemented) Will it be more efficient to put use emulation 
code of lw/lh/sw/sh
    before other impossible conditions?

  Am i missing something?

   Could somebody be so kind to explain the use of save_static_function?I know 
they build
  a pseudo function with a return, so call sys_sigsuspend will fall through to 
  but what's the use? Nobody calls _sys_sigsuspend.

            Zhang Fuxin

Attachment: unaligned.c.patch
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] unaligned.c, Zhang Fuxin <=