Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7076282ybi; Thu, 13 Jun 2019 09:10:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpdi++4WR1j+EkwOC6Wb4SsMkWYowqef1zogwAQ2UxTzAr6vVBvOXOpHXEAGofDoPtx4q+ X-Received: by 2002:a17:90a:24e4:: with SMTP id i91mr6642956pje.9.1560442205586; Thu, 13 Jun 2019 09:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560442205; cv=none; d=google.com; s=arc-20160816; b=zxJrjKZUuv+RNOSJsvK4DrC0WcjAg0ve8/s4hlS2VEFgOS3VIsCrapkUPmmW88DLXg UVwYjY0JIGuCuUjACbNHH7PvLBPsyFDlJRlPsSWHU2zBzErepnqv0DCAWKNXL5T15HIQ +W7VQHGX46tygKGOB1wQcJ+HFAVQHEvEnTXYMff/4OUQsJ0aWcP/HMMU8JAXdT5Pf+9i LX2VwNoz6BT/ZQawTWMKX7gnzI7pMZG4t7iYz6QoMBSgOLMHpdgIp4NrPi5aqVk/4zTV WxTRea2kzbw+9AMm+1Hpb99FU+8rO66AKyZ4z2wwSOuggbfwc7v3k1/t5Ld6h0vHl+lW FfRw== 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=aO3+zS+Nql/0/y9HGTgebcjswBwQDoF4YSTo/fk1CfI=; b=RnAcQoVd1p559rQ1Wjpg09QbfxGMxEaUaGlASOMlzrMapkY/eVZuQucHxi4FjYlAa4 O+WkJt36pNNQYjNNYAYpVjSrnfMzYzbwOZnvzUOimmRu4+MX6F8/9DsABaFIwJpsuxQq z4dxpxm7xfqt7FUmXlrmSBtJCboepOdlcKqKJ9Ud9u6WQQLYg8QpVjAc3xWQfrvsBRsL SlvsFLZRTFjNCZ4VvFmpsKmPdV0cewSjTYi1lUsZjsXoxskiPVVR+roU3vtkLosgx/fm okfIFb3TV7ymOylVg4a2PQY+RHz9kFCqFl7jOH63K8oKn4sly1+1/DTeff8eyjNVH3En ho3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pkQbhLmD; 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 q18si80770pgv.456.2019.06.13.09.09.50; Thu, 13 Jun 2019 09:10:05 -0700 (PDT) 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=pkQbhLmD; 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 S2391082AbfFMQJr (ORCPT + 99 others); Thu, 13 Jun 2019 12:09:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:33198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731259AbfFMIoT (ORCPT ); Thu, 13 Jun 2019 04:44:19 -0400 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 C3A952063F; Thu, 13 Jun 2019 08:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415458; bh=2sRyGT6WhhGD6b+fHn6Kn+9DOMFvsxq0SnHINw/ACOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pkQbhLmDpp1GuRiEW9K0N8MPJPqQCFydunWpq8466kK4aPWQJ4jNQmtNTcwXPJZLZ uP3/6SLiDMu+78Mk4WABhWvymKh6YHemuJhQYWFPibF4KXl0U9BSoLmMFooFsr5tmR pGffNydsytGa9GvD1frOA/EvuWxn2/mR+9yh9e1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Masahiro Yamada , Heiko Carstens , Ingo Molnar , Christophe Leroy , Mathieu Malaterre , "H. Peter Anvin" , Thomas Gleixner , Benjamin Herrenschmidt , Paul Mackerras , Ralf Baechle , Stefan Agner , Boris Brezillon , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Russell King , Borislav Petkov , Mark Rutland , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.1 011/155] ARM: prevent tracing IPI_CPU_BACKTRACE Date: Thu, 13 Jun 2019 10:32:03 +0200 Message-Id: <20190613075653.376823259@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075652.691765927@linuxfoundation.org> References: <20190613075652.691765927@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 [ Upstream commit be167862ae7dd85c56d385209a4890678e1b0488 ] Patch series "compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING", v3. This patch (of 11): When function tracing for IPIs is enabled, we get a warning for an overflow of the ipi_types array with the IPI_CPU_BACKTRACE type as triggered by raise_nmi(): arch/arm/kernel/smp.c: In function 'raise_nmi': arch/arm/kernel/smp.c:489:2: error: array subscript is above array bounds [-Werror=array-bounds] trace_ipi_raise(target, ipi_types[ipinr]); This is a correct warning as we actually overflow the array here. This patch raise_nmi() to call __smp_cross_call() instead of smp_cross_call(), to avoid calling into ftrace. For clarification, I'm also adding a two new code comments describing how this one is special. The warning appears to have shown up after commit e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI"), which changed the number assignment from '15' to '8', but as far as I can tell has existed since the IPI tracepoints were first introduced. If we decide to backport this patch to stable kernels, we probably need to backport e7273ff49acf as well. [yamada.masahiro@socionext.com: rebase on v5.1-rc1] Link: http://lkml.kernel.org/r/20190423034959.13525-2-yamada.masahiro@socionext.com Fixes: e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI") Fixes: 365ec7b17327 ("ARM: add IPI tracepoints") # v3.17 Signed-off-by: Arnd Bergmann Signed-off-by: Masahiro Yamada Cc: Heiko Carstens Cc: Arnd Bergmann Cc: Ingo Molnar Cc: Christophe Leroy Cc: Mathieu Malaterre Cc: "H. Peter Anvin" Cc: Thomas Gleixner Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Ralf Baechle Cc: Stefan Agner Cc: Boris Brezillon Cc: Miquel Raynal Cc: Richard Weinberger Cc: David Woodhouse Cc: Brian Norris Cc: Marek Vasut Cc: Russell King Cc: Borislav Petkov Cc: Mark Rutland Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/arm/include/asm/hardirq.h | 1 + arch/arm/kernel/smp.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h index cba23eaa6072..7a88f160b1fb 100644 --- a/arch/arm/include/asm/hardirq.h +++ b/arch/arm/include/asm/hardirq.h @@ -6,6 +6,7 @@ #include #include +/* number of IPIS _not_ including IPI_CPU_BACKTRACE */ #define NR_IPI 7 typedef struct { diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index facd4240ca02..c93fe0f256de 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -70,6 +70,10 @@ enum ipi_msg_type { IPI_CPU_STOP, IPI_IRQ_WORK, IPI_COMPLETION, + /* + * CPU_BACKTRACE is special and not included in NR_IPI + * or tracable with trace_ipi_* + */ IPI_CPU_BACKTRACE, /* * SGI8-15 can be reserved by secure firmware, and thus may @@ -797,7 +801,7 @@ core_initcall(register_cpufreq_notifier); static void raise_nmi(cpumask_t *mask) { - smp_cross_call(mask, IPI_CPU_BACKTRACE); + __smp_cross_call(mask, IPI_CPU_BACKTRACE); } void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self) -- 2.20.1