Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3660662imm; Tue, 29 May 2018 11:04:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppE0QKK33Ii7ypUTh3Ohmm16okE2wLF+10uEjQcXGWY/1Kv9yRM4ueBHfl1rQUqhKVIn7S X-Received: by 2002:a17:902:b60a:: with SMTP id b10-v6mr18212278pls.221.1527617084129; Tue, 29 May 2018 11:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527617084; cv=none; d=google.com; s=arc-20160816; b=imW8lof9sHM6G2enT4ded9R76hubPySoqqgQXFdyfmMbpSrwX5bbZM6ENkMdV275YU bje5CwNXogMlq0a0OvEK4uf2ilq2CzM+DKGk1kUqMwz4R27PtK0GtRiMuJCQF5Kklc5K wWoqJ8s7+03GS8zWA1L3yHTYsPhysqfkDt1cr0ugbeYs1PwmsGgs09BVOjeWgFQlOkq4 5I/3qZM3VYPdkKFR9dEpEFPWoF3oh6p4G7LHE4uJZhvJFUbImJxxby++P9ichjo/wNV/ GvitUDwOYB6L5uTzjP24wtKvrdjHIsNI8NNss8ljnkXsUXoi8vBLg+LkgdJ6EKWSRqB9 Q38Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=heQ5i5ke3XXjC3Dz+WUkpT8kCcYi+76kr4OaGSFOR34=; b=l6CMcslc+NWx8SL+Vii/kKc853gvqq6LtRFccsqPI7DMK/Cxg/Gor1emUvkgxR7nDP w0wIycRVMaTa75IUqK7KA0OstmgZk1DwF3X9U96jYRDaz6g4RSJOLF+nZqCExiaZgs4V 1z1CFD74RDz8IMstC2s+Jolujq3EFhmbB7nZIUK65/k9rCo0g4WNAqyrOx/X05UiHiVc PmNn18s3FKPBJJuHjHL4KubOZk63KJrCems4jDiFWGu9ZpjlWQ9CHbriU36jJc9IQ5UW s01oznwT1Rp30hfZbsLX6K/fGjLW0MFHEM1r19zp9Z3TbhrppO07fWcDsaBGWIaRwIPH QDFQ== 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 v66-v6si26196746pgv.344.2018.05.29.11.04.30; Tue, 29 May 2018 11:04:44 -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 S965798AbeE2SC2 (ORCPT + 99 others); Tue, 29 May 2018 14:02:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:9817 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965500AbeE2SCU (ORCPT ); Tue, 29 May 2018 14:02:20 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4THsYl4072115 for ; Tue, 29 May 2018 14:02:19 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j9955yxk2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 29 May 2018 14:02:16 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 May 2018 19:02:12 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 29 May 2018 19:02:09 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4TI28rN16187564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 29 May 2018 18:02:08 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9F1BAE055; Tue, 29 May 2018 18:51:14 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7B0BAE059; Tue, 29 May 2018 18:51:13 +0100 (BST) Received: from dhcp-9-2-54-219.watson.ibm.com (unknown [9.2.54.219]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 29 May 2018 18:51:13 +0100 (BST) From: Mimi Zohar To: linux-integrity@vger.kernel.org Cc: Mimi Zohar , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , Eric Biederman , kexec@lists.infradead.org, Andres Rodriguez , Greg Kroah-Hartman , Ard Biesheuvel Subject: [PATCH v4 0/8] kexec/firmware: support system wide policy requiring signatures Date: Tue, 29 May 2018 14:01:52 -0400 X-Mailer: git-send-email 2.7.5 X-TM-AS-GCONF: 00 x-cbid: 18052918-0044-0000-0000-00000558109A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052918-0045-0000-0000-0000289A2019 Message-Id: <1527616920-5415-1-git-send-email-zohar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-29_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=5 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-1805290195 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of adding the security_kernel_read_file LSM hook - or defining a wrapper for security_kernel_read_file LSM hook and adding it, or renaming the existing hook to security_kernel_read_data() and adding it - in places where the kernel isn't reading a file, this version of the patch set defines a new LSM hook named security_kernel_load_data(). The new LSM hook does not replace the existing security_kernel_read_file LSM hook, which is still needed, but defines a new LSM hook allowing LSMs and IMA-appraisal the opportunity to fail loading userspace provided file/data. The only difference between the two LSM hooks is the LSM hook name and a file descriptor. Whether this is cause enough for requiring a new LSM hook, is left to the security community. --- IMA-appraisal is mostly being used in the embedded or single purpose closed system environments. In these environments, both the Kconfig options and the userspace tools can be modified appropriately to limit syscalls. For stock kernels, userspace applications need to continue to work with older kernels as well as with newer kernels. In this environment, the customer needs the ability to define a system wide IMA policy, such as requiring all kexec'ed images, firmware, kernel modules to be signed, without being dependent on either the Kconfig options or the userspace tools.[1] This patch set allows the customer to define a policy which requires the kexec'ed kernel images, firmware, and/or kernel modules to be signed. In addition, this patch set includes the ability to configure a build time IMA policy, which is automatically loaded at run time without needing to specify it on the boot command line and persists after loading a custom kernel policy. [1] kexec-tools suupports the new syscall based on a flag (-s). Changelog v4: - Define a new LSM hook named security_kernel_load_data(). - Define kernel_load_data_id enumeration. - Replace the existing LSM hook in init_module syscall. Changelog v3: Based on James' feedback: - Renamed security_kernel_read_file() to security_kernel_read_data(). - Defined new kernel_load_data_id enumeration. - Cleaned up ima_read_data(), replacing if's with switch. Changelog v2: - combined "kexec: limit kexec_load syscall" and "firmware: kernel signature verification" patch sets. - add support for build time policy. - defined generic security_kernel_read_blob() wrapper for security_kernel_read_file(). Suggested by Luis. Mimi Zohar (8): security: define new LSM hook named security_kernel_load_data kexec: add call to LSM hook in original kexec_load syscall ima: based on policy require signed kexec kernel images firmware: add call to LSM hook before firmware sysfs fallback ima: based on policy require signed firmware (sysfs fallback) ima: add build time policy ima: based on policy prevent loading firmware (pre-allocated buffer) module: replace the existing LSM hook in init_module drivers/base/firmware_loader/fallback.c | 7 +++ include/linux/ima.h | 7 +++ include/linux/lsm_hooks.h | 6 +++ include/linux/security.h | 33 ++++++++++++++ kernel/kexec.c | 8 ++++ kernel/module.c | 2 +- security/integrity/ima/Kconfig | 58 ++++++++++++++++++++++++ security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_main.c | 79 ++++++++++++++++++++++++--------- security/integrity/ima/ima_policy.c | 48 ++++++++++++++++++-- security/security.c | 10 +++++ security/selinux/hooks.c | 26 ++++++++--- 12 files changed, 255 insertions(+), 30 deletions(-) -- 2.7.5