Received: by 10.192.165.148 with SMTP id m20csp4955714imm; Tue, 1 May 2018 06:50:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrJlSkTr4C4Y4K3nOgH0uYkxaL6ozANoP7yn2Py4jn435mKApECMsX83oh4MN9CxXLBfXAU X-Received: by 2002:a63:6d81:: with SMTP id i123-v6mr13004726pgc.319.1525182655292; Tue, 01 May 2018 06:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525182655; cv=none; d=google.com; s=arc-20160816; b=NCO5lvFbTkqkB3N+0cL+neTvf0HsoQIjk1k5dtcF7Qc3cY3dXAdNPkWvhWv/zWJGHY gYOdt8PdLW8JVeMkneap+a9UQmUKrN7g+tsv655EY47NzNAzRxDc1sIPIclltYTW44Td Gjup/Bs2QtMAMT9y68AZTB/WjfVX6czhy3Tqkk4mn8Une9E9k7Np9qov9kajA0hycr6V 4N9puJyqjGRNT8PV9YJtlnFjCm6zLHw/vpki9c6qgL3lRS5QNWUfDB9pAR9TkpqA/TSz nVgjE9ZtIf0mpGajjThAZ7c3q7hMBkF+awtWRSJB2ebeiocajs0DCzPuwFuRTnLjmrhT wRoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=3RcPs63QSCFpZcXaz/Vc1PKq6kbchUFKul2YTgwCtAk=; b=jXnFaX2JIUPtLtcVXhfkJQQMZImhaaFV7eWo4QXK8ET+/dpmmnr9CfeLmcWE+8p5yp U+mhMTVS/Z93Yid84c0Pw5xpkI9bt8hCV7LoaJXlTIHQ0SMzzyMLNX3/2X1urAaQ5JNi zwtOqv/5n+iC9WBROiKBuRE/NXBiFWjTCr4D0KE6shH46SA2TZE7VrXA0l/NNDMGKUrC M6Ut+uyqAbKXn/yCR/RQHtt2xb7BhRIHu0uNfz4o1mVDl7Hfh0rP7INxVTLsOT3Mr8hg Ko6GC2XavVoT6qgJGp1xNHt2rkreForHbxzsmunBXvYqabd9fc1x7bTMznjWfVKCn3S0 IBFA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x28si9813991pfa.37.2018.05.01.06.50.41; Tue, 01 May 2018 06:50:55 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755955AbeEANuJ (ORCPT + 99 others); Tue, 1 May 2018 09:50:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41522 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755507AbeEANsn (ORCPT ); Tue, 1 May 2018 09:48:43 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w41DiWmE132449 for ; Tue, 1 May 2018 09:48:43 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hphst6d01-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 01 May 2018 09:48:42 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 1 May 2018 14:48:41 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 1 May 2018 14:48:37 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w41DmbGi8323492; Tue, 1 May 2018 13:48:37 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 718414203F; Tue, 1 May 2018 14:39:50 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A23442042; Tue, 1 May 2018 14:39:49 +0100 (BST) Received: from localhost.ibm.com (unknown [9.80.105.194]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 1 May 2018 14:39:48 +0100 (BST) From: Mimi Zohar To: linux-integrity@vger.kernel.org Cc: Hans de Goede , Ard Biesheuvel , Peter Jones , Mimi Zohar , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , "Luis R . Rodriguez" , Matthew Garrett Subject: [PATCH 2/6] ima: prevent sysfs fallback firmware loading Date: Tue, 1 May 2018 09:48:19 -0400 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1525182503-13849-1-git-send-email-zohar@linux.vnet.ibm.com> References: <1525182503-13849-1-git-send-email-zohar@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050113-0020-0000-0000-00000417CA32 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050113-0021-0000-0000-000042ACE1DF Message-Id: <1525182503-13849-3-git-send-email-zohar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-01_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805010138 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With an IMA policy requiring signed firmware, this patch prevents the sysfs fallback method of loading firmware. Signed-off-by: Mimi Zohar Cc: Luis R. Rodriguez Cc: David Howells Cc: Matthew Garrett --- security/integrity/ima/ima_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 754ece08e1c6..8759280dccf6 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -453,7 +453,17 @@ int ima_read_file(struct file *file, enum kernel_read_file_id read_id) } return 0; } + + if (read_id == READING_FIRMWARE_FALLBACK) { + if ((ima_appraise & IMA_APPRAISE_FIRMWARE) && + (ima_appraise & IMA_APPRAISE_ENFORCE)) { + pr_err("Prevent firmware sysfs fallback loading.\n"); + return -EACCES; + } + return 0; + } return 0; + } static int read_idmap[READING_MAX_ID] = { -- 2.7.5