Received: by 10.223.185.116 with SMTP id b49csp656401wrg; Fri, 16 Feb 2018 05:11:11 -0800 (PST) X-Google-Smtp-Source: AH8x226YfBiqd1rX4+bukocHs37h3w1q537nFx3ZsTcJ3BpTwCnojrEtJ43WjGVJZ9fFjCU9u/yH X-Received: by 10.99.131.198 with SMTP id h189mr5217692pge.25.1518786670926; Fri, 16 Feb 2018 05:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518786670; cv=none; d=google.com; s=arc-20160816; b=LOo7dElDgN1zm5Gj2UoOYUUKGcFWdmgiGw3z/CkTOwIWYIUWdwPkS8cfskkhGPoRWV 6yxmaBlk/qQm9BgzvOQU3RpVu7rsiaGwYRf9meCzBW+Wcbq7EOUTZ/1gATgdgQcHluiC Iw/K2zJXbvile60yyAoIin7FjJnzpjk5dOvH3MbfCIaWwxHUfDmHOW7b9az8Zfr85WCX wodKXOiXbSi0FFui1j7iftvSgz8+ffEatJuMpq5F9H8EvjDMKOCzLSoR5HkWPIS2Ux/I sxb5ZznDdIiNZYmf94URaxIYHSkzGClJ5rhAFplTnSn6Jpn2jskNn62TiF+Qi5Z3gFmx oV+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=IvDI9GVUCkGhvYS904d289nh9Pwf9+kS6x0eCq19+sw=; b=MFFNgUsJyO/TlQplzLNs0WVZvL3aPmZ1dK630JvWgPB6K6nbwLSbpDKxmeuUA4hPPe lTCfG+OjGwtNOc5iXNdN1q5D14j2idmnfi3gy420xHY/XxNt1Cxfrfn3sWLyApEtqwTh 1CihukiYi2KoyZLoEiGC+wN4g7VagsDpdc5zB9CfIIsTt6s95xX+OF8hYadzu8Avw9ch oC/6wOr8pZ87CWaC0MypcN3gS1jqyJTDkZYYjZA0Hf+6W6mmbPuC28j+eMf1004DCyaf gInrQerfUpSf0jQK+7vTlBAR0bmoQBspZ0+u0fTm3ZOZv047XGWhyKVybPJcDN5OCBQF pDHg== 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 k6si1279945pgo.818.2018.02.16.05.10.54; Fri, 16 Feb 2018 05:11:10 -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 S1166364AbeBOSWo (ORCPT + 99 others); Thu, 15 Feb 2018 13:22:44 -0500 Received: from mga14.intel.com ([192.55.52.115]:3049 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1166314AbeBOSWJ (ORCPT ); Thu, 15 Feb 2018 13:22:09 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2018 10:22:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,517,1511856000"; d="scan'208";a="35068986" Received: from jbkonno-saint14.jf.intel.com ([10.54.30.229]) by orsmga002.jf.intel.com with ESMTP; 15 Feb 2018 10:22:08 -0800 From: Joe Konno To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ard.biesheuvel@linaro.org, matthew.garrett@nebula.com, jk@ozlabs.org, ak@linux.intel.com, tony.luck@intel.com Subject: [PATCH 1/2] fs/efivarfs: restrict inode permissions Date: Thu, 15 Feb 2018 10:22:07 -0800 Message-Id: <20180215182208.35003-2-joe.konno@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180215182208.35003-1-joe.konno@linux.intel.com> References: <20180215182208.35003-1-joe.konno@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- fs/efivarfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 5b68e4294faa..ca98c4e31eb7 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -145,7 +145,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; - inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0644, 0, + inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0600, 0, is_removable); if (!inode) goto fail_name; @@ -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; -- 2.14.1