Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2480123pxb; Mon, 18 Jan 2021 20:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYQz5BOg44qDhQr8cqQtJB6MDHJVbNOomuAUtLN+vPDDwNj4qemRr3JleMjzG7eYzCyA8I X-Received: by 2002:a17:906:2898:: with SMTP id o24mr1744908ejd.215.1611031101321; Mon, 18 Jan 2021 20:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611031101; cv=none; d=google.com; s=arc-20160816; b=TmFoExo8s+KnviL76/jhss773x0thPShY/LAu437h5kRRFmWmcBTdqjlkTBFLjkYWc teg9hhLQ0WXGB8GiXvFbg7B1y41aPGplFKm0PpTM/Tf3cPok1eoMxv+pu2nK5PCDfd3m EuyTc3Zxh+Gpl/mcVkZOEFH7dnVfoJdE0RJwxb5LkNkrszToSv9BEOsnJIGaEyquiov9 3CzPJdiEJQWuvnS5duNaykp66zZF5v+Ir2WalKomlDHHe+Wwpz/EUc2ys11Iz8CF9MPi FZqln8QU4gW0Mu+OvS0pB3Q6z70VRCNQumUnBqsN4RYRxHl/00sQYqlGGwrq1webw6qC DiSw== 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=tG1QbgadDGLhIMkiyH0NJalFgl54E2Alv/9+ilt/3HM=; b=u8BUfjBGrU7dkAuox4gMn86Bam2EZjCa0kOVS+SwjnyWcvzKdnLIF9w7AlsUNFm3k/ 8VMQUi42Gi0iaBH3ZHLObEb7CCdWddpV2we3686iEH4Wc64Mz9+9Hse2cQw4wTmXzkE3 sSPwypr4ZAJQHtJCVizrvdG4hL2lYhTaFP2U38DPBIckAIijmf7xZKHaEO7qE4SP1Dke NcOsO3qtaDj9YnKTkwTRjhNBQxUxkJ7EWQHVct7YeLQkis/BtJi1ttsvUsrUvQeSY39B xiOs2NDoepisPs1wu0zbseAF7iP6D6+ai6QvDPqLrOtG988JtiMK5hqEIUIoHEokKpad UTfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="W/k9d2wc"; 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 i13si2858340ejz.170.2021.01.18.20.37.58; Mon, 18 Jan 2021 20:38:21 -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="W/k9d2wc"; 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 S2393119AbhARPNM (ORCPT + 99 others); Mon, 18 Jan 2021 10:13:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:37702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390440AbhARLmK (ORCPT ); Mon, 18 Jan 2021 06:42:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B236D22C9E; Mon, 18 Jan 2021 11:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610970089; bh=m4ymd2fNxXxFif/SvlMsS4oYWteIPT4NYyORcE9nDo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W/k9d2wcOLf5oPIl8htRBM6NaWRvfRBuice6bSL0o1fDqgSUdUtX3zdoVL8uYE99t 6DiLi1jGKIL5SKvXkz0cJQ0ud0TWjMMp1jenKUqc/OGNlGWjKxeTwv2RcuV/1s2yDC p459PZZT98l2ma/95OvRLRkGvHvB09PlTONFtWs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Nick Desaulniers , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Bogendoerfer Subject: [PATCH 5.10 031/152] MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB Date: Mon, 18 Jan 2021 12:33:26 +0100 Message-Id: <20210118113354.271172142@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210118113352.764293297@linuxfoundation.org> References: <20210118113352.764293297@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: Paul Cercueil commit 4d4f9c1a17a3480f8fe523673f7232b254d724b7 upstream. The compressed payload is not necesarily 4-byte aligned, at least when compiling with Clang. In that case, the 4-byte value appended to the compressed payload that corresponds to the uncompressed kernel image size must be read using get_unaligned_le32(). This fixes Clang-built kernels not booting on MIPS (tested on a Ingenic JZ4770 board). Fixes: b8f54f2cde78 ("MIPS: ZBOOT: copy appended dtb to the end of the kernel") Cc: # v4.7 Signed-off-by: Paul Cercueil Reviewed-by: Nick Desaulniers Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/boot/compressed/decompress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/mips/boot/compressed/decompress.c +++ b/arch/mips/boot/compressed/decompress.c @@ -13,6 +13,7 @@ #include #include +#include /* * These two variables specify the free mem region @@ -117,7 +118,7 @@ void decompress_kernel(unsigned long boo dtb_size = fdt_totalsize((void *)&__appended_dtb); /* last four bytes is always image size in little endian */ - image_size = le32_to_cpup((void *)&__image_end - 4); + image_size = get_unaligned_le32((void *)&__image_end - 4); /* copy dtb to where the booted kernel will expect it */ memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,