Received: by 10.223.185.116 with SMTP id b49csp34566wrg; Tue, 20 Feb 2018 15:20:15 -0800 (PST) X-Google-Smtp-Source: AH8x224Pl53SmHgnvgvRSaYwQYJfxjnPPdyRVF0gHrB2rVBXfCwb0fBiq9txA0aC5S9E1ilb0qD0 X-Received: by 10.101.92.6 with SMTP id u6mr1006620pgr.440.1519168814912; Tue, 20 Feb 2018 15:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519168814; cv=none; d=google.com; s=arc-20160816; b=JrWIKo6dce6TbZppk1Lty68y5ZjIu2c0TFBNLcuBSI+wmpnrkizIezee9Rp2m87Br6 i2E48vdhnmN+VE22wTJIHkFmahKC4pBGScmVnxuFo+7AVNszffzCuY+c4X3/UxVRmE9s hCxt4arYc5YcG9kpsncPyvUppnxAzgrHBgbQIIDV4SKd5T3yP2hbDyN84ha9ckFlQIAq aVmYQhtApbg8Rn9qc9o32umAFbD23/BgEbiVAVqDBH2eHxMUuNPIb/5JlMZfJDLsKjrP 8X8kIknlsDC4gJsLIMiXPyUbdjWNcjfv2eDRM0VJqOHSbN6qM0nQVuncDgEaAGspnWvT 5nxQ== 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:dmarc-filter :arc-authentication-results; bh=fOvF7o2xNqTtE/4ncuIufmSxuKNOURHZYMcRXK7X9cU=; b=FLta8+KmaCQ+7EPZoDzOqaqHRszHFQimbvVfhswfYXPanBkebQvfX8zjFgIFiw5Nfy pduZVsBj2gUmgNeToIMb++EQdMqrLSztJ/u9ODLTdLDpkEvGaClXVxrLRxNnWiBRyXAK fhDSjqu9vHLeDYgAZJEhEQwlI7YCVaxUpUbjGFcEQbG3UZfiWt8mtFO9crxyEv0lFIkl qyiSlQgcraAZpbQkycfJCo0bWpjVN/Km/q5AoUIfECPIom3P0LEN+R2hIechvtcQ+WER xDlBEIGDIpwvLITI585Mvug3aE1MB9VQ6RhtYd4kE5x3C7U7twaKgWLpkpcJNwq3YXYu ufIg== 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 f13si1406142pgn.155.2018.02.20.15.20.00; Tue, 20 Feb 2018 15:20:14 -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 S1751876AbeBTXTZ (ORCPT + 99 others); Tue, 20 Feb 2018 18:19:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:40620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779AbeBTXTX (ORCPT ); Tue, 20 Feb 2018 18:19:23 -0500 Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09F33217A4 for ; Tue, 20 Feb 2018 23:19:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09F33217A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-io0-f171.google.com with SMTP id u84so129035iod.9 for ; Tue, 20 Feb 2018 15:19:23 -0800 (PST) X-Gm-Message-State: APf1xPA/y6HH9I9AYFL36XuXfZpqw+HXf4UntJ+/gQO0LmKKTEheKs2T AN9px5rXJ7K8v7HLQ9cQeN9t/koBblkjIo7EoSI79A== X-Received: by 10.107.69.7 with SMTP id s7mr1796347ioa.6.1519168762328; Tue, 20 Feb 2018 15:19:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.137.101 with HTTP; Tue, 20 Feb 2018 15:19:01 -0800 (PST) In-Reply-To: <6680a760-eb30-4daf-2dad-a9628f1c15a8@kernel.org> References: <20180215182208.35003-1-joe.konno@linux.intel.com> <20180215182208.35003-2-joe.konno@linux.intel.com> <6680a760-eb30-4daf-2dad-a9628f1c15a8@kernel.org> From: Andy Lutomirski Date: Tue, 20 Feb 2018 23:19:01 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] fs/efivarfs: restrict inode permissions To: Andy Lutomirski Cc: Joe Konno , linux-efi , LKML , Ard Biesheuvel , matthew.garrett@nebula.com, Jeremy Kerr , Andi Kleen , Tony Luck 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 Tue, Feb 20, 2018 at 7:18 PM, Andy Lutomirski wrote: > On 02/15/2018 10:22 AM, Joe Konno wrote: >> >> From: Joe Konno >> >> Efivarfs nodes are created with group and world readable permissions. >> Reading certain EFI variables trigger SMIs. So, this is a potential DoS >> surface. >> >> Make permissions more restrictive-- only the owner may read or write to >> created inodes. >> >> Suggested-by: Andi Kleen >> Reported-by: Tony Luck >> Cc: Ard Biesheuvel >> Cc: Matthew Garrett >> Cc: Jeremy Kerr >> Cc: linux-efi@vger.kernel.org >> Cc: stable@vger.kernel.org >> Signed-off-by: Joe Konno > > > The discussion in this thread has gone on too long, so: > > Acked-by: Andy Lutomirski > > And yes, this patch will break a couple of minor usecases, but IMO those > usecases deserve to break. Alternatively, a patch like this (untested but straightforward) might be a little more effective and easier to undo in userspace for anyone who may be adversely affected: diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 5b68e4294faa..88c7163c0ac1 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -207,7 +207,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_d_op = &efivarfs_d_ops; sb->s_time_gran = 1; - inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0, true); + inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0700, 0, true); if (!inode) return -ENOMEM; inode->i_op = &efivarfs_dir_inode_operations; If you prefer that, I'd be happy to re-send it for real. --Andy