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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 29 Mar 2009 13:53:59 +0200 (MEST)
From:	Mikael Pettersson <mikpe@...uu.se>
To:	linux-kernel@...r.kernel.org
Subject: can get_signal_to_deliver() clobber current's _RESTORE_SIGMASK flag?

In all archs that support _RESTORE_SIGMASK do_signal() queries the
thread flags and sets up oldset before calling get_signal_to_deliver(),
but oldset is then only used in the "if (signr > 0)" block.

Would it be safe to move the threads flags query past the
get_signal_to_deliver() call into the "if (signr > 0)" block?
To illustrate, here's how it would look on x86:

--- linux-2.6.29/arch/x86/kernel/signal.c.~1~	2009-03-24 18:00:34.000000000 +0100
+++ linux-2.6.29/arch/x86/kernel/signal.c	2009-03-29 10:36:02.000000000 +0200
@@ -802,7 +802,6 @@ static void do_signal(struct pt_regs *re
 	struct k_sigaction ka;
 	siginfo_t info;
 	int signr;
-	sigset_t *oldset;
 
 	/*
 	 * We want the common case to go fast, which is why we may in certain
@@ -814,13 +813,15 @@ static void do_signal(struct pt_regs *re
 	if (!user_mode(regs))
 		return;
 
-	if (current_thread_info()->status & TS_RESTORE_SIGMASK)
-		oldset = &current->saved_sigmask;
-	else
-		oldset = &current->blocked;
-
 	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
 	if (signr > 0) {
+		sigset_t *oldset;
+
+		if (current_thread_info()->status & TS_RESTORE_SIGMASK)
+			oldset = &current->saved_sigmask;
+		else
+			oldset = &current->blocked;
+
 		/*
 		 * Re-enable any watchpoints before delivering the
 		 * signal to user space. The processor register will


The background is that I've been working on _RESTORE_SIGMASK
support for ARM in order to enable pselect6/ppoll/epoll_pwait.
It's working but as a cleanup rmk wanted the oldset setup code to
be moved into the "if (signr > 0)" block. But that's only safe if
get_signal_to_deliver() cannot clobber current's _RESTORE_SIGMASK.

/Mikael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ