Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9464230pxu; Mon, 28 Dec 2020 17:29:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMtKfqIN4DD8t4e7NRS46tMEQRW17Ou1E7c5ZPMS9KnZH2VL3t0AIDgNLrYSIQ24W9b45g X-Received: by 2002:a17:906:1291:: with SMTP id k17mr44011975ejb.288.1609205383314; Mon, 28 Dec 2020 17:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609205383; cv=none; d=google.com; s=arc-20160816; b=fj2jbeptL01BRMmqBD3F832Wi0xhcGDRAEa5Qi7d0OzJnOArz5ca5Nlrt952oULxjX 0Bzx9ySSvwaB+fXvSTK8JENyCTGirw9ymR4r80XUbx//N5cSC7o63fPuQKjJvhJGjnJe Kj5O1jWK6PfA6mUqQg5v0z2Ft7UROxilmjAm5nOISZBlOiC/DWKR+QaVTcLuDPIU/VRD HrkHHF+pt6NN/9/apWWEMQQfeF3Ke6NpkixZymlvcXBdBi7wlVC9dteJjEbb5Akm/ZdE bmtWK6Uy4lZYY44cKpN9zOT//S/eobvcDOAXR0Jj4wSMJRGP5wwPkDbxWYgp6BmMKpCE 07Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8/1xH0Vf0C5OsaL2hdsfSl4lyI7O+tsVABhGj4dOmJo=; b=slASObIfmv8dhI0Gcc9rrb8ZGYnvT0hHj7RcaVn9s9gAKC0jketrf2tiHLYMvj7jAa 7O+s8Fq8+AM66c06KTcq6xxmg4QVqh5MD83TNP3T+hxqx5tbHEKCTHeY88M6gntbQBYD UQCSwf0q6mlpRMaAkguYwOgfCdBtdTuAmURjC9en0FQt6stsPa8nlUdSUXyIrxUcDqV+ tuUbF5jbNHkOzUDcc2bxfX96Yu7guUk9oxxXFZMfq/sbbw8CXa2E36ZtGlW5mAipgjHF kvLer8uMdj3i90cA3VLDhMYfHZRQoYrisaUkdt8VAiY8qWaJFC1Do15znIDVg9dLEsGl 08kQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si18862862eji.737.2020.12.28.17.29.21; Mon, 28 Dec 2020 17:29:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732113AbgL1W4a (ORCPT + 99 others); Mon, 28 Dec 2020 17:56:30 -0500 Received: from elvis.franken.de ([193.175.24.41]:43952 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729632AbgL1W0V (ORCPT ); Mon, 28 Dec 2020 17:26:21 -0500 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1ku0xP-00069Q-00; Mon, 28 Dec 2020 23:25:39 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 8475EC05C4; Mon, 28 Dec 2020 23:25:32 +0100 (CET) Date: Mon, 28 Dec 2020 23:25:32 +0100 From: Thomas Bogendoerfer To: Paul Cercueil Cc: Nathan Chancellor , Nick Desaulniers , od@zcrc.me, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, stable@vger.kernel.org Subject: Re: [PATCH] MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB Message-ID: <20201228222532.GA24926@alpha.franken.de> References: <20201216233956.280068-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201216233956.280068-1-paul@crapouillou.net> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 11:39:56PM +0000, Paul Cercueil wrote: > 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_le(). > > 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 > --- > arch/mips/boot/compressed/decompress.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c > index c61c641674e6..47c07990432b 100644 > --- a/arch/mips/boot/compressed/decompress.c > +++ b/arch/mips/boot/compressed/decompress.c > @@ -117,7 +117,7 @@ void decompress_kernel(unsigned long boot_heap_start) > 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); gives me following error arch/mips/boot/compressed/decompress.c:120:16: error: implicit declaration of function ‘get_unaligned_le32’ [-Werror=implicit-function-declaration] image_size = get_unaligned_le32((void *)&__image_end - 4); I've added #include which fixes the compile error, but I'm wondering why the patch compiled for you ? Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]