Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4204481pxu; Mon, 12 Oct 2020 12:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOUjj3jADAOCJgGjasp6UK9a+gzsb0DPXkLB2q79nz2OMJsKmSau3BhNzUg/yeMvETtpRb X-Received: by 2002:a17:906:1644:: with SMTP id n4mr30706279ejd.332.1602529880192; Mon, 12 Oct 2020 12:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602529880; cv=none; d=google.com; s=arc-20160816; b=W0vFy025GgVsLY6+XwJEw7IZdQPoHr6IUHA0xjP1/cbvZ5uBHEbCcOjc4quPO7X6JV Ykod8MWTLw/ps5Qb7VljUZ2YuNZ/sSeFZcWrn6NtwbWHdNoBXxfmM20lAGcVcIWvHse/ joCZHrvl/KEjvKkPwgWdZ0c14AKubVRLp+l7rATh9zy4kiNaFe3Yja5c3BKsnPqo8r1Q u6T0C1r+T4q5iH/qI0n24Dae9Cz09P51awrmyH62BS+qu5vmECq6pPHkPtbcquHKZk7s TU8X9Ldglefvq565tPWmMlymGTtr/hYq+xBzHFSz41hLjYIUIjbqXvbx/vg/uAj+MzOJ cNOQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AOg7nEPVkci5MIvpsM/FxvkEUDg5qI3rPMmotYN8hHc=; b=Qc+jW033znYrJkS7qufGH+ou5wRY72wfw0QOYlTSGGHEM2zyZehIHwpyKk9OeTdZ9X QV/woT0EuICpF3T18VEBLo4GA5EEUI5GChVGSDis/793xSoSjn83wsSFkeSLqTJyebbM bCLdfY49ld/H7kAfX6g7niu4vb4Di1R3UYk8CddDPq/gi6LgarPFnKacK0MSFwtbMFp2 kT3hqXqJxUhubZK0gbr2OqvgXjJBw6rUtTePF5bBKMNtzFOztNP2myRNFaJDt72N1+hF YHy9aA4VyW+TrpvF7r3QG8RWLavJ8GPLhkFtSFBz4lgLJEKALbWJO5ZnWAmOt7MMVadJ vNWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z9keOqMk; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si2376592edj.468.2020.10.12.12.10.57; Mon, 12 Oct 2020 12:11:20 -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=@kernel.org header.s=default header.b=Z9keOqMk; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391627AbgJLTIz (ORCPT + 99 others); Mon, 12 Oct 2020 15:08:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730977AbgJLTDG (ORCPT ); Mon, 12 Oct 2020 15:03:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE77D214D8; Mon, 12 Oct 2020 19:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602529385; bh=qIcFeA+fGiwcihUVhIK+KK5uybAa7QnSrfNH0fopBZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9keOqMkNgjGUa2tWFg+1oY02uo8ZJ3RgndMyv4JAnuMz7pi/69NcWavTnSoLzg8s v1EJTfJJyIldAr53pLEB8cA28d3NOZa+HAM77WhgCVTbjh8hihv6xo3JDix74k75dc /4AwDdmIKovNVhMfoIv6QbYii0xbMCeyPppkva+E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Guo Ren , Aurelien Jarno , Palmer Dabbelt , Sasha Levin Subject: [PATCH AUTOSEL 5.8 20/24] riscv: Fixup bootup failure with HARDENED_USERCOPY Date: Mon, 12 Oct 2020 15:02:35 -0400 Message-Id: <20201012190239.3279198-20-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012190239.3279198-1-sashal@kernel.org> References: <20201012190239.3279198-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren [ Upstream commit 84814460eef9af0fb56a4698341c9cb7996a6312 ] 6184358da000 ("riscv: Fixup static_obj() fail") attempted to elide a lockdep failure by rearranging our kernel image to place all initdata within [_stext, _end], thus triggering lockdep to treat these as static objects. These objects are released and eventually reallocated, causing check_kernel_text_object() to trigger a BUG(). This backs out the change to make [_stext, _end] all-encompassing, instead just moving initdata. This results in initdata being outside of [__init_begin, __init_end], which means initdata can't be freed. Link: https://lore.kernel.org/linux-riscv/1593266228-61125-1-git-send-email-guoren@kernel.org/T/#t Signed-off-by: Guo Ren Reported-by: Aurelien Jarno Tested-by: Aurelien Jarno [Palmer: Clean up commit text] Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/kernel/vmlinux.lds.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index f3586e31ed1ec..34d00d9e6eac0 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -22,13 +22,11 @@ SECTIONS /* Beginning of code and text segment */ . = LOAD_OFFSET; _start = .; - _stext = .; HEAD_TEXT_SECTION . = ALIGN(PAGE_SIZE); __init_begin = .; INIT_TEXT_SECTION(PAGE_SIZE) - INIT_DATA_SECTION(16) . = ALIGN(8); __soc_early_init_table : { __soc_early_init_table_start = .; @@ -55,6 +53,7 @@ SECTIONS . = ALIGN(SECTION_ALIGN); .text : { _text = .; + _stext = .; TEXT_TEXT SCHED_TEXT CPUIDLE_TEXT @@ -67,6 +66,8 @@ SECTIONS _etext = .; } + INIT_DATA_SECTION(16) + /* Start of data section */ _sdata = .; RO_DATA(SECTION_ALIGN) -- 2.25.1