Re: [PATCH] random: Fix signal_pending() usage

From: Linus Torvalds
Date: Mon Jun 20 2022 - 15:00:43 EST


On Mon, Jun 20, 2022 at 2:44 AM Sebastian Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
>
> Based on that, I don't see a problem dropping that signal check
> especially that requests larger than 4KiB are most likely exotic.

Why would we do that?

Anybody who doesn't handle -EINTR is a clown, not a security issue.

Your "6s isn't that bad" is ridiculous, since

(a) 6 seconds is forever

(b) there are issues like "oops, we're out of memory, you got a
signal because root is trying to kill your annoying stupid program
using top"

and the fact is, anybody who asks for more than a few kilo-*bits* from
the kernel is already doing something questionable to begin with, and
there is no reason to bend over backwards and try to make such a crazy
use suddenly act differently from ALL OTHER character devices.

Handling signals is the *default* behavior. It is only regular files
where that doesn't happen. This is not a regular file, and the "it's
about security" is not an argument.

As mentioned, expecting an uninterruptible read is not "security". It's garbage.

Linus