Comments

On Thu, Aug 04, 2011 at 11:43:31PM +0100, Peter Maydell wrote:
> On 4 August 2011 23:16, An-Cheng Huang <ancheng@ubnt.com> wrote:> > A simpler approach would be to just change the number of arguments for> > sys_syscall to 8 in the mips_syscall_args table so that for indirect> > syscalls the "higher" arguments are always taken from the stack with> > get_user_ual(). However, since there is a comment about "what to do> > if get_user() fails", I don't know if this may cause breakage when the> > arguments are not actually there? If someone can confirm that this is> > harmless, the simple approach is probably better? Thanks.> > In fact the Linux kernel will always read all four arguments off the> stack for sys_syscall, regardless:> http://lxr.linux.no/#linux+v3.0/arch/mips/kernel/scall32-o32.S#L188> > So setting sys_syscall to 8 is not just easier but actually the Right> Thing. The comment about get_user() is cut-n-paste from various other> places in the file where it applies just as much -- it is no more of> an issue for MIPS or for sys_syscall than for any other architecture> or syscall. [ie it is a bug, but not in practice a very serious one,> and you can ignore it for the purposes of fixing the bug you've found> here.]> > Incidentally, you can find the answer to the "what if get_user fails"> question for MIPS here:> http://lxr.linux.no/#linux+v3.0/arch/mips/kernel/scall32-o32.S#L166> ...we should set ret to -TARGET_EFAULT and skip the call to do_syscall.
Ok the following patch changes the number of arguments for sys_syscall to 8 in mips_syscall_args and also skips the do_syscall() call if any of the get_user() calls fails. Do you think combining these makes sense or should they be two separate patches? Thanks.
Signed-off-by: An-Cheng Huang <ancheng@ubnt.com>
---
linux-user/main.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)

On 5 August 2011 01:05, An-Cheng Huang <ancheng@ubnt.com> wrote:
> Ok the following patch changes the number of arguments for sys_syscall> to 8 in mips_syscall_args and also skips the do_syscall() call if any> of the get_user() calls fails. Do you think combining these makes sense> or should they be two separate patches? Thanks.
The code in this patch looks good, but yes, I think they should
be two separate patches.
thanks
-- PMM