Linux MIPS Architecture development
 help / color / mirror / Atom feed
* bug in handle_sys?
@ 2004-03-29  4:27 Fuxin Zhang
  2004-03-30  2:21 ` Fuxin Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Fuxin Zhang @ 2004-03-29  4:27 UTC (permalink / raw)
  To: linux-mips

Hi,

My colleague finds that there is probably a bug in handle_sys:

.align 5
NESTED(handle_sys, PT_SIZE, sp)
.set noat
SAVE_SOME
STI
.set at

lw t1, PT_EPC(sp) # skip syscall on return

sltiu t0, v0, MAX_SYSCALL_NO + 1 # check syscall number
addiu t1, 4 # skip to next instruction
beqz t0, illegal_syscall
sw t1, PT_EPC(sp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This code is not guarded by .set no reorder,so it won't be the delay slot
instruction,thus illegal_syscall with num > MAX_SYSCALL_NO will return with
EPC unchanged. The reason it works is that the syscall number register 
v0 will
be changed to ENOSYS. ENOSYS is fortunately another illegal syscall number
that will take another illegal_syscall return path.

Newer glibc of debian(2.3.2+?) will generate sys_4246,and that lead to real
problem for mips64. Put the line ahead of the beqz solve it.

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

end of thread, other threads:[~2004-03-30  2:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-29  4:27 bug in handle_sys? Fuxin Zhang
2004-03-30  2:21 ` Fuxin Zhang
2004-03-30  2:21   ` Fuxin Zhang

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