linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: feed more data into entropy pool
@ 2016-05-18 21:32 Dmitry Torokhov
  2016-05-19  6:46 ` Henrik Rydberg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2016-05-18 21:32 UTC (permalink / raw)
  To: linux-input; +Cc: Jiri Kosina, Benjamin Tissoires, Henrik Rydberg, djkurtz

Commit 4369c64c79a22 ("Input: Send events one packet at a time")
significantly reduced amount of entropy input core was feeding to the rest
of the system, because only the very first event in the event block would
be used as source of entropy.

With this change we will be calling add_input_randomness() for every event
that is not filtered by the input core as a duplicate. In addition, all
EV_SYN events are ignored.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index b87ffbd..d95c34e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -153,8 +153,6 @@ static void input_pass_values(struct input_dev *dev,
 
 	rcu_read_unlock();
 
-	add_input_randomness(vals->type, vals->code, vals->value);
-
 	/* trigger auto repeat for key events */
 	if (test_bit(EV_REP, dev->evbit) && test_bit(EV_KEY, dev->evbit)) {
 		for (v = vals; v != vals + count; v++) {
@@ -371,9 +369,10 @@ static int input_get_disposition(struct input_dev *dev,
 static void input_handle_event(struct input_dev *dev,
 			       unsigned int type, unsigned int code, int value)
 {
-	int disposition;
+	int disposition = input_get_disposition(dev, type, code, &value);
 
-	disposition = input_get_disposition(dev, type, code, &value);
+	if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
+		add_input_randomness(type, code, value);
 
 	if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
 		dev->event(dev, type, code, value);
-- 
2.8.0.rc3.226.g39d4020


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: feed more data into entropy pool
  2016-05-18 21:32 [PATCH] Input: feed more data into entropy pool Dmitry Torokhov
@ 2016-05-19  6:46 ` Henrik Rydberg
  2016-05-19  7:15 ` Benjamin Tissoires
  2016-05-19  8:39 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Henrik Rydberg @ 2016-05-19  6:46 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input; +Cc: Jiri Kosina, Benjamin Tissoires, djkurtz

Hi Dmitry,

On 05/18/2016 11:32 PM, Dmitry Torokhov wrote:
> Commit 4369c64c79a22 ("Input: Send events one packet at a time")
> significantly reduced amount of entropy input core was feeding to the rest
> of the system, because only the very first event in the event block would
> be used as source of entropy.
> 
> With this change we will be calling add_input_randomness() for every event
> that is not filtered by the input core as a duplicate. In addition, all
> EV_SYN events are ignored.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Henrik Rydberg <rydberg@bitmath.org>

Thanks for this, it has been nagging me as well.

> -	disposition = input_get_disposition(dev, type, code, &value);
> +	if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
> +		add_input_randomness(type, code, value);

As a comment, it is not immediately clear to me how this will affect latency,
although it appears rather harmless.

Thanks,
Henrik


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: feed more data into entropy pool
  2016-05-18 21:32 [PATCH] Input: feed more data into entropy pool Dmitry Torokhov
  2016-05-19  6:46 ` Henrik Rydberg
@ 2016-05-19  7:15 ` Benjamin Tissoires
  2016-05-19  8:39 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2016-05-19  7:15 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Jiri Kosina, Henrik Rydberg, djkurtz

On May 18 2016 or thereabouts, Dmitry Torokhov wrote:
> Commit 4369c64c79a22 ("Input: Send events one packet at a time")
> significantly reduced amount of entropy input core was feeding to the rest
> of the system, because only the very first event in the event block would
> be used as source of entropy.
> 
> With this change we will be calling add_input_randomness() for every event
> that is not filtered by the input core as a duplicate. In addition, all
> EV_SYN events are ignored.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: feed more data into entropy pool
  2016-05-18 21:32 [PATCH] Input: feed more data into entropy pool Dmitry Torokhov
  2016-05-19  6:46 ` Henrik Rydberg
  2016-05-19  7:15 ` Benjamin Tissoires
@ 2016-05-19  8:39 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2016-05-19  8:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Benjamin Tissoires, Henrik Rydberg, djkurtz

On Wed, 18 May 2016, Dmitry Torokhov wrote:

> Commit 4369c64c79a22 ("Input: Send events one packet at a time")
> significantly reduced amount of entropy input core was feeding to the rest
> of the system, because only the very first event in the event block would
> be used as source of entropy.
> 
> With this change we will be calling add_input_randomness() for every event
> that is not filtered by the input core as a duplicate. In addition, all
> EV_SYN events are ignored.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

IMO absolutely reasonable thing to do. FWIW

	Acked-by: Jiri Kosina <jkosina@suse.cz>

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-19  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 21:32 [PATCH] Input: feed more data into entropy pool Dmitry Torokhov
2016-05-19  6:46 ` Henrik Rydberg
2016-05-19  7:15 ` Benjamin Tissoires
2016-05-19  8:39 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).