Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp864796pxb; Tue, 1 Feb 2022 12:02:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUXW2RfGJsxibCiyEMAcTg37ipSOXN2bfqARKOCCmJjtsIC2w29GYcxbjnp11kko7ffu3h X-Received: by 2002:a17:90b:4c46:: with SMTP id np6mr4131893pjb.197.1643745754885; Tue, 01 Feb 2022 12:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745754; cv=none; d=google.com; s=arc-20160816; b=uBefpwZdmWl7hhv0SUMpUVLv2hbSp4zZtWfIJ90gBv22Qc3Yewp7S2UHSYZ9nwE+8t fH42KQDwSaIiXPQ9gVuuSqv252iQbzUMhXnZN5mJnVqugSxTdIRNSh02ba6xaj/itFq7 wItW/uHJH2nRfPisUtK8xJHFq8pFZ7ei6Ju+LO7jD963CUf+IgCdng9QUvHhm3kgucxw /Z1LGaBt3s3GWBjgf4NuJprBSTfEKwD93u8WbGnulLsoIO+lH41/Hsz8/JrNVXZulAUH 3cu9pRiLN++scgwJ1KlE4DuutcAWVm2vg1tS3M1eFNmED4V0D0D9dA9TP+CgKtB0Beka vfXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kjLQYVe08lVyMEWvaIxWNkN5AikOjSOXGWVo06qo+9k=; b=K02rjkBhlrfup0VpWQvA7sYMLA2eGKdidBt4o0ewkHW++N2rauVTeYlya2S+1JCpis VI+uowDAPHx+zjcv5UwJmofIdEcgG8PB52T5/5ajsAewerFEl8QOIzFOne7yp7Ooce0C 09lp41+jIhOi5N8IuyD+/Wl144ckDzB8AjjohaZJGCRIJHJyIlNsJ9NaWNO6qN2BpSw3 jJMcCrNlqwcWSHrRFT0KmR0LaqwadwO3r/U03Z3CZgtyl9RqsE8CRyZ87Y3a9e1T2t8n 2HzzMZFciMF+ABpqGyiXSmKkKzVMDZ8QAFkDt79o+PhZ7RT90T/DnywXGk6044YOzvy2 cGjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v2S3I6uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ls16si3741669pjb.119.2022.02.01.12.02.22; Tue, 01 Feb 2022 12:02:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v2S3I6uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376808AbiAaLNU (ORCPT + 99 others); Mon, 31 Jan 2022 06:13:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377243AbiAaLJu (ORCPT ); Mon, 31 Jan 2022 06:09:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0493FC0613A2; Mon, 31 Jan 2022 03:06:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8284B82A5C; Mon, 31 Jan 2022 11:06:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 034D4C340EE; Mon, 31 Jan 2022 11:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627202; bh=Bw3JlHcsA59KK7BZytbzclqcj9Dlm72ho+5EOc7ejeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v2S3I6uyYBNZK0LZYJ9zCPMhA+Adp7vsF0e3DmUQ3F7OxNB+vxSFJ/mjAKTvzYjsY J7EpU9iDUJJlPmY2Kz3BDred7pNWOVqx5BIoFzskva1cTXjc3TcfQ6yMBmidSzS0pr KWim36KzvLW67kt7E6JB1HVLvU3BtsJ9hSbExu78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mihai Carabas , Ard Biesheuvel , Sasha Levin Subject: [PATCH 5.10 077/100] efi/libstub: arm64: Fix image check alignment at entry Date: Mon, 31 Jan 2022 11:56:38 +0100 Message-Id: <20220131105223.021387714@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mihai Carabas [ Upstream commit e9b7c3a4263bdcfd31bc3d03d48ce0ded7a94635 ] The kernel is aligned at SEGMENT_SIZE and this is the size populated in the PE headers: arch/arm64/kernel/efi-header.S: .long SEGMENT_ALIGN // SectionAlignment EFI_KIMG_ALIGN is defined as: (SEGMENT_ALIGN > THREAD_ALIGN ? SEGMENT_ALIGN : THREAD_ALIGN) So it depends on THREAD_ALIGN. On newer builds this message started to appear even though the loader is taking into account the PE header (which is stating SEGMENT_ALIGN). Fixes: c32ac11da3f8 ("efi/libstub: arm64: Double check image alignment at entry") Signed-off-by: Mihai Carabas Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- drivers/firmware/efi/libstub/arm64-stub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index c1b57dfb12776..415a971e76947 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -119,9 +119,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, if (image->image_base != _text) efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); - if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN)) - efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n", - EFI_KIMG_ALIGN >> 10); + if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN)) + efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n", + SEGMENT_ALIGN >> 10); kernel_size = _edata - _text; kernel_memsize = kernel_size + (_end - _edata); -- 2.34.1