From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbeBUTrj (ORCPT ); Wed, 21 Feb 2018 14:47:39 -0500 Received: from mga04.intel.com ([192.55.52.120]:23493 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbeBUTrg (ORCPT ); Wed, 21 Feb 2018 14:47:36 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,375,1515484800"; d="scan'208";a="32537889" Date: Wed, 21 Feb 2018 11:47:32 -0800 From: "Luck, Tony" To: Andi Kleen Cc: Linus Torvalds , Ard Biesheuvel , Joe Konno , "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Matthew Garrett , Jeremy Kerr , Matthew Garrett , Peter Jones , Andy Lutomirski , James Bottomley Subject: Re: [PATCH 1/2] fs/efivarfs: restrict inode permissions Message-ID: <20180221194731.t7jowrmicvaggu3x@agluck-desk> References: <6680a760-eb30-4daf-2dad-a9628f1c15a8@kernel.org> <20180220211849.fqjb6rdmypl6opir@agluck-desk> <20180220233008.55rfm7zw62hrao5p@agluck-desk> <3908561D78D1C84285E8C5FCA982C28F7B37DE1B@ORSMSX110.amr.corp.intel.com> <20180221182104.GI3231@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180221182104.GI3231@tassilo.jf.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 10:21:04AM -0800, Andi Kleen wrote: > > But it should be fairly easy to just add a 'struct ratelimit_state' to > > 'struct user_struct', and then you can easily just use > > > > '&file->f_cred->user->ratelimit' > > > > and you're done. Make sure the initial root user has it unlimited, and > > limit it to something reasonable for all other user allocations. > > How about uid name spaces? Someone untrusted in a container could > create a lot of uids and switch between them. > > A global rate limit seems better. While in theory it allows DoS > it's probably not worse than a lot of others we have with > other resources, and it's relatively harmless. The EFI calls are all about checking system configuration. A thing that only a handful of users do on a very occasional basis. I don't see much harm if my "efibootmgr -v" call is slowed down a bit (or even a lot) because you are using a bunch of the available ratelimit reading the efivars. Per-user seems over engineered to solve this problem. -Tony