qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v6 04/16] linux-user/host/mips: Add safe-syscall.inc.S


From: Richard Henderson
Subject: Re: [PATCH v6 04/16] linux-user/host/mips: Add safe-syscall.inc.S
Date: Mon, 29 Nov 2021 17:51:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 11/29/21 5:40 PM, Peter Maydell wrote:
+        lw      a2, 16(sp)
+        lw      a3, 20(sp)
+        lw      t4, 24(sp)
+        lw      t5, 28(sp)
+        lw      t6, 32(sp)
+        lw      t7, 40(sp)
+        sw      t4, 16(sp)
+        sw      t5, 20(sp)
+        sw      t6, 24(sp)
+        sw      t7, 28(sp)

This is a varargs call, so (unless I'm confused, which is
quite possible) the caller will only allocate enough stack
space for the arguments we're actually passed, right? That
means that unless the syscall actually has 3 or more arguments
the memory at 16(sp) will be whatever the caller had on the
stack above the argument-passing area, and we can't write to
it. I think we need to actually move sp down here so we have
some space we know we can scribble on.

Yep, good catch.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]