Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Fuxin Zhang <fxzhang@ict.ac.cn>
To: linux-mips@linux-mips.org
Subject: bug in handle_sys?
Date: Sun, 28 Mar 2004 23:27:07 -0500	[thread overview]
Message-ID: <4067A59B.5000705@ict.ac.cn> (raw)

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.

             reply	other threads:[~2004-03-28 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29  4:27 Fuxin Zhang [this message]
2004-03-30  2:21 ` bug in handle_sys? Fuxin Zhang
2004-03-30  2:21   ` Fuxin Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4067A59B.5000705@ict.ac.cn \
    --to=fxzhang@ict.ac.cn \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox