public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] pru: Fix memory corruption on syscall return Date: Thu, 2 Jul 2020 09:00:49 +0000 (GMT) [thread overview] Message-ID: <20200702090049.D05883858D34@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70cd4cbe651388897539fe38d2610e9bb733c5a8 commit 70cd4cbe651388897539fe38d2610e9bb733c5a8 Author: Dimitar Dimitrov <dimitar@dinux.eu> Date: Wed Jun 3 19:14:22 2020 +0300 pru: Fix memory corruption on syscall return In the initial code I missed one level of pointer indirection. Instead of storing errno in impure_data, _impure_ptr was corrupted. Only simulator is impacted. Real targets have no OS and no syscalls. This resolves a bunch of stdio cases from the GCC testsuite: FAIL->PASS: gcc.c-torture/execute/printf-2.c -O0 execution test Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu> Diff: --- libgloss/pru/syscalls.S | 1 + 1 file changed, 1 insertion(+) diff --git a/libgloss/pru/syscalls.S b/libgloss/pru/syscalls.S index 8ed7601a4..3ad0d9215 100644 --- a/libgloss/pru/syscalls.S +++ b/libgloss/pru/syscalls.S @@ -42,6 +42,7 @@ __SC_ret: /* Invert return code and store to errno (first int in _impure_ptr). */ rsb r14, r14, 0 ldi32 r1, _impure_ptr + lbbo r1, r1, 0, 4 sbbo r14, r1, 0, 4 /* Return -1 (for both int32_t or int64_t). */ fill r14, 8
reply other threads:[~2020-07-02 9:00 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200702090049.D05883858D34@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).