[coreboot-gerrit] New patch to review for coreboot: libpayload: x86/exec - fix return value passing

Mathias Krause (minipli@googlemail.com) gerrit at coreboot.org
Sat Feb 11 22:58:18 CET 2017


Mathias Krause (minipli at googlemail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18332

-gerrit

commit 6a5b0edd7cfd7500b9772dbce74dc03c8324d84a
Author: Mathias Krause <minipli at googlemail.com>
Date:   Tue Feb 7 19:47:16 2017 +0100

    libpayload: x86/exec - fix return value passing
    
    The pointer to write the return value to is in %ecx, not %eax. Writing
    to (%eax) leads to memory corruptions as %eax holds the return value,
    e.g. would write zero to address zero for a "successful" returning
    payload.
    
    Change-Id: I82df27ae89a9e3d25f479ebdda2b50ea57565459
    Signed-off-by: Mathias Krause <minipli at googlemail.com>
---
 payloads/libpayload/arch/x86/exec.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/payloads/libpayload/arch/x86/exec.S b/payloads/libpayload/arch/x86/exec.S
index c7595e9..7d89cc0 100644
--- a/payloads/libpayload/arch/x86/exec.S
+++ b/payloads/libpayload/arch/x86/exec.S
@@ -85,7 +85,7 @@ i386_do_exec:
          */
 
 	movl 20(%ebp), %ecx
-	movl %eax, (%eax)
+	movl %eax, (%ecx)
 
 	/* Get the rest of the saved registers */
 	popl %ecx



More information about the coreboot-gerrit mailing list