Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2860588ybi; Mon, 17 Jun 2019 11:36:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMluaJLWuao93DyeIdnrCpuvonuM74PlzDr7uUAZnDLlFPeuvTBEAZnhvE6Fu20XATtIsT X-Received: by 2002:a17:902:aa47:: with SMTP id c7mr22610162plr.171.1560796577795; Mon, 17 Jun 2019 11:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560796577; cv=none; d=google.com; s=arc-20160816; b=kc+dUn8Y2Urtv0IqdrhuzIjgxJHDRon1PmUlSpQ0T/YlO5mopLDA9K9ny/yP3YS8pu EwhI3bpo8LMgmyxdQkCKRRVZ5fovTCNSbYXNklsAvnFuru2ksaPnbDmxcWkxjuuOtMtk nWZ6IunGn9JpVl4chnw3km6xCZ6iHSQIrtAfWSDeev3GGP4/oQu6vis9Fn5k61kbA6M3 5OVrp2iyLkkBD+V8Q/5DaCmRuEXe+XlBZWcnaAfmwwNmU1DuMNOfHlZGydGb1xKA54Fb 5THKZ4YDHYSXKXFyjJvexAprnmqMAMQK0edU0+HjYTT+RSr8xX88JEpFMesCMsdoV7Kf yyFw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0IvJHoD0x6Z/N31hvvGGVGsE7+bjH2MX+F9HjOeromU=; b=wPKwD87DKeAfQR2pXycoiGmpbSEGrVodUGfQ2+GTLtgOZuKbCRJlXidEeRpb5wEd0T Mp+43A6Ynxvc0V8f3Mloy4UyvEE7d60XuJJ24eNpZhz/wGkOZlPzFaQr7wCjufZI+qgL fMmITn5hrbn0kyXibqusnQnUmLGaYYE+XZez6hW8eRwrDWaKwYg/x0TKItGQK/qYGUP7 5AtUSGfgFPk4FPc1HftFXiU2dVdSr9Ti0Y3qmG4FMsRT6i+SfLp2RxNtfQZn5Rf2jkcP 60MOKxPCgbD6TgfPvuq4W44HzIlan1IZUV32fq6wNA3rUDZQFXn9uEloZDmj08uLfOOz sCog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OExWykqY; 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 29si11578584pgy.132.2019.06.17.11.36.02; Mon, 17 Jun 2019 11:36:17 -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=OExWykqY; 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 S1726963AbfFQSf4 (ORCPT + 99 others); Mon, 17 Jun 2019 14:35:56 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41397 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbfFQSfz (ORCPT ); Mon, 17 Jun 2019 14:35:55 -0400 Received: by mail-pl1-f194.google.com with SMTP id m7so858148pls.8; Mon, 17 Jun 2019 11:35: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 :mime-version:content-transfer-encoding; bh=0IvJHoD0x6Z/N31hvvGGVGsE7+bjH2MX+F9HjOeromU=; b=OExWykqYB1XFOJ0uAdfVjaD7+Rm+ptb+DGzRrFHXrfqUpNWmT+gyfF49bfYgfui6Gg XgnxapiU1/pFppenKXF78Tu7baKT6rjno8xgPl58yrOR65sg1dst3gH8VSsDKA/fhM9g Isxo4e0gzq+QSCl1q2FCeidJ5Ap8TyDOff9CzQzp5cu1gUWXogVIAKzBfTxNm8ycDqVJ Wkj+iZe5wWKcb8IBJ6e1EvNehilkjWeMnCX9UFmw7k7UdUjXefP2Yz0hgoscpcim8r6o W0OF8+PdpHRKyy5E2/VxK7rb5Fxq5MPaO6FA0PuTD6FFcV4G1VpWUFCZv6UIj/7e14Tv rvTw== 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:mime-version:content-transfer-encoding; bh=0IvJHoD0x6Z/N31hvvGGVGsE7+bjH2MX+F9HjOeromU=; b=oz5QlQom1uknXgqzEIa1usPwjH6qkJL1Pa0R+oJpAQYpBLj8WHPK4lUxaoD7OGzYb5 rfMQcenJrjdvGMwjJr8Orcqy+CkC33O/F1AlNRfXvycZ/SP3+P59BmeqDz/WSQ58o+9t QWIM5ZGcNZKy/bAz7RuG8zEP/086tqHwJaGyC39sZ1Kw8sYWdjBO3Wzrl7e5CAZvE3Md jgLP+StlrjauGOjGH+eAFnB1RYCfPeqfynpQ/wpELpYjf9xFvc136SIhalPovdi63Hco PICyRnnbN6vQ0xr+e2vG7hAshBog+Ib9oZ7EUGfPi5FHtrREoDhm+qarAedibNkwG71q RAbA== X-Gm-Message-State: APjAAAW11g3MwFFTkqCwWt50/KVZeya7C5MwOW+dA5GdeDqwV4C+uGLJ 11Ad70ASsEbGgpS8NADl58ESXXD3 X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr3796492plh.338.1560796554726; Mon, 17 Jun 2019 11:35:54 -0700 (PDT) Received: from localhost.localdomain ([167.220.56.169]) by smtp.gmail.com with ESMTPSA id f186sm16552946pfb.5.2019.06.17.11.35.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 11:35:54 -0700 (PDT) From: Prakhar Srivastava To: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zohar@linux.ibm.com, roberto.sassu@huawei.com, Prakhar Srivastava Subject: [PATCH 3/3] KEXEC:Call ima_kexec_cmdline to measure the boot command line args Date: Mon, 17 Jun 2019 11:35:07 -0700 Message-Id: <20190617183507.14160-4-prsriva02@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190617183507.14160-1-prsriva02@gmail.com> References: <20190617183507.14160-1-prsriva02@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 command line arguments are not measured. Call ima hook ima_kexec_cmdline to measure the boot command line arguments into IMA measurement list. - 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 Reviewed-by: James Morris Acked-by: Dave Young --- kernel/kexec_file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 072b6ee55e3f..b0c724e5d86c 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,14 @@ 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.19.1