Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp254255pxj; Tue, 18 May 2021 02:34:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk22nhu+s1TZpXtkxXR4z4b5mlAMoVLNNfLfNANtc+TIRot6nKo2U7Kv4H4Gh/mWgL8WOI X-Received: by 2002:a17:906:c9cf:: with SMTP id hk15mr4989225ejb.445.1621330473105; Tue, 18 May 2021 02:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621330473; cv=none; d=google.com; s=arc-20160816; b=kPkRD/SCifFyzwk+W2pJFSWhp1NuGkkCOgZkDsfoFCRHcYx8TBmc3uTD0ZBknGxGgx jKDat/rabzx9jrAWqWvxISe1JlcVwobfexjcfgtc0571sQXrQWVPdhlTB4mzNfkiSL8K D5qznFz8buZUy0aPxqyqz0bJ3mOZSWm+h2kiRoPKikwJPIPX+F1le7dMdNmE5jo8wW8V HNTcv5FwY29PQlz0oiMfRgGfkpj4jaW8DC0KMLsYUYq7Wsma9QQoJoXnNSPKgmVqAyg+ cGfFArgiBsq2cnb5r4H479TNCmTLg1hL76PmcxqJM8XHixNrvI+PEaZUvwFxiMP8DrF3 1XqQ== 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=ZEUwwMU9fn1dN3W0cL9P6ahWuAO+cudvBIkJbuuQpTQ=; b=Fx/HznhHjxN0rUANAxm3dRlNgyccz2gfpauPFSQs2gLB8jPKCIoseGNfT8U723d8JX gITnu+c/gryYx14EFwXq8tSUkM4Jq/HdSAS52dx1c9vRYvZd0xtMSEAj+OE/jdAk38zv ovW4Xt44mJHtA0PGmNAKCs4vfNQKj1ExfF8JgiH4BS7QSsGz5DGtK4DNz2JfLEl1vDRs 08n6/flcJbng/0m/esSl1M9P1POmxjsvycmkMY3npQiNaa/8tMIXtxcKPfjiCn3LnOrx osUtkbohlW2KsXcGkxM72slH4P1NnhbA9W6R7PPak8A3Eg0q+v3FC9kh0/g0c4TzwI80 ykJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MCgve2Gv; 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 s13si18885115edr.568.2021.05.18.02.34.10; Tue, 18 May 2021 02:34:33 -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=@linuxfoundation.org header.s=korg header.b=MCgve2Gv; 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 S242783AbhEQPIJ (ORCPT + 99 others); Mon, 17 May 2021 11:08:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:59320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241592AbhEQO6R (ORCPT ); Mon, 17 May 2021 10:58:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A18D9619B4; Mon, 17 May 2021 14:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261561; bh=TYUEnkUSptMHFV/BRZcNVekPBoLk8zrkglcez8G31xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MCgve2GveNlrPdre5K4BGKQ71QCxNuP3YNqlY/LDKzs8pCEHp6xc1+BB348vhTMxz 4FgoNH+bZb6Mnc0f56YRHDI8ccLW5OhjTql4EF7z3Xyp+2yKOS5e9v4SIBe8CID+xB fAOvn0FO815fUk4+ysMB19FsfLqKCAbJBb5zQZf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 033/289] powerpc/32: Statically initialise first emergency context Date: Mon, 17 May 2021 15:59:18 +0200 Message-Id: <20210517140306.305628813@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Christophe Leroy [ Upstream commit a4719f5bb6d7dc220bffdc1b9f5ce5eaa5543581 ] The check of the emergency context initialisation in vmap_stack_overflow is buggy for the SMP case, as it compares r1 with 0 while in the SMP case r1 is offseted by the CPU id. Instead of fixing it, just perform static initialisation of the first emergency context. Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/4a67ba422be75713286dca0c86ee0d3df2eb6dfa.1615552867.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/kernel/head_32.h | 6 +----- arch/powerpc/kernel/setup_32.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h index fef0b34a77c9..f8e3d15ddf69 100644 --- a/arch/powerpc/kernel/head_32.h +++ b/arch/powerpc/kernel/head_32.h @@ -338,11 +338,7 @@ label: lis r1, emergency_ctx@ha #endif lwz r1, emergency_ctx@l(r1) - cmpwi cr1, r1, 0 - bne cr1, 1f - lis r1, init_thread_union@ha - addi r1, r1, init_thread_union@l -1: addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE + addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE EXCEPTION_PROLOG_2 SAVE_NVGPRS(r11) addi r3, r1, STACK_FRAME_OVERHEAD diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 057d6b8e9bb0..e7f2eb7837fc 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -164,7 +164,7 @@ void __init irqstack_early_init(void) } #ifdef CONFIG_VMAP_STACK -void *emergency_ctx[NR_CPUS] __ro_after_init; +void *emergency_ctx[NR_CPUS] __ro_after_init = {[0] = &init_stack}; void __init emergency_stack_init(void) { -- 2.30.2