Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1516132 > unrolled thread

[PATCH 3.12 36/72] MIPS: ptrace: Fix regs_return_value for kernel context

Started byJiri Slaby <jslaby@suse.cz>
First post2016-11-07 14:20 +0100
Last post2016-11-07 14:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.12 36/72] MIPS: ptrace: Fix regs_return_value for kernel context Jiri Slaby <jslaby@suse.cz> - 2016-11-07 14:20 +0100

#1516132 — [PATCH 3.12 36/72] MIPS: ptrace: Fix regs_return_value for kernel context

FromJiri Slaby <jslaby@suse.cz>
Date2016-11-07 14:20 +0100
Subject[PATCH 3.12 36/72] MIPS: ptrace: Fix regs_return_value for kernel context
Message-ID<sAS0a-3Aq-9@gated-at.bofh.it>
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 74f1077b5b783e7bf4fa3007cefdc8dbd6c07518 upstream.

Currently regs_return_value always negates reg[2] if it determines
the syscall has failed, but when called in kernel context this check is
invalid and may result in returning a wrong value.

This fixes errors reported by CONFIG_KPROBES_SANITY_TEST

Fixes: d7e7528bcd45 ("Audit: push audit success and retcode into arch ptrace.h")
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14381/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/include/asm/ptrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 5e6cd0947393..a288de2199d8 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -73,7 +73,7 @@ static inline int is_syscall_success(struct pt_regs *regs)
 
 static inline long regs_return_value(struct pt_regs *regs)
 {
-	if (is_syscall_success(regs))
+	if (is_syscall_success(regs) || !user_mode(regs))
 		return regs->regs[2];
 	else
 		return -regs->regs[2];
-- 
2.10.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web