lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 May 2016 00:12:40 -0700
From:	tip-bot for Andy Lutomirski <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	brgerst@...il.com, shuahkh@....samsung.com, vdavydov@...allels.com,
	aarcange@...hat.com, cyphar@...har.com, palmer@...belt.com,
	luto@...capital.net, linux-kernel@...r.kernel.org,
	peterz@...radead.org, stsp@...t.ru, fweisbec@...il.com,
	viro@...iv.linux.org.uk, hpa@...or.com, sasha.levin@...cle.com,
	bp@...en8.de, torvalds@...ux-foundation.org, tglx@...utronix.de,
	khlebnikov@...dex-team.ru, mingo@...nel.org, tj@...nel.org,
	luto@...nel.org, xypron.glpk@....de, amanieu@...il.com,
	dvlasenk@...hat.com, akpm@...ux-foundation.org, richard@....at,
	xemul@...allels.com, pmoore@...hat.com, josh@...htriplett.org,
	oleg@...hat.com, ebiederm@...ssion.com, jason.low2@...com
Subject: [tip:core/signals] signals/sigaltstack: If SS_AUTODISARM, bypass
 on_sig_stack()

Commit-ID:  c876eeab6432687846d4cd5fe1e43dbc348de134
Gitweb:     http://git.kernel.org/tip/c876eeab6432687846d4cd5fe1e43dbc348de134
Author:     Andy Lutomirski <luto@...nel.org>
AuthorDate: Tue, 3 May 2016 10:31:49 -0700
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Wed, 4 May 2016 08:34:13 +0200

signals/sigaltstack: If SS_AUTODISARM, bypass on_sig_stack()

If a signal stack is set up with SS_AUTODISARM, then the kernel
inherently avoids incorrectly resetting the signal stack if signals
recurse: the signal stack will be reset on the first signal
delivery.  This means that we don't need check the stack pointer
when delivering signals if SS_AUTODISARM is set.

This will make segmented x86 programs more robust: currently there's
a hole that could be triggered if ESP/RSP appears to point to the
signal stack but actually doesn't due to a nonzero SS base.

Signed-off-by: Andy Lutomirski <luto@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Aleksa Sarai <cyphar@...har.com>
Cc: Amanieu d'Antras <amanieu@...il.com>
Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Eric W. Biederman <ebiederm@...ssion.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Heinrich Schuchardt <xypron.glpk@....de>
Cc: Jason Low <jason.low2@...com>
Cc: Josh Triplett <josh@...htriplett.org>
Cc: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Palmer Dabbelt <palmer@...belt.com>
Cc: Paul Moore <pmoore@...hat.com>
Cc: Pavel Emelyanov <xemul@...allels.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Richard Weinberger <richard@....at>
Cc: Sasha Levin <sasha.levin@...cle.com>
Cc: Shuah Khan <shuahkh@....samsung.com>
Cc: Stas Sergeev <stsp@...t.ru>
Cc: Tejun Heo <tj@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Vladimir Davydov <vdavydov@...allels.com>
Cc: linux-api@...r.kernel.org
Link: http://lkml.kernel.org/r/c46bee4654ca9e68c498462fd11746e2bd0d98c8.1462296606.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 include/linux/sched.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2950c5c..77fd49f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2576,6 +2576,18 @@ static inline int kill_cad_pid(int sig, int priv)
  */
 static inline int on_sig_stack(unsigned long sp)
 {
+	/*
+	 * If the signal stack is SS_AUTODISARM then, by construction, we
+	 * can't be on the signal stack unless user code deliberately set
+	 * SS_AUTODISARM when we were already on it.
+	 *
+	 * This improves reliability: if user state gets corrupted such that
+	 * the stack pointer points very close to the end of the signal stack,
+	 * then this check will enable the signal to be handled anyway.
+	 */
+	if (current->sas_ss_flags & SS_AUTODISARM)
+		return 0;
+
 #ifdef CONFIG_STACK_GROWSUP
 	return sp >= current->sas_ss_sp &&
 		sp - current->sas_ss_sp < current->sas_ss_size;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ