Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3725181ybl; Sun, 8 Dec 2019 22:09:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwq1RSwm0qsrAxKEOGWO/6Gqsye4H7lZS+zR0BkQybfp5/Yl7H/9OXnHEt/Hu1hfRqPk4wy X-Received: by 2002:a05:6830:1459:: with SMTP id w25mr19535527otp.270.1575871763378; Sun, 08 Dec 2019 22:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575871763; cv=none; d=google.com; s=arc-20160816; b=O7Rkf45VbW/eG4AC38DxfCIvwa1VYEeQO+GncH0qaBUzDmnb1Y4LbrZrPLJz4gSSae Q/anjhpTsDb/QLhUB9W62Tuxu86hqGzROGcg+dljBlZWs7Tdg77JBInqrApFM0tlzxMW MZ6xX3sw+lNTgKnSbYF8fFQiBSUVNygt3zYeRafOKq+1rw28W5dpka2Kq5UPG2CslCZn Q5db1Lh3TI/ZIH2/2Sak973LwCIxUHdF+XN6e5aQImCXn5zFX28r8guZmp0M/f5NokJF BkzqZ1S7dAv8Lr+5zG2PBw1RSzbYrPCUcuL1SwaoxNgdaK/rhMG17eLahEqKVybPsHTG jKHA== 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=4PTvkpJvM4Rk0FYU1bLjpYOjPs0OZx8HFfawFNgQDuU=; b=C1suaWuu8RHSqjii2mC0YAtrLDY9jAtHp8xHzix2tGm+RQMBZ1m5+FcJLhhV/n3ZEp zMdH4JjQhOOrxQgY5ff7ri4H3NJHZMPMzsnkrsMZn9lsPiVCpJgqLWy077LvlKfgRNNk S9xBNq+gMVTldNfRRBvt8wjLGgzSnNrUClVhLusNtdK8aQdA3Y6tIHioxcaCnDO5KI9V Mxeo5eBE0P0ZS7Lm9YAStbw8YadwuG9llcCv6wPwAkrnsFk9krs439QbUOubhwGhvynd tSD+w46kyzePK+K1mi7qtaKdjfMmRLik/Euiu9Rpnt3Ee9FsTK72foU8szI930OpmV6M c21A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=pFka7N+q; 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 h5si7315787oia.277.2019.12.08.22.09.10; Sun, 08 Dec 2019 22:09:23 -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=pFka7N+q; 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 S1726834AbfLIGHX (ORCPT + 99 others); Mon, 9 Dec 2019 01:07:23 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:31069 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfLIGHX (ORCPT ); Mon, 9 Dec 2019 01:07:23 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47WXln5tmqz9v4lH; Mon, 9 Dec 2019 07:07:17 +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=pFka7N+q; 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 lkDlMX49Rxkp; Mon, 9 Dec 2019 07:07:17 +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 47WXln4mklz9v4lG; Mon, 9 Dec 2019 07:07:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1575871637; bh=4PTvkpJvM4Rk0FYU1bLjpYOjPs0OZx8HFfawFNgQDuU=; h=From:Subject:To:Cc:Date:From; b=pFka7N+qv1EiKkmwCjENDSH/EIWMMJAJqtIF9+t/Pk9Xh5M4dt8+ENtvONS0MZxYe yu8wVP3iTFvoG/XQLMcVwsN0+gtWVdWj8G8TZORrd9c9Ed2cDbP92MhKy5iphtqnTP p+8R6Xjf1Xdzo4W27NFMQnhnew8uj9CSVf06eEK8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 047D98B7AF; Mon, 9 Dec 2019 07:07:22 +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 QpF-CxIMyPSk; Mon, 9 Dec 2019 07:07:21 +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 DD0268B755; Mon, 9 Dec 2019 07:07:21 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id BEE5963679; Mon, 9 Dec 2019 06:07:21 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH 1/2] powerpc/irq: don't use current_stack_pointer() in check_stack_overflow() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 9 Dec 2019 06:07:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org current_stack_pointer() doesn't return the stack pointer, but the caller's stack frame. See commit bfe9a2cfe91a ("powerpc: Reimplement __get_SP() as a function not a define") and commit acf620ecf56c ("powerpc: Rename __get_SP() to current_stack_pointer()") for details. The purpose of check_stack_overflow() is to verify that the stack has not overflowed. To really know whether the stack pointer is still within boundaries, the check must be done directly on the value of r1. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index bb34005ff9d2..4d468d835558 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -599,9 +599,8 @@ u64 arch_irq_stat_cpu(unsigned int cpu) static inline void check_stack_overflow(void) { #ifdef CONFIG_DEBUG_STACKOVERFLOW - long sp; - - sp = current_stack_pointer() & (THREAD_SIZE-1); + register unsigned long r1 asm("r1"); + long sp = r1 & (THREAD_SIZE - 1); /* check for stack overflow: is there less than 2KB free? */ if (unlikely(sp < 2048)) { -- 2.13.3