From patchwork Tue Mar 19 15:52:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10859885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 979AD1390 for ; Tue, 19 Mar 2019 15:53:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7257E27F92 for ; Tue, 19 Mar 2019 15:53:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66ADE2979F; Tue, 19 Mar 2019 15:53:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAB2C2976B for ; Tue, 19 Mar 2019 15:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=DQY3U7gW8SsqE9Vx+C8TdGvG96aZHBE0rIX2yKO/es4=; b=QZs fz942oTAG/6Xv7id8dBoLu2NzLNBSq+PxxBed0Yqa/KBzNqxNUbTwh/fN67e9V0QTMn3804dh8f1w g8Nw3NXh2LpItwpgiPz5dfdPKMXxy0HYSFt4eNa8IR4qJ+c54DO0k8hk10h1dqbzIU+XpbLkwKqXL xYIsFew/ULKyEK+vTIqTqFJp1NvlUTwHkjAtTwJHh2UA2LvU2ZxQ41GUKsKTOCzypuT9Jg8AdPDM2 UzyBcdPV5nkBzVp+SgYvlSLD8jNqCHDkXob10XL7NomG61kzrwE1nr9n6YCQ72qPtCMSiw3i1qEfm v2V8U0rHNMJvSlJDkiYRj7CdNUH5wCQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6H3B-00084x-Lu; Tue, 19 Mar 2019 15:53:13 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6H36-00084P-Uf for linux-arm-kernel@lists.infradead.org; Tue, 19 Mar 2019 15:53:10 +0000 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id x2JFqgQx020669; Wed, 20 Mar 2019 00:52:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x2JFqgQx020669 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1553010763; bh=A2+cO3hRpKwBj1MVA+O6aHySKEo9Y616LGE3nKQruds=; h=From:To:Cc:Subject:Date:From; b=be1CiYfJOkj8Tohd/jh1ApcDdoJIfcJ6QVf7S8jPrKkG0dSjCkYXynbioJcKpIbBi OiWyXYK48s/RAKrnsmg1dxxbW8uzKm4aYwJOEu5hGbrx3mcBoDHIE7pKQF5Uo9WCFq vyGTLFvImudNOAd7BcGLIBlGixIy6uAgL6rY2M1MbHhTBUI3KZThV525aHMUjnEMhb TyMfr0vD7h/zhN6njygXs+DYqmIQxpBNgarjADUMrvXwNdSg2UupOiPn+nExmraxZx VxgwSldlC33ZmWOGgfDkjE0CxAp6cu7r1SqHk588RYQ0xxE2nNeFNJfj1zdeXh7Csg 6fdEKlbVzR5zQ== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: fix out-of-bound access to ipi_types[] Date: Wed, 20 Mar 2019 00:52:25 +0900 Message-Id: <1553010745-26585-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190319_085309_371705_519269D9 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Grygorii Strashko , Yufen Wang , Marc Zyngier , linux-kernel@vger.kernel.org, Russell King , Masahiro Yamada , Russell King , Dietmar Eggemann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI"), IPI_CPU_BACKTRACE is assigned to SGI7. raise_nmi() passes IPI_CPU_BACKTRACE (=7) into smp_cross_call(), but it is above the array bound of ipi_types[]. Increase NR_IPI, and add the entry to ipi_types[]. This fixes the following GCC warning: CC arch/arm/kernel/smp.o arch/arm/kernel/smp.c: In function 'raise_nmi': arch/arm/kernel/smp.c:522:2: warning: array subscript 7 is above array bounds of 'const char *[7]' [-Warray-bounds] trace_ipi_raise_rcuidle(target, ipi_types[ipinr]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Masahiro Yamada --- arch/arm/include/asm/hardirq.h | 2 +- arch/arm/kernel/smp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h index cba23ea..c7e3a71 100644 --- a/arch/arm/include/asm/hardirq.h +++ b/arch/arm/include/asm/hardirq.h @@ -6,7 +6,7 @@ #include #include -#define NR_IPI 7 +#define NR_IPI 8 typedef struct { unsigned int __softirq_pending; diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index facd424..8046f9b 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -515,6 +515,7 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = { S(IPI_CPU_STOP, "CPU stop interrupts"), S(IPI_IRQ_WORK, "IRQ work interrupts"), S(IPI_COMPLETION, "completion interrupts"), + S(IPI_CPU_BACKTRACE, "Backtrace interrupts"), }; static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)