Received: by 10.223.185.116 with SMTP id b49csp2649565wrg; Sun, 25 Feb 2018 02:58:28 -0800 (PST) X-Google-Smtp-Source: AH8x224hZq+7Squ+cR40JD8RaloPFqWhazP79s5Yu8jJsjjcKz7gHi/iwPBhlPgaPW+sqgOdNnQ/ X-Received: by 2002:a17:902:225:: with SMTP id 34-v6mr7270173plc.415.1519556307965; Sun, 25 Feb 2018 02:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519556307; cv=none; d=google.com; s=arc-20160816; b=EKfIzlXbTyjkBGYwgXD+KYWHP1YrACVGbzLZpwN3ORFvDV/o2iIQ52ONyrBwaLETZD a8dgRiIf4wSJ+5Axdb0IOIYMBmOKqdWplfVWZWSpYqSjNWLkQzmZayWSZZNEv46zXgTL FOWaVR96Rea2bd28FvZsktcSD57Cbmf3KBIo8e3P4SLO08KkYvgznPfohk4oM/gTCOcv E0i1qEa8bxmklF0heMaFxOqnXG+/zp4zTEGh652GJO+R3/Kbt6Emi9FB9raLWnWn+kqk JWyN5mfWNiH1/oSS0sZmkHGwMbTMUI45/ghXttlAdNDLwJIMsIDEWfE8Y7/fC8DD5fUy hA1A== 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=vWAKiagScFA8GrZKziUKG7G6VxiH3gWjoemAwAorAfw=; b=vQqp8uP8YxgR5COWZRY/cM5vYala+xM47Kwz5dBFDbRKgQErVrlKhNnLnN27Ep0hi7 0MxRDXlLLhGafbmKmXiQMTSc/KhjOyPa896G48W9of5Lj0BlQY16uUFBVJrN6xgVbilt q0vg7+j224JtBrjecnirwoXc4dgWKqxz/4oaKnsd0Zy8dbnAphnvW9M7Tj/lhiVH6NUV 90BdLylB8gS0g3DDFTEAcWxgF7Ofxs6BcLPCbv20I31AD34BU2ps+ss3jfu/qdNMs1Se aM12TpCn3wNTpdGJjtCJXxbOGP9YzmDXgYDUn7Tqg1MCoYxvlLKk76iEQhLJtwA2a/c3 oxrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1oPiNA+; 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 59-v6si4939591pla.203.2018.02.25.02.58.13; Sun, 25 Feb 2018 02:58:27 -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=N1oPiNA+; 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 S1751658AbeBYK41 (ORCPT + 99 others); Sun, 25 Feb 2018 05:56:27 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:51137 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbeBYK4X (ORCPT ); Sun, 25 Feb 2018 05:56:23 -0500 Received: by mail-it0-f67.google.com with SMTP id a75so7678009itd.0 for ; Sun, 25 Feb 2018 02:56:23 -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=vWAKiagScFA8GrZKziUKG7G6VxiH3gWjoemAwAorAfw=; b=N1oPiNA+PfXpFAUXv4O9STGXgLNAsTtGJ1bAhFWl24cOG/lWJojPwCTY3h0o9xMFkd Mf3p2j2m2T5ojFwFSQvVdihoJzF6jxzyys+TkfqjnulMbtSaVc5IX6qlzthiEpq9cZJl UvIoZ0tW9ktu9UjJ8IM05y2hbIlBDyYvzHyRo= 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=vWAKiagScFA8GrZKziUKG7G6VxiH3gWjoemAwAorAfw=; b=QZHBZcMIBeaCmBDaPWTMxsCFnnBuZRDutnNO0dGeuo6seqtokWISDRBtUKZVdI+d8m OFYfxU1DPZnkNgn5WbSIPhuymGGuPgRK3wR7AtuVA4vwB02uOBJLDuCpadnRlwqpWUrn jivlUyRXcZHsxaQcFxO1gq2HSUyHOhONDt05daFp8zQB8Wz5AGJrNmNE3t9Er74Kxktq YaKsEb78pYH73LhMIbpyK2iCYFevt2LnBKmwxFy4ZW1sQF4KAWkJDnA12/yYRkam+NYQ cwJ0tX4naWO5Bd6dda6xLQPC8ik2MUlmlmHeDTfZplUDUNgbG0KBD5Kcfh7NYmwGuH2H 7mhw== X-Gm-Message-State: APf1xPDOFEWQ12C8Rn7nQr7vd+MqxxkrCUKDYB3qAc+xzR6TIMiaBegX rbEuptv6SwaMZt+xKPc28ByDi9QFXwnSdqRdefcUvQ== X-Received: by 10.36.90.5 with SMTP id v5mr8789697ita.138.1519556183072; Sun, 25 Feb 2018 02:56:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Sun, 25 Feb 2018 02:56:22 -0800 (PST) In-Reply-To: <20180224200617.75cfe5f2@alans-desktop> 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> <20180224200617.75cfe5f2@alans-desktop> From: Ard Biesheuvel Date: Sun, 25 Feb 2018 10:56:22 +0000 Message-ID: Subject: Re: [PATCH 1/2] fs/efivarfs: restrict inode permissions To: Alan Cox Cc: Linus Torvalds , "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 24 February 2018 at 20:06, Alan Cox wrote: > On Wed, 21 Feb 2018 09:03:00 +0000 >> 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. At > > b) doesn't make spectre v1 much harder alas. What matters there is that > you turn on the right CPU protections before calling into EFI and turn > them off afterwards. EFI firmware internally isn't built with retpoline > anyway. > Well, that is exactly my concern. The parsing code in the authenticated variable routines in UEFI may well contain sequences that are exploitable, due to UEFI's heavy reliance on protocols involving function pointers, and the fact that a variable update is structured data (with bounds that may need checking). Also, this code is highly likely to remain unpatched on many systems, and it usually appears in the same place in memory regardless of KASLR. However, only root can call SetVariable(), so perhaps the risk is limited after all? I had a stab (for arm64) at unmapping the kernel while UEFI calls are in progress, which is a fairly big hammer, but effective, given that UEFI itself does not keep any secrets in the first place, and so if the kernel isn't mapped, there isn't anything to steal to begin with. Note that on arm64, Spectre v2 should not be a concern, due to the branch predictor maintenance that takes place when entering the kernel. But Spectre v1 in UEFI runtime service code is currently unmitigated, and I wonder what the risk level really is.