Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1691204ybt; Sat, 27 Jun 2020 17:05:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5QtpkYKw+RABVDTxrViYhjSxAEMo0QlGzGipaBfKqKlWF5w0wYZA2asW2G4svwAehKMOL X-Received: by 2002:a50:d7c1:: with SMTP id m1mr10747940edj.217.1593302748407; Sat, 27 Jun 2020 17:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593302748; cv=none; d=google.com; s=arc-20160816; b=SLFR5TOoFPloa8q2IIH1gy41++1as/HOrnizUBwetC2hzZgDe/SUepkfcV3rMj5Mnx QN+tnPun6czcTg9Wo5shNUSE0CCyxGhhaDEH/Hi1F5pmE5DilJt6wspd9Gdf3uFj+uPm KCX+VEJlfs6HhXMitp4cijKuNreCB/GKm+zT+vRbooX/+w5y4thp1A5A8KbhxEmmGiDZ 7ni02fsm3Pq5DS5fdp+c62yko4GkEWgW5XMBSbTC87IEfYd+w9/ruLg5/ndHXUkZ2IBa GBIysY3QJGRCXYGxlnw9J32+KI9si9i08QUYFbOODtU30dJZTRI9Ad30w9Y2kZmjVWjC GEbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=AheOVy8WalcaWac91mKAT8KIpgDUzXZHzWpyNG3m0gg=; b=ZC0vy3lAAwPFzw9QHIx5eQFoVlsYsycYkVuXwI9xjqhCM5++rAiKpqOYX2LlD2YNi1 2K3e1xQnzhodaESvHseXStZhXvAT0ya52D001R296SlnV86yjxs5pKdPfsvE6LZ4PHYV G1J3OWVInDNilpYbxTXAj6cZefEQjGqiyG8lAM1LTvuFImEjNlQdKa4Uf5WpAngEBdwk Z2NeQnRPq1BmhXgYxGef7eAlV2DG5I+g27NSQP0ndHhV6zdTcC0OWslWOaC4wH6zlBAs hHYRVCu/n5Z+MPZs5zeaqAWNaj2p5Qqmt628T9LQ7AkaSajJiy7OCcGW6lx1AftxAIYp bNjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MVfHOkX1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si11397060edq.450.2020.06.27.17.05.24; Sat, 27 Jun 2020 17:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=MVfHOkX1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbgF1ADN (ORCPT + 99 others); Sat, 27 Jun 2020 20:03:13 -0400 Received: from linux.microsoft.com ([13.77.154.182]:43772 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgF1ADN (ORCPT ); Sat, 27 Jun 2020 20:03:13 -0400 Received: from [192.168.0.104] (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id 5875520B4901; Sat, 27 Jun 2020 17:03:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5875520B4901 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1593302592; bh=AheOVy8WalcaWac91mKAT8KIpgDUzXZHzWpyNG3m0gg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=MVfHOkX1d6GxzRyYYiQQPB1TuVfYstSj4CFuXd6M8e9GBo2IMLbe9MnwUym/ifhvc 984TXaD/DGHpcRhVFfvhdqGRTiNBQi7tSBdWHMUowMMzyk7poES0Yms1vAetyoW12l I3tqljz9xfBYIxayF2XOz5zuK5JIc81dBZ+2F65Q= Subject: Re: [PATCH v2 11/11] ima: Support additional conditionals in the KEXEC_CMDLINE hook function To: Tyler Hicks , Mimi Zohar , Dmitry Kasatkin Cc: James Morris , "Serge E . Hallyn" , Prakhar Srivastava , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Eric Biederman , kexec@lists.infradead.org References: <20200626223900.253615-1-tyhicks@linux.microsoft.com> <20200626223900.253615-12-tyhicks@linux.microsoft.com> From: Lakshmi Ramasubramanian Message-ID: Date: Sat, 27 Jun 2020 17:03:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200626223900.253615-12-tyhicks@linux.microsoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/26/20 3:39 PM, Tyler Hicks wrote: > Take the properties of the kexec kernel's inode and the current task > ownership into consideration when matching a KEXEC_CMDLINE operation to > the rules in the IMA policy. This allows for some uniformity when > writing IMA policy rules for KEXEC_KERNEL_CHECK, KEXEC_INITRAMFS_CHECK, > and KEXEC_CMDLINE operations. > > Prior to this patch, it was not possible to write a set of rules like > this: > > dont_measure func=KEXEC_KERNEL_CHECK obj_type=foo_t > dont_measure func=KEXEC_INITRAMFS_CHECK obj_type=foo_t > dont_measure func=KEXEC_CMDLINE obj_type=foo_t > measure func=KEXEC_KERNEL_CHECK > measure func=KEXEC_INITRAMFS_CHECK > measure func=KEXEC_CMDLINE > > The inode information associated with the kernel being loaded by a > kexec_kernel_load(2) syscall can now be included in the decision to > measure or not > > Additonally, the uid, euid, and subj_* conditionals can also now be > used in KEXEC_CMDLINE rules. There was no technical reason as to why > those conditionals weren't being considered previously other than > ima_match_rules() didn't have a valid inode to use so it immediately > bailed out for KEXEC_CMDLINE operations rather than going through the > full list of conditional comparisons. > > Signed-off-by: Tyler Hicks > Cc: Eric Biederman > Cc: kexec@lists.infradead.org > --- > > * v2 > - Moved the inode parameter of process_buffer_measurement() to be the > first parameter so that it more closely matches process_masurement() > > include/linux/ima.h | 4 ++-- > kernel/kexec_file.c | 2 +- > security/integrity/ima/ima.h | 2 +- > security/integrity/ima/ima_api.c | 2 +- > security/integrity/ima/ima_appraise.c | 2 +- > security/integrity/ima/ima_asymmetric_keys.c | 2 +- > security/integrity/ima/ima_main.c | 23 +++++++++++++++----- > security/integrity/ima/ima_policy.c | 17 +++++---------- > security/integrity/ima/ima_queue_keys.c | 2 +- > 9 files changed, 31 insertions(+), 25 deletions(-) > Reviewed-by: Lakshmi Ramasubramanian