Patch "random: check for signal_pending() outside of need_resched() check" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    random: check for signal_pending() outside of need_resched() check

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     random-check-for-signal_pending-outside-of-need_resched-check.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Fri Jun 17 08:58:56 AM CEST 2022
From: Jann Horn <jannh@xxxxxxxxxx>
Date: Tue, 5 Apr 2022 18:39:31 +0200
Subject: random: check for signal_pending() outside of need_resched() check

From: Jann Horn <jannh@xxxxxxxxxx>

commit 1448769c9cdb69ad65287f4f7ab58bc5f2f5d7ba upstream.

signal_pending() checks TIF_NOTIFY_SIGNAL and TIF_SIGPENDING, which
signal that the task should bail out of the syscall when possible. This
is a separate concept from need_resched(), which checks
TIF_NEED_RESCHED, signaling that the task should preempt.

In particular, with the current code, the signal_pending() bailout
probably won't work reliably.

Change this to look like other functions that read lots of data, such as
read_zero().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/char/random.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -549,13 +549,13 @@ static ssize_t get_random_bytes_user(voi
 	}
 
 	do {
-		if (large_request && need_resched()) {
+		if (large_request) {
 			if (signal_pending(current)) {
 				if (!ret)
 					ret = -ERESTARTSYS;
 				break;
 			}
-			schedule();
+			cond_resched();
 		}
 
 		chacha20_block(chacha_state, output);


Patches currently in stable-queue which might be from jannh@xxxxxxxxxx are

queue-4.19/random-initialize-chacha20-constants-with-correct-endianness.patch
queue-4.19/random-zero-buffer-after-reading-entropy-from-userspace.patch
queue-4.19/random-don-t-reset-crng_init_cnt-on-urandom_read.patch
queue-4.19/random-check-for-signals-every-page_size-chunk-of-dev-random.patch
queue-4.19/random-remove-dead-code-left-over-from-blocking-pool.patch
queue-4.19/random-check-for-signal_pending-outside-of-need_resched-check.patch
queue-4.19/random-remove-outdated-int_max-6-check-in-urandom_read.patch
queue-4.19/random-do-not-allow-user-to-keep-crng-key-around-on-stack.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux