Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3733854ybl; Sun, 8 Dec 2019 22:20:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzWOBUa5uoe43zm/inlDz55MCx4hUtGcH/bS1B3yMCAYwd0qUv+bBCrht0KlB4DVT38fQ8o X-Received: by 2002:aca:dc45:: with SMTP id t66mr17528034oig.39.1575872425309; Sun, 08 Dec 2019 22:20:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575872425; cv=none; d=google.com; s=arc-20160816; b=Qhp5o+xNFPtNwJ4VcPEHohGVgzcf1HebIYIbPRCo96yMOxcni+69EhQKlSabmg+iWi r0pm9lJsmaRPlNgxxwCndG+EhDq+nJVYRs6wInkmlA5sLE0+m0jPTsDgLdrgTo1vZaL/ NyNaY+hBPnsoLKjFlHrjASiH1FcJvHH/mm00T8x2EMeXd/Qz3TjjkeNEIP8KznNIHk2A TmxaAgQ6/SJCUuAnUyNR5QJW8u+jGOkbkTvSiI5Y4T7OLnnKmyEvXEP7uw5XcCsHmhzt QWHmiFIVUxHoOnGgizKRj3hqMe6KQfJWLYMLX1rKY1LTgtQXi1yZSi7/pvAtOchuEEcl OkUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=0qj55DfE4nkebN4TjIg5yIgzcs/5M0B/cUT404z7tUg=; b=Bo0RNsG48dhWm9F/9OoLYIvLgS2EcG1+DuFSWe3zjO9q1pdqFYCijsLlmxfAoeFVrA ET3zasjk7CIOQF6i9OuhXECU9UC6Oj7ILLF4MNxD5Ssm51s5OJX3vUrCpxAxTnTH3YET bylMQwzYaHdAggv5DEEzclS2O4CsP6Zb3WZtOlaXD25EHh71ksGIvO/LeptFIHmmO/WP zGjIi3D+AR4Qr8IZ1wIESexs/egpBKtpXJpDujUZtwWCXeJz8CqZhVzYqIHyo2LsKEm6 FqNIxiAc7eT25JGKxRKijagVbRP/kzwL3jn+ptOi7wjViNaS1MoKPxNFHaSNN1p7iVSO Xygg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=k+3+cau9; 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 t23si12503497otp.234.2019.12.08.22.20.12; Sun, 08 Dec 2019 22:20:25 -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=@c-s.fr header.s=mail header.b=k+3+cau9; 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 S1727069AbfLIGTK (ORCPT + 99 others); Mon, 9 Dec 2019 01:19:10 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:17984 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727059AbfLIGTK (ORCPT ); Mon, 9 Dec 2019 01:19:10 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47WY1N5pW7z9v4lR; Mon, 9 Dec 2019 07:19:04 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=k+3+cau9; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id BW3lvxHKxxyX; Mon, 9 Dec 2019 07:19:04 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47WY1N4hL2z9v4lQ; Mon, 9 Dec 2019 07:19:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1575872344; bh=0qj55DfE4nkebN4TjIg5yIgzcs/5M0B/cUT404z7tUg=; h=From:Subject:To:Cc:Date:From; b=k+3+cau9ARsQLx/l/9Ri93q+/p3RH9IHwjIq21/HUWUm+F4Ge94oK6JWa4FMQalTU ypuuclOinPir7eLmW8PvNC3LN45H3oen7isysb8PmVuiL8CUvzZRZa8mC2XGITkwTm CyCQT9f7VvpVPYXCAKR4n0XzJy12c3uRh17Z3Nxg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1D34D8B7B0; Mon, 9 Dec 2019 07:19:09 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id dl1G665l3XmX; Mon, 9 Dec 2019 07:19:09 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F0A1A8B755; Mon, 9 Dec 2019 07:19:08 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id D618763679; Mon, 9 Dec 2019 06:19:08 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH] powerpc/irq: fix stack overflow verification To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 9 Dec 2019 06:19:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/powerpc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 0aebd7843c73..e2bce937d51f 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -667,8 +667,6 @@ void __do_irq(struct pt_regs *regs) trace_irq_entry(regs); - check_stack_overflow(); - /* * Query the platform PIC for the interrupt & ack it. * @@ -701,6 +699,8 @@ void do_IRQ(struct pt_regs *regs) irqsp = hardirq_ctx[raw_smp_processor_id()]; sirqsp = softirq_ctx[raw_smp_processor_id()]; + check_stack_overflow(); + /* Already there ? */ if (unlikely(cursp == irqsp || cursp == sirqsp)) { __do_irq(regs); -- 2.13.3