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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 EB66DC47080 for ; Mon, 31 May 2021 19:39:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A316361260 for ; Mon, 31 May 2021 19:39:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A316361260 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc: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=J3QlE5sTRzOV9KscvKVh/REUHBS9adrFQ1XAojaaSy0=; b=W3HiFMxfwkbPfK 2AuZ6cmkbD5SB08J5xB87lZ+FbGBz9Ctp0mLZmC0h4Q53Wzgjo/qpVTU1jllsifB9uaQ9gux3n0xg qW4cQ9bDbihgJwH3P7/eJovmDJwyjbUx8sNVkrHq4E+mQnOYl8Nd/+ch2Lrx6k5TaEEIwMn2oJgAB OR3mwBsBU2BD14GOhZySUHqPI3X+6ABgE6Z4GWhmGQTpKfTI4d1yfpkGBs2ng5FstY00l/TULxAfi Gqcd0huezXUKuayJQVJ1Z6eGtBcKOzjXwi9/dh6XWAKexWcStck7u1etiVnZR/B5iPXz1NlhrIcbL FwigBrbhYOE0eU77b7eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnnji-00DFQ7-0K; Mon, 31 May 2021 19:38:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnnjc-00DFP3-Us; Mon, 31 May 2021 19:38:02 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C288610A6; Mon, 31 May 2021 19:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622489880; bh=DxmToG3L31wIR+9AdgK9OhgVLZyRMZ/xTbCfSGTuyhQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QBl6dcmn1Rx7zOlV2n2Nl+2g6JAtjkgqPcHvclhsLlHustjWEFdadRTHjjlkqK4qs +M3oZt+zsuDljk+HeIXVQJEnHucadsgqqhkWNgG2qgZjxfautiQTmjDPUv80T0lG5v Sw1owFkPyCbIyUm99iqkdEEA6vaz4J8WT49k3k5IC5sMAN1GUJEgXyFXSdrHRJ0h1Z Q7AsdsrxL5OXBH2I6b/kFwevlUu1upQVPfZ3jmof8zEdjFv/x6zGEh7t4NuEp3SNsM EuBD7uOZyXO0LDJcnF/LNhm/mU4kutwi0vpzUKB/ZI/Do3GIuteNLPXUg1rcVFxH7R AgIgYEy/jzx3w== Received: by mail-ot1-f53.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so12022314otg.2; Mon, 31 May 2021 12:38:00 -0700 (PDT) X-Gm-Message-State: AOAM531J33p8YVMcmYS2M1tEWqB+kXNumIeyrmyUbxgLexhetjskTnTS vernswCaJ7ze6qQHwHWOPxtw46/JktX+4A3cyBk= X-Google-Smtp-Source: ABdhPJxPwjDBqtCO2vVdoCZIFP8PKpzd7N2ZxjbZBqdZTvAj4/TEDt5tvoyFrMZSG6HJFmhLRxOFwg7krnBvo9m5Hkg= X-Received: by 2002:a9d:69c5:: with SMTP id v5mr17902553oto.108.1622489879945; Mon, 31 May 2021 12:37:59 -0700 (PDT) MIME-Version: 1.0 References: <20210531095720.77469-1-maz@kernel.org> <20210531095720.77469-2-maz@kernel.org> In-Reply-To: <20210531095720.77469-2-maz@kernel.org> From: Ard Biesheuvel Date: Mon, 31 May 2021 21:37:49 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/5] arm64: kexec_file: Forbid non-crash kernels To: Marc Zyngier Cc: kexec@lists.infradead.org, Linux ARM , Linux Kernel Mailing List , Catalin Marinas , Will Deacon , Mark Rutland , James Morse , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Eric Biederman , Bhupesh SHARMA , AKASHI Takahiro , Dave Young , Andrew Morton , Moritz Fischer , Android Kernel Team , "# 3.4.x" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210531_123801_059238_E9C48EB8 X-CRM114-Status: GOOD ( 23.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Mon, 31 May 2021 at 11:57, Marc Zyngier wrote: > > It has been reported that kexec_file doesn't really work on arm64. > It completely ignores any of the existing reservations, which results > in the secondary kernel being loaded where the GICv3 LPI tables live, > or even corrupting the ACPI tables. > > Since only crash kernels are imune to this as they use a reserved > memory region, disable the non-crash kernel use case. Further > patches will try and restore the functionality. > > Reported-by: Moritz Fischer > Signed-off-by: Marc Zyngier > Cc: stable@vger.kernel.org # 5.10 Acked-by: Ard Biesheuvel ... but do we really only need this in 5.10 and not earlier? > --- > arch/arm64/kernel/kexec_image.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c > index 9ec34690e255..acf9cd251307 100644 > --- a/arch/arm64/kernel/kexec_image.c > +++ b/arch/arm64/kernel/kexec_image.c > @@ -145,3 +145,23 @@ const struct kexec_file_ops kexec_image_ops = { > .verify_sig = image_verify_sig, > #endif > }; > + > +/** > + * arch_kexec_locate_mem_hole - Find free memory to place the segments. > + * @kbuf: Parameters for the memory search. > + * > + * On success, kbuf->mem will have the start address of the memory region found. > + * > + * Return: 0 on success, negative errno on error. > + */ > +int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) > +{ > + /* > + * For the time being, kexec_file_load isn't reliable except > + * for crash kernel. Say sorry to the user. > + */ > + if (kbuf->image->type != KEXEC_TYPE_CRASH) > + return -EADDRNOTAVAIL; > + > + return kexec_locate_mem_hole(kbuf); > +} > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel