[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3908561D78D1C84285E8C5FCA982C28F7B37FE28@ORSMSX110.amr.corp.intel.com>
Date: Thu, 22 Feb 2018 05:34:01 +0000
From: "Luck, Tony" <tony.luck@...el.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Andi Kleen <ak@...ux.intel.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Joe Konno <joe.konno@...ux.intel.com>,
"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
Jeremy Kerr <jk@...abs.org>,
Matthew Garrett <mjg59@...gle.com>,
Peter Jones <pjones@...hat.com>,
"Andy Lutomirski" <luto@...nel.org>,
James Bottomley <james.bottomley@...senpartnership.com>
Subject: RE: [PATCH] efivarfs: Limit the rate for non-root to read files
> - just make it return -EAGAIN instead of sleeping (which probably
> just works fine and doesn't break anything and is simple)
It is very simple. But it does break things :-(. If I read one of these files
using "dd bs=1", that used to read the whole file (while generating
lots of SMI). With the -EAGAIN it just reads 100 bytes and says:
dd: error reading 'DefSetup-e8a99903-302c-4851-a6be-ab2731873b2f': Resource temporarily unavailable
100+0 records in
100+0 records out
100 bytes copied, 0.153943 s, 0.6 kB/s
> - add a per-user mutex, and do the usleep inside of it, so that
> anybody who tries to do a thousand threads will just be serialized by
> the mutex.
>
> Note that the mutex needs to be per-user, because otherwise it will be
> a DoS for the other users.
I can try that tomorrow (adding the per-user mutex to struct user_struct
right next to the ratelimit I added.
-Tony
Powered by blists - more mailing lists