Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1603333ybp; Wed, 9 Oct 2019 17:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzg7PQmqn8elfXic6iFDlDMUdldQHFKIehvoJnOCdGecYvLMDwZJ00gHxNpPZekAjHYuHu0 X-Received: by 2002:a50:af45:: with SMTP id g63mr5409965edd.21.1570666612069; Wed, 09 Oct 2019 17:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570666612; cv=none; d=google.com; s=arc-20160816; b=muR+xoH4cMEva3ioBz1Sb7yXmicIvF1tx+pWkhUORFSsI7HjaVKxVO4ggKxgCqk1ka l/GwLH7dvJbyct3C/RgVxWeHW5OmRpUr2oKYEfqMaT0MRLgk9wloACuKJAgKSQHZjLkL jM1iarZ8uk4X8wvkwXuYWMFR2DNLma7W/Bgz8OSogoZ41dR3NhC7qi8Hl+N89QF9DMW+ itjSgW27hSk0bIScdFhk7JzWaKAt+fm8rYb47L7vg2ZS6dIb1/Dgd4j91np1x5MiQCyu wQrqm9Sl307FjWTIkuoPA+2ybgQRTg+xQ0vFnhm0RNPZwm98bjB4h9PsOqpTbEmT7JrB J3Tw== 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 :dkim-signature:dkim-filter; bh=8PIUlpe4QGC+q/h/YpfHHQXYskMJ+TEhigux0nCSFXM=; b=DbOxKLhb0pXgpXS99rwAOoo3gC9DncS+SsB09FLMolgP7q0aPTg00sgGPNv34GDqcG fPM0JWTkmxi8qQHeTg69HjsNymtIvaFgznHNNr+bXIuTF8tfwvHBW8Ffw8sHVcpfJEhy HAn8xfwa60W3XW+OWgAIWY0Qy9gnjSo3fqjYW7SB4icB1dCzuC8KeNHSzP9r79gUrBkK m7IltXqWNK9SI0zysMQmHW6RyNnM2xw5VE46z/9SUdac6fK4PoEBG4KN4UG7ps2NmUHk nt4/pKo+FGi1IwejDfcVGROTnUKtSQsddbnc/odUBkG08yPnXOSxUwR/cz/LzIUoHjsp MMOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=qaOuO5Yn; 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=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gl26si2108290ejb.17.2019.10.09.17.16.28; Wed, 09 Oct 2019 17:16:52 -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=@linux.microsoft.com header.s=default header.b=qaOuO5Yn; 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=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732504AbfJJANB (ORCPT + 99 others); Wed, 9 Oct 2019 20:13:01 -0400 Received: from linux.microsoft.com ([13.77.154.182]:43742 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732019AbfJJANB (ORCPT ); Wed, 9 Oct 2019 20:13:01 -0400 Received: from prsriva-Precision-Tower-5810.corp.microsoft.com (unknown [167.220.2.18]) by linux.microsoft.com (Postfix) with ESMTPSA id C712320B71C6; Wed, 9 Oct 2019 17:12:59 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C712320B71C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1570666379; bh=8PIUlpe4QGC+q/h/YpfHHQXYskMJ+TEhigux0nCSFXM=; h=From:To:Cc:Subject:Date:From; b=qaOuO5Yn2yipBl6hZT8j8IFlCHBTtyJC7kkcW9FvlG5kGq4uyWFQDjYVtosLiWlQ+ 1D46wLbZo9t0EgiPI05/SVm9SsFhuQCQQOgfaxGIp8F9rqNKmrc+3JogfHl0Y7hZOY cFsEVt4+weA6ky/j8ZbMQ1JG5JBtdUG4jXQoDpKU= From: Prakhar Srivastava To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-integrity@vger.kernel.org, kexec@lists.infradead.org Cc: arnd@arndb.de, jean-philippe@linaro.org, allison@lohutok.net, kristina.martsenko@arm.org, yamada.masahiro@socionext.com, duwe@lst.de, mark.rutland@arm.com, tglx@linutronix.de, takahiro.akashi@linaro.org, james.morse@arm.org, catalin.marinas@arm.com, sboyd@kernel.org, bauerman@linux.ibm.com, zohar@linux.ibm.com Subject: [PATCH v3 0/2] Add support for arm64 to carry ima measurement log in kexec_file_load Date: Wed, 9 Oct 2019 17:12:49 -0700 Message-Id: <20191010001251.22746-1-prsriva@linux.microsoft.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to carry ima measurement log to the next kexec'ed session triggered via kexec_file_load. - Top of Linux 5.3-rc6 Currently during kexec the kernel file signatures are/can be validated prior to actual load, the information(PE/ima signature) is not carried to the next session. This lead to loss of information. Carrying forward the ima measurement log to the next kexec'ed session allows a verifying party to get the entire runtime event log since the last full reboot, since that is when PCRs were last reset. Tested for arm64 qemu and real hardware. I have not been unable to test the patch for powerpc 64bit. Any testing is greatly appretiated. TODO: Add support for 32 bit in the of_ima.c v3: - Fix build breaks due to bad config. v2: - move common code to drivers/of/of_ima.c. - point arm64 to use of_ima implementation. - point powerpc to use of_ima implementation v1: - add new fdt porperties to mark start and end for ima measurement log. - use fdt_* functions to add/remove fdt properties and memory allocations. - remove additional check for endian-ness as they are checked in fdt_* functions. v0: - Add support to carry ima measurement log in arm64, uses same code as powerpc. Prakhar Srivastava (2): Add support for arm64 to carry ima measurement log in kexec_file_load update powerpc implementation to call into of_ima* arch/arm64/Kconfig | 7 + arch/arm64/include/asm/ima.h | 24 +++ arch/arm64/include/asm/kexec.h | 5 + arch/arm64/kernel/Makefile | 3 +- arch/arm64/kernel/ima_kexec.c | 78 ++++++++++ arch/arm64/kernel/machine_kexec_file.c | 6 + arch/powerpc/Kconfig | 6 + arch/powerpc/include/asm/ima.h | 6 - arch/powerpc/kernel/Makefile | 8 +- arch/powerpc/kernel/ima_kexec.c | 170 ++------------------- drivers/of/Kconfig | 6 + drivers/of/Makefile | 1 + drivers/of/of_ima.c | 204 +++++++++++++++++++++++++ include/linux/of.h | 31 ++++ 14 files changed, 386 insertions(+), 169 deletions(-) create mode 100644 arch/arm64/include/asm/ima.h create mode 100644 arch/arm64/kernel/ima_kexec.c create mode 100644 drivers/of/of_ima.c -- 2.17.1