Received: by 10.223.185.116 with SMTP id b49csp1051557wrg; Wed, 21 Feb 2018 11:13:36 -0800 (PST) X-Google-Smtp-Source: AH8x226jqwk5+Fb/cqx+vHViL7WF+iAnve0w0VVZXoPR3HyWu5fBT0AwU9XDLVz5zRvwFvmgxvl5 X-Received: by 2002:a17:902:6a0f:: with SMTP id m15-v6mr4012266plk.379.1519240416614; Wed, 21 Feb 2018 11:13:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240416; cv=none; d=google.com; s=arc-20160816; b=g/BLx2Dp9lYBhT+hGVIu2KnCBDmEaKssWmHV+ezGYYMbwctczKtr5hBK8sY2XM5sv4 rh2qyCwB2YCUtZep9uYe6CNA/Z96ibKTyR59gknOD8K6juIX57nqGZP1wU1LUt0sn+lc Uyj9Sh5Whie0XssTBC8UvRSjOzcvVWLrkDrlGIY28TEy0GzSFzp3HZWryDUi2KHgLwiM zKOyqozM5mG7QVvqfGeYncN+KJ89+4iYQkfvMjB/ifuwT0RZPt/mdxCPNaS0PMNkkroj htbGAfcyAArVlpFXYXS9/r5KNsrm+DQVyCMvzvdsB7WoYdvyHU/TSOXX8XfOMuXISgiA qyRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=aV/Et3nbmXb9kEBiLedB3zORQOrTb0/o2NCZ2tcAfrk=; b=GrhZPjXuW0Hbu1o3Grp4eLI2hDWI10tb0LLYHwLZV0UJvC3LaIPpffQQnCRosNdQ1e zyU6ZmSgw4z1cakx6y7d6NfMwNWWHT38ThaS4X8Lleb1+KZn3g53oA4W85PHzR0oxmtG 7aTUgjTuPAb2JuPl8Qqucde2RSlbWw6ZMGroCAdIdEx3oIbN1GTEwygcNgWpZsuYfgTY MZHQqYYeKsc/OSEq0g+0TITJJTSIXAShtzwHif61BC4If2zrYjmgf1bzjocQaHRaQPsc FhOqlUJ2vuZ1/u7C+LP1YHCXZHaUftkShVS7q0sB9diBW5B7WfeFOt1w7oxgJpy8pxkD dMtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=b3ABI5i7; 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 f8-v6si6747990pli.188.2018.02.21.11.13.22; Wed, 21 Feb 2018 11:13:36 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=b3ABI5i7; 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 S939032AbeBUSC1 (ORCPT + 99 others); Wed, 21 Feb 2018 13:02:27 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:34328 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938969AbeBUSCY (ORCPT ); Wed, 21 Feb 2018 13:02:24 -0500 Received: by mail-io0-f176.google.com with SMTP id e7so3069937ioj.1; Wed, 21 Feb 2018 10:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=aV/Et3nbmXb9kEBiLedB3zORQOrTb0/o2NCZ2tcAfrk=; b=b3ABI5i7K/W8MRCRoFVj75uTdpAVcqoBgRAM4IqFv6f7E/UUgEH7UuzRyWVUXlTW3O oaoO28ZNkCleVof9Ih+Gon+GE5NLJQO6G6CxwEdGtdEDWpCLo1GHK3ZSKswFoN/mCGyF nd2YLp1n4gqqT/HLU5gCpDHpEadYARbCC/CQYy9egv5kvWfX8niIdvEcbjQExaz+hJXE VlWwEAUsaESDsbJgJW5uxgIRKhKLyYZUjgyIdP/ZHT23LobUCywPSdemJ4/kSdch/iRW mgKV6Br4OC6xOy8FBtKGt989kvT+TgtpPLEnHBV/sxcglPecEWzl5Zpwk7mEzA8EQ7Nn 0uBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=aV/Et3nbmXb9kEBiLedB3zORQOrTb0/o2NCZ2tcAfrk=; b=U1v9qFtyK5uUIFk52916nDpjYmH+k650gmUXWdI7i2wZqV/qv+iBqMHvFW8IjeK0KN mwtCcUZP/Th1ZFJzyWm2aBdYuZewCK19aaZpPeRDuNfPwPvsX0z7Hlq/pifUKQn6ddan nJQgXU4fjdP6tLOP5scIJoXHj1h4xLL0B6FYac7lzCPseB7w94itd9DYpgyijk/KL1+R KO5L6jLSGAGfJ3Mq+gU2gBJ6+rHGVhOgWryBj9Uva8wlas1czhiL0hw2FIpFR8RNnF4e feoRMEtb57gB0fRXxqONHv/iCTO4ppZZD/GrNBMChWOr3RnhqEo2Ga+kDqlDDCSJVZPE jZwA== X-Gm-Message-State: APf1xPC0zKvYBVvBADVnzv+YfIAZzff46LKJieV+9NvyXwO04kI/WDcU Cf5ZdbUl5RiiqZ4e9NWsSOdm6hPc5fdEdsZnXVc= X-Received: by 10.107.22.1 with SMTP id 1mr5450492iow.238.1519236143831; Wed, 21 Feb 2018 10:02:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.135.221 with HTTP; Wed, 21 Feb 2018 10:02:23 -0800 (PST) In-Reply-To: References: <20180215182208.35003-1-joe.konno@linux.intel.com> <20180215182208.35003-2-joe.konno@linux.intel.com> <6680a760-eb30-4daf-2dad-a9628f1c15a8@kernel.org> <20180220211849.fqjb6rdmypl6opir@agluck-desk> <20180220233008.55rfm7zw62hrao5p@agluck-desk> <3908561D78D1C84285E8C5FCA982C28F7B37DE1B@ORSMSX110.amr.corp.intel.com> From: Linus Torvalds Date: Wed, 21 Feb 2018 10:02:23 -0800 X-Google-Sender-Auth: LRT0A9g4caPug-rm9yKIuCWfXfA Message-ID: Subject: Re: [PATCH 1/2] fs/efivarfs: restrict inode permissions To: Ard Biesheuvel Cc: "Luck, Tony" , Joe Konno , "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Matthew Garrett , Jeremy Kerr , Andi Kleen , Matthew Garrett , Peter Jones , Andy Lutomirski , James Bottomley Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 1:03 AM, Ard Biesheuvel wrote: > > The thing I like about rate limiting (for everyone including root) is > that it does not break anybody's workflow (unless EFI variable access > occurs on a hot path, in which case you're either a) asking for it, or > b) the guy trying to DoS us), and that it can make exploitation of any > potential Spectre v1 vulnerabilities impractical at the same time. I do agree that ratelimiting would seem to be the simple solution. We _would_ presumably need to make it per-user, so that one user cannot just DoS another user. 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. So I think a rate-limiting thing wouldn't be overly complicated. We could make the rate-limiting be some completely generic thing, not tying it to efivars itself, but just saying "this is for random "occasional" things where we are ok with a user doing a hundred operations per second, but if somebody tries to do millions, they get shut down". Realistically, even root is fine with those, but letting root in the initial namespace be entirely unlimited is obviously a pretty reasonable thing to do. So it might be a few tens of lines of code or something, including the initialization of that new user struct entry. I think the real issue is testing and just doing it. Anybody? Linus