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


Groups > linux.kernel > #1582001 > unrolled thread

[PATCH 3.16 047/306] arc: don't leak bits of kernel stack into coredump

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-02-16 00:40 +0100
Last post2017-02-16 00:40 +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.16 047/306] arc: don't leak bits of kernel stack into  coredump Ben Hutchings <ben@decadent.org.uk> - 2017-02-16 00:40 +0100

#1582001 — [PATCH 3.16 047/306] arc: don't leak bits of kernel stack into coredump

FromBen Hutchings <ben@decadent.org.uk>
Date2017-02-16 00:40 +0100
Subject[PATCH 3.16 047/306] arc: don't leak bits of kernel stack into coredump
Message-ID<tbhl2-6vr-85@gated-at.bofh.it>
3.16.40-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@zeniv.linux.org.uk>

commit 7798bf2140ebcc36eafec6a4194fffd8d585d471 upstream.

On faulting sigreturn we do get SIGSEGV, all right, but anything
we'd put into pt_regs could end up in the coredump.  And since
__copy_from_user() never zeroed on arc, we'd better bugger off
on its failure without copying random uninitialized bits of
kernel stack into pt_regs...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[bwh: Backported to 3.16:
 - Adjust context
 - Don't change the single return statement]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arc/kernel/signal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -80,11 +80,12 @@ static int restore_usr_regs(struct pt_re
 	int err;
 
 	err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
-	if (!err)
-		set_current_blocked(&set);
-
 	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch),
 				sizeof(sf->uc.uc_mcontext.regs.scratch));
+	if (err)
+		return err;
+
+	set_current_blocked(&set);
 
 	return err;
 }

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web