Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11810059pjo; Thu, 2 Jan 2020 14:40:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzkztIaf08sb7e9DHkLdvrPJZJo1xCo0xYJeGe886uGGh5vY1dfLlki+gC0laN6omteys3u X-Received: by 2002:a05:6830:158:: with SMTP id j24mr96528151otp.316.1578004814807; Thu, 02 Jan 2020 14:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004814; cv=none; d=google.com; s=arc-20160816; b=hWJwUUrOa4z/fsQVYgCyzRv62xcwdJOk5Bt25TCJ9ocVsmmUGlknd5whr25HVSITIP tPxssOzkMyy0UCPuB3uRvJAHQ3y0wH2iaFP1YCu18DiJNmSGHAKEoma0aYujF5OUJHqS MUq/GpqyW0N0Pn0M2HICnBh8v2Dgld/xiZtkCxaDx9DMLPZbdH9UVwTwEIjfr1jA0j9n PilcMwiiTvfVoEvXgqpCdkfTmS/o0/YSbNvP0XxA6oQGRvXMPuMqu0N3YXfmTkDkKA65 hGcWuKXTWJRUm0793RGRkJnbDJ4lnhggPxqx3klEBvX8AJ1gQ0odSo5dJum5tm+WCBy7 GHNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RwZv+ryxIec+HKEIygdTm+QAzXy4AXS8+XZipYR9O8k=; b=alOtukRz2cN+bE4BRUAs7hSUjsP/CmvvVr0tJGW+7+GCPEO5yLrooasQpAjDvchYRC CUL8LMArW1dsqcT5dEfRdVoJn4jeY8MnSPwk98SClCrztocjgAOt7Ouz0FguokgaNvTR tdOV1daQgSScQcaB2RaWV04BaJkgE4YqQpnnpoZFNA1lEEFem1gUsTWMQ8qxiJBCGtOf lKbvUSYckidWTvopWsO7FDF2I6Sd5Qq+0GAZEe5kCbcXORNYyBb2w77Dy/5yLOmYTR+o sgcNwO02clfKu/SOC5B22+fx2sMbHHQ4mQ/9O6nZBDmMF3uBk2UKAXpAwOrDi0US2m3O Je2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MLTAY2i3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si28340137otl.153.2020.01.02.14.40.00; Thu, 02 Jan 2020 14:40:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MLTAY2i3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731221AbgABWiS (ORCPT + 99 others); Thu, 2 Jan 2020 17:38:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:51990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731193AbgABWiQ (ORCPT ); Thu, 2 Jan 2020 17:38:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 781E220863; Thu, 2 Jan 2020 22:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004695; bh=WDMCCQ5lRqNdoSDb5C9ugWuysJjA9Xq8qi7dfFA45vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLTAY2i3bPgo9h2S+6PWlKI0xQhuucVcNkyZ2d8LhZUOunWcLybjHYXojvv0pGkzS l0ZYwpxxtQ2fGRoS3+k7znHKP+RFj/cvd0G63VYfdgWeglmV+3aUmVL7b24jkxqRIx WuDdAqksb4IMUBXjP+9EPPZBjo24SrMLOPtitJ2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 4.4 087/137] powerpc/irq: fix stack overflow verification Date: Thu, 2 Jan 2020 23:07:40 +0100 Message-Id: <20200102220558.412954036@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 099bc4812f09155da77eeb960a983470249c9ce1 upstream. Before commit 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack"), check_stack_overflow() was called by do_IRQ(), before switching to the irq stack. In that commit, do_IRQ() was renamed __do_irq(), and is now executing on the irq stack, so check_stack_overflow() has just become almost useless. Move check_stack_overflow() call in do_IRQ() to do the check while still on the current stack. Fixes: 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/e033aa8116ab12b7ca9a9c75189ad0741e3b9b5f.1575872340.git.christophe.leroy@c-s.fr Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -484,8 +484,6 @@ void __do_irq(struct pt_regs *regs) trace_irq_entry(regs); - check_stack_overflow(); - /* * Query the platform PIC for the interrupt & ack it. * @@ -517,6 +515,8 @@ void do_IRQ(struct pt_regs *regs) irqtp = hardirq_ctx[raw_smp_processor_id()]; sirqtp = softirq_ctx[raw_smp_processor_id()]; + check_stack_overflow(); + /* Already there ? */ if (unlikely(curtp == irqtp || curtp == sirqtp)) { __do_irq(regs);