Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1080897imm; Fri, 13 Jul 2018 11:07:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/fGw8TjsULCspw8+RlAJY46W/GWKOtzTAKF2X5BzNipsKG06QJKFrmghb4PTIkfvh1Ghn X-Received: by 2002:a17:902:ac96:: with SMTP id h22-v6mr7418816plr.17.1531505236061; Fri, 13 Jul 2018 11:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531505236; cv=none; d=google.com; s=arc-20160816; b=DbM7yFLCZsE6LiBWKcP3u8eOp27T6wPJbO9JIhPndq9cezVrutyP7rISgKAhF+U0vf mgniTrbMytvthqy/opignMpwWDZKywiHh1/I1mou57ozK3RNTIvx7MHwFLBiV0Pz6uHa piPNFJqDPIhExfNyZU7XQ4I7iWalx4byircReGbVyi4ZAnfZYBMX9aOf5XBtQ0wcyMaf WPf8aQ0kRhX3eriaaOmU3bGgScaN+2tXzdLvlxHilhi0L9fS6lMLEx1mkYlt8Za2QXoM rpX7cXhKJjN/0uy35JV3Ud1DhAs9H/+BJMSanJqgCEBrAgbxKX291Y9tqo3wPbbygcMK QXyw== 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=pMoqei14b8DK+ZsClS1EHs9kZemQFkF0ErjFI8hkoZM=; b=BbqqIU1SBI/p3JlDCE6f1e+oZ3d4MWKnP5tCUDZpb/gqsVk5g8JHKDTy8GsDRac/Ns SgUUi4fcu8+VptiyoL1zcanXDeTIViXzxg8RI9zz4DSexeLKQcG2W9TPhCMoCbCoRhdO UIF8/HKdKXsx6efpCErygF97J3t6pwQoDB63NtAXd4tEdtt0kC0wEo5rtf8XIOyPXKlJ wvwTE5lRSUsFC4Qq+D+O2iIGNsqpd7EWhNkZ5ldbf/RW++RHOaXqAF4+NDuyV8pArtzc FBtCQ3V0pDwOd8xYWQB/POW8FRs8kpA0gD9Ww971Qh1pDj5oIzn+gEFX3aocvLqux3+a zthQ== 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 d1-v6si24525715plj.448.2018.07.13.11.07.01; Fri, 13 Jul 2018 11:07:16 -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 S1731978AbeGMSWC (ORCPT + 99 others); Fri, 13 Jul 2018 14:22:02 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38254 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730167AbeGMSWB (ORCPT ); Fri, 13 Jul 2018 14:22:01 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6DI4DZQ113221 for ; Fri, 13 Jul 2018 14:06:19 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k70gf936m-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 Jul 2018 14:06:18 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Jul 2018 19:06:17 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 13 Jul 2018 19:06:13 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6DI6CGQ24707194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 13 Jul 2018 18:06:12 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C707642041; Fri, 13 Jul 2018 21:06:33 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C41C042047; Fri, 13 Jul 2018 21:06:32 +0100 (BST) Received: from dhcp-9-31-103-18.watson.ibm.com (unknown [9.31.103.18]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Jul 2018 21:06:32 +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, "Luis R . Rodriguez" , Eric Biederman , kexec@lists.infradead.org, Andres Rodriguez , Greg Kroah-Hartman Subject: [PATCH v6 0/8] kexec/firmware: support system wide policy requiring signatures Date: Fri, 13 Jul 2018 14:05:55 -0400 X-Mailer: git-send-email 2.7.5 X-TM-AS-GCONF: 00 x-cbid: 18071318-0016-0000-0000-000001E691D8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071318-0017-0000-0000-0000323B2F7F Message-Id: <1531505163-20227-1-git-send-email-zohar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-13_06:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807130159 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v6: - Instead of warning about loading firmware from pre-allocated, shared memory, just add a comment. Refer to the patch description for reason. - LoadPin: add missing cast from enum kernel_load_file_id to kernel_read_file_id. Changelog v5: - Shared kernel_load_data_id and kernel_read_file_id enumerations. The previous version of this patch set defined a new LSM hook named security_kernel_load_data and an associated enumeration named kernel_load_data_id, independent of kernel_read_file_id. In this version, the kernel_load_data_id and kernel_read_file_id values are shared, simplifying Loadpin's and other LSMs calling one LSM hook from the other. - Warn about loading firmware from pre-shared memory. Previous versions of this patch set prevented loading firmware, based on policy, from pre-allocated (DMA) memory, introduced in commit a098ecd2fa7d ("firmware: support loading into a pre-allocated buffer"). Based on discussions, calling dma_alloc_coherent() is unnecessary and confusing. This version of the patch set allows loading the firmware, but emits a warning. 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. 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 module: replace the existing LSM hook in init_module ima: based on policy warn about loading firmware (pre-allocated buffer) drivers/base/firmware_loader/fallback.c | 7 ++++ include/linux/ima.h | 7 ++++ include/linux/lsm_hooks.h | 6 +++ include/linux/security.h | 27 +++++++++++++ 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 | 68 ++++++++++++++++++++++++++------- security/integrity/ima/ima_policy.c | 48 +++++++++++++++++++++-- security/loadpin/loadpin.c | 6 +++ security/security.c | 10 +++++ security/selinux/hooks.c | 15 ++++++++ 13 files changed, 245 insertions(+), 18 deletions(-) -- 2.7.5