Received: by 10.223.185.116 with SMTP id b49csp1624633wrg; Sat, 17 Feb 2018 01:37:56 -0800 (PST) X-Google-Smtp-Source: AH8x224HYsShnYphspwtRgFpCy0BAY9mz+pMO+Z+MpdgysiGlNG7UngJJcIwSPiuwXHdcbndoISc X-Received: by 10.99.122.70 with SMTP id j6mr4319056pgn.17.1518860276357; Sat, 17 Feb 2018 01:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518860276; cv=none; d=google.com; s=arc-20160816; b=nRN2zZQE5qZM4+BLMRcR9j9d7HWqFEsJKbJsinuo9M67giO2WhiE0Y2QBcuBb02SDG R0ajY7Mv41oN19d0yh8uNnbFtrbsEtuAjv2ajHGn9b0pZI7eZOILBAoa3RYCL6GU3WI8 My4ot2IBs7uq4TpeZzJ88m1v7vyKjeU1+O9uywyTeGFqO2xRaDhdMdwVJGsHumwPuGjX y/y76qpNphpfcHu9KrdT7UTtDApuP1eVuUB/gbVG+80uSsfxuGbDPZci6GgID38Q7GVk igZrhtL0hPlnMjAH15DcciOe+4G7knPNMjGCIp5VV35RcTb6dcK53DfpXQ39D0kDb+de 2HHQ== 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=pHCeN31CZtHHZBiDDaA2gPU2fN4mlAmz3Fv/BgH1ZpE=; b=g82B6SS5qopp7hjgwz/AgGfVdkB/RXwAmYplxB+pbu3NWxCNIz54ThjOGKTnRAhalq GZ1A6rr3KI7b1SAuZ+DVdPI7fwgjWR+rXeb5+FoykKqqdtwgpWOPI8WsdoaFIcCo2vPo o7s8sb/pqiaqmKRZNTWRQ0UdN3cUY7WmFCTBLjLNK+Ee6aQwjpbzJULr70u7taaCwLo4 gRBbwcWAj7O1e3R567cKvfzD3mZzYVPVNJArE0GPHo92qgLNcANWsQX3qDHy+8FxGHyi C4Tjqg+8S6W0O3OPRc5wrECZ0dQUxYGbhT+p3qmd+5pEHCIib4ip050/cCzvyad5EEvq RI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JeZAcZlh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d76si6805834pga.329.2018.02.17.01.37.40; Sat, 17 Feb 2018 01:37:56 -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=pass header.i=@linaro.org header.s=google header.b=JeZAcZlh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751076AbeBQJhA (ORCPT + 99 others); Sat, 17 Feb 2018 04:37:00 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:35181 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbeBQJg6 (ORCPT ); Sat, 17 Feb 2018 04:36:58 -0500 Received: by mail-io0-f195.google.com with SMTP id 30so1388954iog.2 for ; Sat, 17 Feb 2018 01:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pHCeN31CZtHHZBiDDaA2gPU2fN4mlAmz3Fv/BgH1ZpE=; b=JeZAcZlhb61jb6/ELmKqKCBftP7LwZa3Mub282piiC3dvDYglZ/I8snN/uO7icT9B3 oFZs+1Tb7J0oYqdPWTrjJQP9cS6Il+UUJ9OoYo7pbLtlwVcRqGPqu0qAy7MuuMYOj+oq gV6NT5gIoElwqprqSUWfDqpFWfXFX2qWZgiRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pHCeN31CZtHHZBiDDaA2gPU2fN4mlAmz3Fv/BgH1ZpE=; b=e4p6fouI/CXpnonzmCFX9LgOC1Gusj2RMBcREFp9VE3iJhLQmLGE46N4YQdG086lcQ bhuymjY877sTio4yTHZGDFof1gd0FBFU+kx1b0dovkI8XrjGyRgNzkOQsBhZt2QvWx9o YIh8+rUVwns+4ANfs+HmEDqT2laUclUVQ8jm0onhbR4vQkRhHnzwl7aDckDQc8Bjh00q /zaj67bQO99elmV/CEopIa42ZQRF9pw7hyucDFeg9/IpEMaXhjkJ/3Db5p5uEydpCCeu ku5+3RQDTBpje2ipfWl7glmHwoFKrdvXfQhbL0ZFb3o9wfenOULpZY4R0gWXAVCxG1dO HRJQ== X-Gm-Message-State: APf1xPALqX/m5L53a2P/00kfFij41BPKSfOSOn2Qiv3SpjOuZUFTNwzt sWKvtO/vVdXcWrutSp7VnacJ3LuZQHjiFtUvR9Z/tA== X-Received: by 10.107.140.86 with SMTP id o83mr11686499iod.127.1518860217746; Sat, 17 Feb 2018 01:36:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Sat, 17 Feb 2018 01:36:56 -0800 (PST) In-Reply-To: <20180216220536.liew4p4kqmaxwmfh@redhat.com> References: <20180215182208.35003-1-joe.konno@linux.intel.com> <1518814319.4419.10.camel@HansenPartnership.com> <3908561D78D1C84285E8C5FCA982C28F7B37942B@ORSMSX110.amr.corp.intel.com> <20180216220536.liew4p4kqmaxwmfh@redhat.com> From: Ard Biesheuvel Date: Sat, 17 Feb 2018 09:36:56 +0000 Message-ID: Subject: Re: [PATCH 0/2] efivars: reading variables can generate SMIs To: Peter Jones Cc: "Luck, Tony" , James Bottomley , Joe Konno , Matthew Garrett , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Jeremy Kerr , Andi Kleen , Benjamin Drung 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 16 February 2018 at 22:05, Peter Jones wrote: > On Fri, Feb 16, 2018 at 09:09:30PM +0000, Luck, Tony wrote: >> > That said, I'm not sure how many non-root users run the toolkit to >> > extract their EFI certificates or check on the secure boot status of >> > the system, but I suspect it might be non-zero: I can see the tinfoil >> > hat people wanting at least to check the secure boot status when they >> > log in. >> >> Another fix option might be to rate limit EFI calls for non-root users (on X86 >> since only we have the SMI problem). That would: >> >> 1) Avoid using memory to cache all the variables >> 2) Catch any other places where non-root users can call EFI > > I could get behind that as well. Currently the things I maintain do > approximately this many normal accesses with invocations you can do as a > user: > > "efibootmgr -v" - six files we always try to read, plus one per Boot#### > entry. > "fwupdate --info" - one file it always tries to read, one file for each > ESRT entry. > "dbxtool -l" - one file it always reads. > "mokutil --sb-state" - reads the same file twice. I don't maintain > this, but I'll send a patch to Gary to make it > only read it once. AFAICS all of the other > invocations you can currently do as a user > /legitimately/ read two files, though. > > Some systems seem to *love* making a pile of Boot#### entries; I think > the most I've seen is something like 16. So on that machine, one > "efibootmgr -v" invocation is ~22 efivars files read. I've never seen a > machine that advertised more than 2 ESRT entries, but maybe we'll get > there some day. > Would rate limiting (but not only for non-root) help mitigate Spectre v1 issues in UEFI runtime services code as well? I have been looking into unmapping the entire kernel while such calls are in progress, because firmware is likely to remain vulnerable long after the OSes have been fixed, and we may be able to kill two birds with one stone here (and not break userland in the process)