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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 65079C4363A for ; Fri, 30 Oct 2020 11:54:52 +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 D23FC20706 for ; Fri, 30 Oct 2020 11:54:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Yn3uNkCF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="P639Eq7j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D23FC20706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1WfCRfGsPwTyttk4pg3JTMCJPd/L6EOX7vBTie4Xju4=; b=Yn3uNkCFFftE7epGyz3bdKlWi SfGQQPgpEPphxSvfjuxEzuIQb40iLQXTr/Ussj1ym0H+5kEsdW76t4pZvmFnzbB3BXFjvda7G0DPK 6OQ7QuLm6QeI8gxvuHK2wLJB9z1stUyDWqeGAES/sa8Ce9LyCBq5ygrCTvLCi8UsfcLoOJOoXcift b18VP2344aSDBn2wM8fY23jKlZJHQovn3ArjVMF1JEL99BY5x9Y2gfEpShPRJWO7qaz8iSVUgRIAM h4RPTK1r5MVwNZrF76t2fgE4SzWrPHL6PiqWpEIUsSuAnBJU0bhKGfB/xx1muE7ln111CnNx3lUSF rnqvW+SyQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYSyT-00079t-BO; Fri, 30 Oct 2020 11:53:41 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYSyQ-00078o-Mq for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 11:53:39 +0000 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 85A0020706 for ; Fri, 30 Oct 2020 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604058817; bh=d3fuMxWlzDmtJJrL2Md7MIp8HAK24XJci5Rj9/IXNek=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=P639Eq7j8YcRl1gPHu3NalkhSdzAgeREjxAHYFtNfZ7GJFEfqabKpISxNCUeguPj7 tZgHFaKIfT87mpWK9ZLJoqfZWoOyDjXLApMaO+AwJEcDLRVR5Bf8F3bmwtOxa2bZpB 8xT/YuQW+hpuGxNSXYwIqPBoBUrv0dLxFI5amGD0= Received: by mail-oi1-f174.google.com with SMTP id x203so6343142oia.10 for ; Fri, 30 Oct 2020 04:53:37 -0700 (PDT) X-Gm-Message-State: AOAM530m6LLEm2GYepTlzL6zolFhXOCNm/+PStYX64r0RGimIqtcODpa Le5KlNrFqHd6sBB7ux5cz6pVbE/NmzckSyuceDo= X-Google-Smtp-Source: ABdhPJzgiMhx0rV2JinMkA8Ww1A1B72xR8FBexBi9QJsDuwAWFMOSjFL8BwlpiIHRIAnVKfRfajVNQgJV1+RiQPhRDo= X-Received: by 2002:aca:5c82:: with SMTP id q124mr1316465oib.33.1604058816714; Fri, 30 Oct 2020 04:53:36 -0700 (PDT) MIME-Version: 1.0 References: <20201030060840.1810-1-clin@suse.com> <20201030060840.1810-4-clin@suse.com> In-Reply-To: <20201030060840.1810-4-clin@suse.com> From: Ard Biesheuvel Date: Fri, 30 Oct 2020 12:53:25 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/3] arm64/ima: add ima_arch support To: Chester Lin X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_075338_925197_9DE70CC2 X-CRM114-Status: GOOD ( 26.19 ) 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: X86 ML , linux-efi , Dmitry Kasatkin , "H. Peter Anvin" , James Morris , Mimi Zohar , Linux Kernel Mailing List , "Lee, Chun-Yi" , linux-security-module@vger.kernel.org, Ingo Molnar , Borislav Petkov , Catalin Marinas , Thomas Gleixner , Will Deacon , linux-integrity , Linux ARM , "Serge E. Hallyn" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 30 Oct 2020 at 07:09, Chester Lin wrote: > > Add arm64 IMA arch support. The code and arch policy is mainly inherited > from x86. > > Signed-off-by: Chester Lin > --- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/Makefile | 2 ++ > arch/arm64/kernel/ima_arch.c | 43 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 46 insertions(+) > create mode 100644 arch/arm64/kernel/ima_arch.c > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index a42e8d13cc88..496a4a26afc6 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -201,6 +201,7 @@ config ARM64 > select SWIOTLB > select SYSCTL_EXCEPTION_TRACE > select THREAD_INFO_IN_TASK > + imply IMA_SECURE_AND_OR_TRUSTED_BOOT if EFI > help > ARM 64-bit (AArch64) Linux support. > > diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile > index bbaf0bc4ad60..0f6cbb50668c 100644 > --- a/arch/arm64/kernel/Makefile > +++ b/arch/arm64/kernel/Makefile > @@ -69,3 +69,5 @@ extra-y += $(head-y) vmlinux.lds > ifeq ($(CONFIG_DEBUG_EFI),y) > AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\"" > endif > + > +obj-$(CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT) += ima_arch.o > diff --git a/arch/arm64/kernel/ima_arch.c b/arch/arm64/kernel/ima_arch.c > new file mode 100644 > index 000000000000..564236d77adc > --- /dev/null > +++ b/arch/arm64/kernel/ima_arch.c > @@ -0,0 +1,43 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright (C) 2018 IBM Corporation > + */ > +#include > +#include > +#include > + > +bool arch_ima_get_secureboot(void) > +{ > + static bool sb_enabled; > + static bool initialized; > + > + if (!initialized & efi_enabled(EFI_BOOT)) { > + sb_enabled = ima_get_efi_secureboot(); > + initialized = true; > + } > + > + return sb_enabled; > +} > + > +/* secure and trusted boot arch rules */ > +static const char * const sb_arch_rules[] = { > +#if !IS_ENABLED(CONFIG_KEXEC_SIG) > + "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig", > +#endif /* CONFIG_KEXEC_SIG */ > + "measure func=KEXEC_KERNEL_CHECK", > +#if !IS_ENABLED(CONFIG_MODULE_SIG) > + "appraise func=MODULE_CHECK appraise_type=imasig", > +#endif > + "measure func=MODULE_CHECK", > + NULL > +}; > + > +const char * const *arch_get_ima_policy(void) > +{ > + if (IS_ENABLED(CONFIG_IMA_ARCH_POLICY) && arch_ima_get_secureboot()) { > + if (IS_ENABLED(CONFIG_MODULE_SIG)) > + set_module_sig_enforced(); > + return sb_arch_rules; > + } > + return NULL; > +} > -- > 2.28.0 > Can we move all this stuff into security/integrity/ima/ima_efi.c instead? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel