From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 806E6C433DB for ; Tue, 22 Dec 2020 21:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56FAE22B2B for ; Tue, 22 Dec 2020 21:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbgLVVCx (ORCPT ); Tue, 22 Dec 2020 16:02:53 -0500 Received: from linux.microsoft.com ([13.77.154.182]:53942 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgLVVCx (ORCPT ); Tue, 22 Dec 2020 16:02:53 -0500 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 4120C20B83DE; Tue, 22 Dec 2020 13:02:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4120C20B83DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1608670931; bh=6jBy3EfwQSpNBhU5WRPubRpUKsySzSS/D79lOdmUiIk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=jVWqQ45I3EQZdPHDigc8cKWWgxa9sVToULn+2GHy3TL3M+M+7LTMeYaVVfp+mkwMf QsgUzWY2XrnIYd9hT/UP1VXBWdb9MqSLawkbHDysmA4Yfrg5DcO/IMC5bV/GednnYX 7EJyQYe2Qyi58TLjjqOYGlJTnJCWUdjWoU0Fum5k= Subject: Re: [PATCH v13 2/6] powerpc: Move arch independent ima kexec functions to drivers/of/kexec.c To: Mimi Zohar , bauerman@linux.ibm.com, robh@kernel.org, takahiro.akashi@linaro.org, gregkh@linuxfoundation.org, will@kernel.org, catalin.marinas@arm.com, mpe@ellerman.id.au Cc: james.morse@arm.com, sashal@kernel.org, benh@kernel.crashing.org, paulus@samba.org, frowand.list@gmail.com, vincenzo.frascino@arm.com, mark.rutland@arm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, pasha.tatashin@soleen.com, allison@lohutok.net, masahiroy@kernel.org, bhsharma@redhat.com, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr, prsriva@linux.microsoft.com, balajib@linux.microsoft.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org References: <20201219175713.18888-1-nramas@linux.microsoft.com> <20201219175713.18888-3-nramas@linux.microsoft.com> <7a347c8f2a76fc80551a3dfcb66b0eec9b024a90.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <71764175-4007-2828-f882-9215c062330a@linux.microsoft.com> Date: Tue, 22 Dec 2020 13:02:10 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <7a347c8f2a76fc80551a3dfcb66b0eec9b024a90.camel@linux.ibm.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/20 11:45 AM, Mimi Zohar wrote: > On Tue, 2020-12-22 at 10:53 -0800, Lakshmi Ramasubramanian wrote: >> On 12/22/20 6:26 AM, Mimi Zohar wrote: >> >> Hi Mimi, >> >>> >>> On Sat, 2020-12-19 at 09:57 -0800, Lakshmi Ramasubramanian wrote: >>>> >>>> diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile >>>> index 4aff6846c772..b6c52608cb49 100644 >>>> --- a/arch/powerpc/kexec/Makefile >>>> +++ b/arch/powerpc/kexec/Makefile >>>> @@ -9,13 +9,6 @@ obj-$(CONFIG_PPC32) += relocate_32.o >>>> >>>> obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o >>>> >>>> -ifdef CONFIG_HAVE_IMA_KEXEC >>>> -ifdef CONFIG_IMA >>>> -obj-y += ima.o >>>> -endif >>>> -endif >>> >>> Notice how "kexec/ima.o" is only included if the architecture supports >>> it and IMA is configured. In addition only if CONFIG_IMA_KEXEC is >>> configured, is the IMA measurement list carried across kexec. After >>> moving the rest of ima.c to drivers/of/kexec.c, this changes. Notice >>> how drivers/of/Kconfig includes kexec.o: >>> >>> obj-$(CONFIG_KEXEC_FILE) += kexec.o >>> >>> It is not dependent on CONFIG_HAVE_IMA_KEXEC. Shouldn't all of the >>> functions defined in ima.c being moved to kexec.o be defined within a >>> CONFIG_HAVE_IMA_KEXEC ifdef? >>> >> >> Thanks for reviewing the changes. >> >> In "drivers/of/kexec.c" the function remove_ima_buffer() is defined >> under "#ifdef CONFIG_HAVE_IMA_KEXEC" >> >> setup_ima_buffer() is defined under "#ifdef CONFIG_IMA_KEXEC" - the same >> way it was defined in "arch/powerpc/kexec/ima.c". >> >> As you know, CONFIG_IMA_KEXEC depends on CONFIG_HAVE_IMA_KEXEC (as >> defined in "security/integrity/ima/Kconfig"). >> >> ima_get_kexec_buffer() and ima_free_kexec_buffer() are unconditionally >> defined in "drivers/of/kexec.c" even though they are called only when >> CONFIG_HAVE_IMA_KEXEC is enabled. I will update these two functions to >> be moved under "#ifdef CONFIG_HAVE_IMA_KEXEC" > > The issue is the reverse. CONFIG_HAVE_IMA_KEXEC may be enabled without > CONFIG_IMA_KEXEC being enabled. This allows the architecture to > support carrying the measurement list across kexec, but requires > enabling it at build time. > > Only if CONFIG_HAVE_IMA_KEXEC is enabled should any of these functions > be compiled at build. This allows restoring the previous IMA > measurement list, even if CONFIG_IMA_KEXEC is not enabled. > > Only if CONFIG_IMA_KEXEC is enabled, should carrying the measurement > list across kexec be enabled. See how arch_ima_add_kexec_buffer, > write_number, setup_ima_buffer are ifdef'ed in > arch/powerpc/kexec/ima.c. > Yes - I agree. I will make the following changes: => Enable the functions moved from "arch/powerpc/kexec/ima.c" to "drivers/of/kexec.c" only when CONFIG_HAVE_IMA_KEXEC is enabled. => Also, compile write_number() and setup_ima_buffer() only when CONFIG_IMA_KEXEC is enabled. thanks, -lakshmi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C533C433DB for ; Tue, 22 Dec 2020 21:03:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FB4A21973 for ; Tue, 22 Dec 2020 21:03:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FB4A21973 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h/rYFGFpqbI2/vW1iu0dGza6WCZMs0BHczKIx39AWIU=; b=vkag+7LSlNs9ynYLSc38s4Ds9 oM50ewmrs70GrBAxkMAhW++xiEs6j5G+mUyfYJj5ytFaA8bASyeEuq/dIkL+FpOfoLOBOILua8EYp YZiifV/+DmWjQRxl4m7BlkR+mDs8J1/veSq9gDC9UD4CGsmxBIHuO+ZU6H9lZnRpuspLiTuJz8xPB oBIR0rynHbeFCEa9PijYZtF30Jg8874tkXSgG6p1T+EJFFulkjaxaayhUv7wF3xK/0z62vZnz6Tg2 V/vpFXPbmRDyxD/cyvyekwC2JraeqIqaoYTYKC7WiJKDUq7vHIseiQOnPNrx9az3GAlaWaq4xfMt3 qGfxd2duA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kronR-0001tG-IF; Tue, 22 Dec 2020 21:02:17 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kronO-0001sq-JR for linux-arm-kernel@lists.infradead.org; Tue, 22 Dec 2020 21:02:15 +0000 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 4120C20B83DE; Tue, 22 Dec 2020 13:02:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4120C20B83DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1608670931; bh=6jBy3EfwQSpNBhU5WRPubRpUKsySzSS/D79lOdmUiIk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=jVWqQ45I3EQZdPHDigc8cKWWgxa9sVToULn+2GHy3TL3M+M+7LTMeYaVVfp+mkwMf QsgUzWY2XrnIYd9hT/UP1VXBWdb9MqSLawkbHDysmA4Yfrg5DcO/IMC5bV/GednnYX 7EJyQYe2Qyi58TLjjqOYGlJTnJCWUdjWoU0Fum5k= Subject: Re: [PATCH v13 2/6] powerpc: Move arch independent ima kexec functions to drivers/of/kexec.c To: Mimi Zohar , bauerman@linux.ibm.com, robh@kernel.org, takahiro.akashi@linaro.org, gregkh@linuxfoundation.org, will@kernel.org, catalin.marinas@arm.com, mpe@ellerman.id.au References: <20201219175713.18888-1-nramas@linux.microsoft.com> <20201219175713.18888-3-nramas@linux.microsoft.com> <7a347c8f2a76fc80551a3dfcb66b0eec9b024a90.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <71764175-4007-2828-f882-9215c062330a@linux.microsoft.com> Date: Tue, 22 Dec 2020 13:02:10 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <7a347c8f2a76fc80551a3dfcb66b0eec9b024a90.camel@linux.ibm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201222_160214_890886_024700E0 X-CRM114-Status: GOOD ( 19.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, benh@kernel.crashing.org, bhsharma@redhat.com, tao.li@vivo.com, paulus@samba.org, vincenzo.frascino@arm.com, frowand.list@gmail.com, sashal@kernel.org, masahiroy@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, serge@hallyn.com, devicetree@vger.kernel.org, pasha.tatashin@soleen.com, prsriva@linux.microsoft.com, hsinyi@chromium.org, allison@lohutok.net, christophe.leroy@c-s.fr, mbrugger@suse.com, balajib@linux.microsoft.com, dmitry.kasatkin@gmail.com, linux-kernel@vger.kernel.org, james.morse@arm.com, linux-integrity@vger.kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/22/20 11:45 AM, Mimi Zohar wrote: > On Tue, 2020-12-22 at 10:53 -0800, Lakshmi Ramasubramanian wrote: >> On 12/22/20 6:26 AM, Mimi Zohar wrote: >> >> Hi Mimi, >> >>> >>> On Sat, 2020-12-19 at 09:57 -0800, Lakshmi Ramasubramanian wrote: >>>> >>>> diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile >>>> index 4aff6846c772..b6c52608cb49 100644 >>>> --- a/arch/powerpc/kexec/Makefile >>>> +++ b/arch/powerpc/kexec/Makefile >>>> @@ -9,13 +9,6 @@ obj-$(CONFIG_PPC32) += relocate_32.o >>>> >>>> obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o >>>> >>>> -ifdef CONFIG_HAVE_IMA_KEXEC >>>> -ifdef CONFIG_IMA >>>> -obj-y += ima.o >>>> -endif >>>> -endif >>> >>> Notice how "kexec/ima.o" is only included if the architecture supports >>> it and IMA is configured. In addition only if CONFIG_IMA_KEXEC is >>> configured, is the IMA measurement list carried across kexec. After >>> moving the rest of ima.c to drivers/of/kexec.c, this changes. Notice >>> how drivers/of/Kconfig includes kexec.o: >>> >>> obj-$(CONFIG_KEXEC_FILE) += kexec.o >>> >>> It is not dependent on CONFIG_HAVE_IMA_KEXEC. Shouldn't all of the >>> functions defined in ima.c being moved to kexec.o be defined within a >>> CONFIG_HAVE_IMA_KEXEC ifdef? >>> >> >> Thanks for reviewing the changes. >> >> In "drivers/of/kexec.c" the function remove_ima_buffer() is defined >> under "#ifdef CONFIG_HAVE_IMA_KEXEC" >> >> setup_ima_buffer() is defined under "#ifdef CONFIG_IMA_KEXEC" - the same >> way it was defined in "arch/powerpc/kexec/ima.c". >> >> As you know, CONFIG_IMA_KEXEC depends on CONFIG_HAVE_IMA_KEXEC (as >> defined in "security/integrity/ima/Kconfig"). >> >> ima_get_kexec_buffer() and ima_free_kexec_buffer() are unconditionally >> defined in "drivers/of/kexec.c" even though they are called only when >> CONFIG_HAVE_IMA_KEXEC is enabled. I will update these two functions to >> be moved under "#ifdef CONFIG_HAVE_IMA_KEXEC" > > The issue is the reverse. CONFIG_HAVE_IMA_KEXEC may be enabled without > CONFIG_IMA_KEXEC being enabled. This allows the architecture to > support carrying the measurement list across kexec, but requires > enabling it at build time. > > Only if CONFIG_HAVE_IMA_KEXEC is enabled should any of these functions > be compiled at build. This allows restoring the previous IMA > measurement list, even if CONFIG_IMA_KEXEC is not enabled. > > Only if CONFIG_IMA_KEXEC is enabled, should carrying the measurement > list across kexec be enabled. See how arch_ima_add_kexec_buffer, > write_number, setup_ima_buffer are ifdef'ed in > arch/powerpc/kexec/ima.c. > Yes - I agree. I will make the following changes: => Enable the functions moved from "arch/powerpc/kexec/ima.c" to "drivers/of/kexec.c" only when CONFIG_HAVE_IMA_KEXEC is enabled. => Also, compile write_number() and setup_ima_buffer() only when CONFIG_IMA_KEXEC is enabled. thanks, -lakshmi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel