commit: 05bc0619935cd3646e282a8d68b9564cad7d5b6e
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 22:04:16 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 22:04:16 2015 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=05bc0619
libsandbox: fix alpha ptrace error setting
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
libsandbox/trace/linux/alpha.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libsandbox/trace/linux/alpha.c b/libsandbox/trace/linux/alpha.c
index 4aa6cd6..950d019 100644
--- a/libsandbox/trace/linux/alpha.c
+++ b/libsandbox/trace/linux/alpha.c
@@ -52,7 +52,12 @@ static long trace_raw_ret(void *vregs)
static void trace_set_ret(void *vregs, int err)
{
+ /* We set r19 here, but it looks like trace_set_regs does not sync that.
+ * Remember that {r16..r31} == {a0..a15}, so when we write out {a0..a5},
+ * we also write out {r16..r21} -- a3 == r19.
+ */
trace_regs *regs = vregs;
- regs->r0 = -err;
+ regs->r0 = err;
+ regs->r19 = -1;
trace_set_regs(regs);
}