Messages in this thread | | | From | (Eric W. Biederman) | Date | Thu, 22 Feb 2018 11:10:22 -0600 | Subject | Re: [PATCH] efivarfs: Limit the rate for non-root to read files |
| |
"Luck, Tony" <tony.luck@intel.com> writes:
>> - 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.
Another possibility is to cache the files in the page cache. That will reduce re-reads of the same data to the maximum extent.
If efi has a chance of changing variables behind our back we might want something that would have a timeout on how long the data is cached, and we probably want to make the caching policy write-trough not write-back.
I just suggest this as it seems like a much more tried and true solution.
Eric
| |