Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3472500pxf; Mon, 22 Mar 2021 07:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIQ7WYYffS2EMtmHgNildNnD9MdLZtIuCT1IyKbE7VWQRF5TOjIN9awfzISJcB1+LJ4bPC X-Received: by 2002:a17:906:9714:: with SMTP id k20mr19534280ejx.519.1616422558906; Mon, 22 Mar 2021 07:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616422558; cv=none; d=google.com; s=arc-20160816; b=tJSTRGobAX0LtWAO07DmrQQvTpeWDGswOHX8NyFyiMCAVoNVj/lz0B5qQO//dUcVzI QmmCMKqyjVqj9wRsWrtxVBBIAhv8g6IJlT4+cZ0UCz+7K8mFGDfKgzrPMWe67EXH8s7K 20ZiEQApQg9TSNmUPfB9rCEC2I7q64Il5rKjJduEGDI6WBecUi4T6s7LECl8geSp8++x 7DGKeM6sgY5rkDhuvvaTFP7Ksd1Pc56NPcNcvr2+zHxE/JinEpi+CaJMdjhr0kDsGQ4u lz9htmjaI6UusRt8Al5IPEeCJvco3S8wsfIEavivusQYMI/UYLRui6Hx2YmS21xPQmGy r6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+4yh4MCaMjCQZ43lV2b3NMY6HnAMnpQQHM0Vz8ZLtI8=; b=r8LQsasIibOSBJ3Nyg5SLEfYCrdNiAIGU/S4UBdg5b2C85rzBVM0yxDTTLVxyiym0j SDRgjjg5hgR+FCAzoRIp5mZaBJq1BO6h/k0T1dukmN8jmYghkhmth/9DiBF8Dnf7mWrm fZF/HuuwECVuD2TVY9oLrboRjoTdR4dQ5k9Kh8LRLZxvfedX8SmZXFrxTbn/p53QWQrU DmJhBU8+c9kDwRYbC/FxRbw8miuzaO9iKWYBS72UDX6QF9RQvlnRTKebo3HkjVdfRXFE 1IixQgv8nmxN4PMdkmRtF1VjUa5Q7DpztzXdECk6O+PFX3rwbRoL0JIrEXSb5Mc0aVpm ynoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ks6UgnX4; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jl2si11994913ejc.488.2021.03.22.07.15.35; Mon, 22 Mar 2021 07:15:58 -0700 (PDT) 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=@linaro.org header.s=google header.b=ks6UgnX4; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbhCVOO1 (ORCPT + 99 others); Mon, 22 Mar 2021 10:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbhCVOOS (ORCPT ); Mon, 22 Mar 2021 10:14:18 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEEDEC061756 for ; Mon, 22 Mar 2021 07:14:17 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id jy13so21517134ejc.2 for ; Mon, 22 Mar 2021 07:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+4yh4MCaMjCQZ43lV2b3NMY6HnAMnpQQHM0Vz8ZLtI8=; b=ks6UgnX43wsvsZOr+tvl4pF7ZmWygwrO3DHEgdKqCXz+YQxpFvXH2tP8ZNAeqC+QcP QGFYnM0MwEG6yrWilism7U6AEteYYQ7/R5FHokF9NzzfbwCbNw4vUTnYUP3lb70JI0Cr dfB60Y38wPG80kD4YInbugTSZF09sR8E3aBIUtJ58v44JDl3yMcvyOEj+ljZu9hge1ur akjI5xrobOdNTyEElrEb6zJr4NABzOCSBOWlqvevdnBe3UbOAr3NPOLX64hmjmd5Tx8I l85+hHhdrf4fLKk0oNgUFEDi6y4KzFIZUJ0M0+dLzLq1I3ox9yLr6aXQ1jd3ZDh7ub5B B53w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+4yh4MCaMjCQZ43lV2b3NMY6HnAMnpQQHM0Vz8ZLtI8=; b=qnr8ada0Wy/BUr7oydE8tBO73ypv9sVZ3lRKSkKugvZv4TT5InG6Npp10ZrC5lud9N uWz/xYd8Y40W9kRzj7Lq7yUDeTiPjJklEOLX+DQH+ORLz4toBWx/O5221hlLa2Fz6pxD cDaacoabG/Jc2x4Ss+OcPRbVeAi6cymdeT96EOp01/LlHUSuCmOoPcBOkB/LwQC9HvGS ANohnCh7nrm7qEZzhXV/U21ZyLQlihYxFlpu7YNG0kdwsBmHNbGmZwlfbWBEiTXX9ag0 4gFRY7KtyHPRnhxur4V/K/1xV8Ae4RSS1wzSTsvkgkmz2iXCzhVNdIwOBzmFQR83wW/l pllQ== X-Gm-Message-State: AOAM530GHeTV1TWYUC4Ruql9F60X98xf22EJUdVZSVVAdY2XgyCvFLUS c6TlODVVcNpRL/fEu4Zz7xucvCM/Uhp1E8pnqsrWuA== X-Received: by 2002:a17:907:720a:: with SMTP id dr10mr11853474ejc.375.1616422456310; Mon, 22 Mar 2021 07:14:16 -0700 (PDT) MIME-Version: 1.0 References: <20210322121933.746237845@linuxfoundation.org> <20210322121937.040307268@linuxfoundation.org> In-Reply-To: <20210322121937.040307268@linuxfoundation.org> From: Naresh Kamboju Date: Mon, 22 Mar 2021 19:44:05 +0530 Message-ID: Subject: Re: [PATCH 5.10 103/157] MIPS: kernel: Reserve exception base early to prevent corruption To: Greg Kroah-Hartman , Kamal Dasu , Serge Semin Cc: open list , linux-stable , Mike Rapoport , Florian Fainelli , Thomas Bogendoerfer , Sasha Levin , Serge Semin , lkft-triage@lists.linaro.org, linux-mips@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Mar 2021 at 18:14, Greg Kroah-Hartman wrote: > > From: Thomas Bogendoerfer > > [ Upstream commit bd67b711bfaa02cf19e88aa2d9edae5c1c1d2739 ] > > BMIPS is one of the few platforms that do change the exception base. > After commit 2dcb39645441 ("memblock: do not start bottom-up allocations > with kernel_end") we started seeing BMIPS boards fail to boot with the > built-in FDT being corrupted. > > Before the cited commit, early allocations would be in the [kernel_end, > RAM_END] range, but after commit they would be within [RAM_START + > PAGE_SIZE, RAM_END]. > > The custom exception base handler that is installed by > bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the > memory region allocated by unflatten_and_copy_device_tree() thus > corrupting the FDT used by the kernel. > > To fix this, we need to perform an early reservation of the custom > exception space. Additional we reserve the first 4k (1k for R3k) for > either normal exception vector space (legacy CPUs) or special vectors > like cache exceptions. > > Huge thanks to Serge for analysing and proposing a solution to this > issue. > > Fixes: 2dcb39645441 ("memblock: do not start bottom-up allocations with kernel_end") > Reported-by: Kamal Dasu > Debugged-by: Serge Semin > Acked-by: Mike Rapoport > Tested-by: Florian Fainelli > Reviewed-by: Serge Semin > Signed-off-by: Thomas Bogendoerfer > Signed-off-by: Sasha Levin > --- > arch/mips/include/asm/traps.h | 3 +++ > arch/mips/kernel/cpu-probe.c | 6 ++++++ > arch/mips/kernel/cpu-r3k-probe.c | 3 +++ > arch/mips/kernel/traps.c | 10 +++++----- mipc tinyconfig and allnoconfig builds failed on stable-rc 5.10 branch make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/1/tmp ARCH=mips CROSS_COMPILE=mips-linux-gnu- 'CC=sccache mips-linux-gnu-gcc' 'HOSTCC=sccache gcc' WARNING: modpost: vmlinux.o(.text+0x6a88): Section mismatch in reference from the function reserve_exception_space() to the function .meminit.text:memblock_reserve() The function reserve_exception_space() references the function __meminit memblock_reserve(). This is often because reserve_exception_space lacks a __meminit annotation or the annotation of memblock_reserve is wrong. FATAL: modpost: Section mismatches detected. Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them. make[2]: *** [/builds/linux/scripts/Makefile.modpost:59: vmlinux.symvers] Error 1 Here is the list of build failed, - gcc-8-allnoconfig - gcc-8-tinyconfig - gcc-9-allnoconfig - gcc-9-tinyconfig - gcc-10-allnoconfig - gcc-10-tinyconfig - clang-10-tinyconfig - clang-10-allnoconfig - clang-11-allnoconfig - clang-11-tinyconfig - clang-12-tinyconfig - clang-12-allnoconfig Reported-by: Naresh Kamboju link: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc/-/jobs/1117167411#L142 steps to reproduce: --------------------------- # TuxMake is a command line tool and Python library that provides # portable and repeatable Linux kernel builds across a variety of # architectures, toolchains, kernel configurations, and make targets. # # TuxMake supports the concept of runtimes. # See https://docs.tuxmake.org/runtimes/, for that to work it requires # that you install podman or docker on your system. # # To install tuxmake on your system globally: # sudo pip3 install -U tuxmake # # See https://docs.tuxmake.org/ for complete documentation. tuxmake --runtime podman --target-arch mips --toolchain gcc-10 --kconfig tinyconfig -- Linaro LKFT https://lkft.linaro.org