Received: by 10.223.185.116 with SMTP id b49csp2170579wrg; Thu, 22 Feb 2018 09:11:48 -0800 (PST) X-Google-Smtp-Source: AH8x227i24sdW3n1oEbJ5sIBWlt6CyBX1uHGX0Fv/x/Q5MdwtiHaN0hTzVB7N2TV5unDGkGj5bLs X-Received: by 10.98.15.137 with SMTP id 9mr7564707pfp.216.1519319507901; Thu, 22 Feb 2018 09:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519319507; cv=none; d=google.com; s=arc-20160816; b=ccxrCMkljOcqjmWnjfpL3oTXRB+nG3s1IHlxiD6xxYIzO8iGBYbXQIf4IVBpCzvqYI PeFJWqKkrwhd0kn1j+grJJGgV1eIBSYgScTswkRZjm81ApMa+eNwIv5tmmfsRfvjnSex pl4Vij1ekGgHt7u2OWz7gV6cdIgxFffm2AYwRqyWWR3QWqiPNkyVK4tUHp2jK3NAc69R mwSBiKwzUIzE5+shaAiKzcbWo+Hry5hkvMv9Zml6/FuNIXiPMnb3jMApSS81rJq4cwC6 79e7NTYnwsGBqqEA4gUOIL7AOjn3RwNjuBdLMZpQEidr+nGbc/P8E6PzoTbpkHucLQHH JEXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=mHq4g+UjAI19kL1ES968QGYLZCA41jqvh1m9NZgwrw0=; b=lpc8ppLL3VY4/EUERP382N/jMmnOKAFcBx7hyMZTOv53nsaAQNUPnq+D5XMDpYy2L5 zQZHNSwSpq9YxmQOkotN8qRE5Kp+Tszjg/2UGJb5whtaoLHgE5jgq00Mi7OqOxz4lpih TwI+/G6mvkUWo63lbbYieGFlzy1wPTCoB3FS2p6pkB13K5z08boZ5TeD1vMF3Qnkpj/K 3LINmlFMaVw9vudjBw6t07/YMYom7prP4PCGxxlnH/RB6EifQBg574Mnda+S1YGv7hki 4A0Z/UUfWpH9F6HYRVSAi7MxbuzxSpoc6JDfcJG0VYgPuMdhrM7hOKCEp5S8Cc6oiNRv 7lAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si270800pgf.585.2018.02.22.09.11.31; Thu, 22 Feb 2018 09:11:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933388AbeBVRKy (ORCPT + 99 others); Thu, 22 Feb 2018 12:10:54 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:36834 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933148AbeBVRKw (ORCPT ); Thu, 22 Feb 2018 12:10:52 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eouOR-0002E9-5H; Thu, 22 Feb 2018 10:10:51 -0700 Received: from 174-19-85-160.omah.qwest.net ([174.19.85.160] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eouOQ-0002ZY-8o; Thu, 22 Feb 2018 10:10:50 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: "Luck\, Tony" Cc: Linus Torvalds , Andi Kleen , Ard Biesheuvel , Joe Konno , "linux-efi\@vger.kernel.org" , "Linux Kernel Mailing List" , Jeremy Kerr , Matthew Garrett , Peter Jones , "Andy Lutomirski" , James Bottomley References: <3908561D78D1C84285E8C5FCA982C28F7B37DE1B@ORSMSX110.amr.corp.intel.com> <20180221182104.GI3231@tassilo.jf.intel.com> <20180221194731.t7jowrmicvaggu3x@agluck-desk> <3908561D78D1C84285E8C5FCA982C28F7B37F130@ORSMSX110.amr.corp.intel.com> <20180222014505.2l76ccrrs36y3b26@agluck-desk> <3908561D78D1C84285E8C5FCA982C28F7B37FE28@ORSMSX110.amr.corp.intel.com> Date: Thu, 22 Feb 2018 11:10:22 -0600 In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F7B37FE28@ORSMSX110.amr.corp.intel.com> (Tony Luck's message of "Thu, 22 Feb 2018 05:34:01 +0000") Message-ID: <87efld9cht.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1eouOQ-0002ZY-8o;;;mid=<87efld9cht.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=174.19.85.160;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+SH4lVWd+sdbEzi/x8Cr0Pa0VcasA5iVs= X-SA-Exim-Connect-IP: 174.19.85.160 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4950] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;"Luck\, Tony" X-Spam-Relay-Country: X-Spam-Timing: total 188 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 2.8 (1.5%), b_tie_ro: 1.89 (1.0%), parse: 0.76 (0.4%), extract_message_metadata: 9 (5.1%), get_uri_detail_list: 0.79 (0.4%), tests_pri_-1000: 5.0 (2.6%), tests_pri_-950: 1.17 (0.6%), tests_pri_-900: 0.99 (0.5%), tests_pri_-400: 31 (16.5%), check_bayes: 30 (15.9%), b_tokenize: 6 (2.9%), b_tok_get_all: 14 (7.4%), b_comp_prob: 1.70 (0.9%), b_tok_touch_all: 7 (3.8%), b_finish: 0.52 (0.3%), tests_pri_0: 129 (68.7%), check_dkim_signature: 0.46 (0.2%), check_dkim_adsp: 2.7 (1.5%), tests_pri_500: 5 (2.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] efivarfs: Limit the rate for non-root to read files X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Luck, Tony" 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