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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200707291705.l6TH554a003344@colorfullife.mysite.adiungo.com>
Date:	Sun, 29 Jul 2007 19:05:05 +0200
From:	Manfred Spraul <manfred@...orfullife.com>
To:	akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] Use ERESTARTNOHAND if poll() is interrupted by a signal

Hi Andrew,

poll() returns -EINTR if a signal is pending.
EINTR is a bad choice: it means that poll returns to user space if the
task is stopped by SIGSTOP/SIGCONT or by the freezer.
select() and ppoll() both use ERESTARTNOHAND, this avoids a return to
user space for signals that are handled by the kernel.

The patch switches poll() to ERESTARTNOHAND.
Tested with FC6. Patch against 2.6.23-rc1-mm1.

Signed-off-by: Manfred Spraul <manfred@...orfullife.com>

--- 2.6/fs/select.c	2007-07-28 20:31:51.000000000 +0200
+++ build-2.6/fs/select.c	2007-07-28 21:21:52.000000000 +0200
@@ -621,7 +621,7 @@ static int do_poll(unsigned int nfds,  s
 		if (!count) {
 			count = wait->error;
 			if (signal_pending(current))
-				count = -EINTR;
+				count = -ERESTARTNOHAND;
 		}
 		if (count || !*timeout)
 			break;
@@ -774,7 +774,7 @@ asmlinkage long sys_ppoll(struct pollfd 
 	ret = do_sys_poll(ufds, nfds, &timeout);
 
 	/* We can restart this syscall, usually */
-	if (ret == -EINTR) {
+	if (ret == -ERESTARTNOHAND) {
 		/*
 		 * Don't restore the signal mask yet. Let do_signal() deliver
 		 * the signal on the way back to userspace, before the signal
@@ -785,7 +785,6 @@ asmlinkage long sys_ppoll(struct pollfd 
 					sizeof(sigsaved));
 			set_thread_flag(TIF_RESTORE_SIGMASK);
 		}
-		ret = -ERESTARTNOHAND;
 	} else if (sigmask)
 		sigprocmask(SIG_SETMASK, &sigsaved, NULL);
 
-
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