Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp321849ybm; Mon, 20 May 2019 17:08:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCWts+1wa2n+craAfmRgNN1D1tszlOHaQ5ut1nSYXSZgdstDyQVAdSZ3jCn1qqUSgwR1xy X-Received: by 2002:a63:e451:: with SMTP id i17mr78857578pgk.312.1558397298245; Mon, 20 May 2019 17:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558397298; cv=none; d=google.com; s=arc-20160816; b=ygB6W9vBScp2buA2uysfC+OnuInuHeA5RwePCVT8Wgke/cY+fBDYxo68tPCtYkww01 nFyV28ActnJv04MyBqN/6BHtVB/Ojlf8A0oPCMSd+uf8NP/HMBwgcTpRG3eosLCBBIun w9HY7wIRbKbQ5fHoxJtq5TmxiEE1HFpfZMLHSV0tHbffOnwbIQz2wUCahDtNjBdOVD+t yutuc8yEdmX7X0oEtXRRxWLtPiv2XNFafdn7sCPfU7RQRVyO92ey7dWy41BusFX/oFA7 Ift25HtMBHpw+4njW9aRFLEaDUzqpXPOA5C+BZY3Y39SLNx55h3sy0wIV3M9ZT/MvnqR MsGg== 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:dkim-signature; bh=1yoN/ic+Auw9uJWvyGTewovBaYwnACSuIGV6GIUz8AQ=; b=VqiYb7KFYb66iy9dXX4dh/x96w/oxBfJUDTuJLow/iNxwTJXHRjMy7pXdpIUj/VuY8 WobDa1XGoNouPJY9mFMEs0iPr65N1H7TaxFAVuhjm3t7lpHtdMzMeT6B0viqv+eS7Vpv RPPNuxvxFznOSeVQvGY7VBnHd+9POl8SgKappBWDtR572iANR58C8XAmBsgxRpgdtcdO TS6hLalNJkvT+6EdgXhgo7ui3vEluuDhAlavPj9REZNDXzpQv+IbFSHUoDd38VrYQn+N vLAclVXXrZoLTG/SDr1gnIT1KB+FWiBebbZKlCdgckhFNYeozvisBFolouOiE6SVWJDl 1y4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XJDRGlQM; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si14047768pgt.146.2019.05.20.17.08.03; Mon, 20 May 2019 17:08:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XJDRGlQM; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbfEUAG6 (ORCPT + 99 others); Mon, 20 May 2019 20:06:58 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44202 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727319AbfEUAG4 (ORCPT ); Mon, 20 May 2019 20:06:56 -0400 Received: by mail-pg1-f195.google.com with SMTP id n2so886247pgp.11; Mon, 20 May 2019 17:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1yoN/ic+Auw9uJWvyGTewovBaYwnACSuIGV6GIUz8AQ=; b=XJDRGlQMlUosJ5Mg5JKUcAqICzEoZ6fnxeJ1mRBakghEeIMs2cHJSh7F1xmFUcSCzT 8vSLW7x0GHT82mQu5d/K0U/Qc1B9b0ENB7hSLas40ByixsHSjefZrGwZXjWax5d317CV IA6oekMu/WPPGvus26xUalii1CK2XqBqINVdZkTC+r/UwIXYSEqYEmSJz5ynxtUi5oNJ ZLQYdBr/r6C8dg9wPzPT+oAY6JvKZyW5iCXSrD02JamMSiHagVsidJNDiHbaGxoCvYbk 6ujGUPqL9Iy9vvrmJEzNIDjWLCXdo0q6RB6TsBODAZF/NDfjMIuGdjAgDF4XbKy2Fg02 QZgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1yoN/ic+Auw9uJWvyGTewovBaYwnACSuIGV6GIUz8AQ=; b=PN+Ng8SxixTEURAXRnjolPtFL270IFsewO+P0m+JOrFeDqypH2LWbtWZpuFZNn232H gaP+5N8wdbn6LoJ5opB+eDR1Sey3XDusSqUOJCndRCYQyAZAE1A/iMwXGIyQ+TpaUORB KabOtrDXjTLTIS3zmPdLp0ohGCTV0v1jqrQV3om62UrKbjAopBl5FCcLPECF40d2mNxv z6OZ78lt2oA15O/gHwZZZ2PZUxfoEkfLBwldSCeF5nK6AkMNly+h9XJeXeBTMbgyDz1e 9jLPVgvic7OhEPN3imYCdfz/PqyvIIqVPpYF8qdPywgUI9Aa1g4PKJn+1pOmcmAL4bBj VOdA== X-Gm-Message-State: APjAAAUXYxc04radiAqo9wLc+8lRFSl44PRx7LfrMgUXAVuOmk3nH8re GaPf0thPA/VZ9SiOzFWRX5YZdrY+IAt88A== X-Received: by 2002:a63:40b:: with SMTP id 11mr62107358pge.31.1558397215422; Mon, 20 May 2019 17:06:55 -0700 (PDT) Received: from prsriva-Precision-Tower-5810.corp.microsoft.com ([2001:4898:80e8:1:e5e3:4312:180a:c25e]) by smtp.gmail.com with ESMTPSA id i16sm5939149pfd.100.2019.05.20.17.06.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 17:06:54 -0700 (PDT) From: Prakhar Srivastava To: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mjg59@google.com, zohar@linux.ibm.com, roberto.sassu@huawei.com, vgoyal@redhat.com, Prakhar Srivastava Subject: [PATCH v6 3/3] call ima_kexec_cmdline to measure the cmdline args Date: Mon, 20 May 2019 17:06:45 -0700 Message-Id: <20190521000645.16227-4-prsriva02@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190521000645.16227-1-prsriva02@gmail.com> References: <20190521000645.16227-1-prsriva02@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During soft reboot(kexec_file_load) boot cmdline args are not measured.Thus the new kernel on load boots with an assumption of cold reboot. This patch makes a call to the ima hook ima_kexec_cmdline, added in "Add a new ima hook ima_kexec_cmdline to measure cmdline args" to measure the boot cmdline args into the ima log. - call ima_kexec_cmdline from kexec_file_load. - move the call ima_add_kexec_buffer after the cmdline args have been measured. Signed-off-by: Prakhar Srivastava --- kernel/kexec_file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index f1d0e00a3971..fcc04a230925 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -198,9 +198,6 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, return ret; image->kernel_buf_len = size; - /* IMA needs to pass the measurement list to the next kernel. */ - ima_add_kexec_buffer(image); - /* Call arch image probe handlers */ ret = arch_kexec_kernel_image_probe(image, image->kernel_buf, image->kernel_buf_len); @@ -241,8 +238,13 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, ret = -EINVAL; goto out; } + + ima_kexec_cmdline(image->cmdline_buf, image->cmdline_buf_len - 1); } + /* IMA needs to pass the measurement list to the next kernel. */ + ima_add_kexec_buffer(image); + /* Call arch image load handlers */ ldata = arch_kexec_kernel_image_load(image); -- 2.17.1