From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D88BC7112B for ; Mon, 15 Oct 2018 09:33:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3633205C9 for ; Mon, 15 Oct 2018 09:33:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3633205C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726602AbeJORR5 (ORCPT ); Mon, 15 Oct 2018 13:17:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49608 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726273AbeJORR4 (ORCPT ); Mon, 15 Oct 2018 13:17:56 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9F9IhiK059878 for ; Mon, 15 Oct 2018 05:33:28 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n4ny0pb44-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 15 Oct 2018 05:33:28 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 Oct 2018 03:33:27 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 15 Oct 2018 03:33:25 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9F9XO3G25690154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Oct 2018 02:33:24 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C20166E04E; Mon, 15 Oct 2018 03:33:24 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCD6D6E04C; Mon, 15 Oct 2018 03:33:22 -0600 (MDT) Received: from [9.124.35.84] (unknown [9.124.35.84]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 15 Oct 2018 03:33:22 -0600 (MDT) Subject: Re: [PATCH] powerpc/64: properly initialise the stackprotector canary on SMP. From: Abdul Haleem To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 15 Oct 2018 15:03:21 +0530 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18101509-0012-0000-0000-000016C8A148 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009879; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01102946; UDB=6.00570861; IPR=6.00882998; MB=3.00023760; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-15 09:33:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101509-0013-0000-0000-000054C321CA Message-Id: <1539596001.28358.1.camel@abdul.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-15_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810150088 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2018-10-13 at 09:45 +0000, Christophe Leroy wrote: > commit 06ec27aea9fc ("powerpc/64: add stack protector support") > doesn't initialise the stack canary on SMP secondary CPU's paca, > leading to the following false positive report from the > stack protector. > > smp: Bringing up secondary CPUs ... > Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: __schedule+0x978/0xa80 > CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc7-next-20181010-autotest-autotest #1 > Call Trace: > [c000001fed5b3bf0] [c000000000a0ef3c] dump_stack+0xb0/0xf4 (unreliable) > [c000001fed5b3c30] [c0000000000f9d68] panic+0x140/0x308 > [c000001fed5b3cc0] [c0000000000f9844] __stack_chk_fail+0x24/0x30 > [c000001fed5b3d20] [c000000000a2c3a8] __schedule+0x978/0xa80 > [c000001fed5b3e00] [c000000000a2c9b4] schedule_idle+0x34/0x60 > [c000001fed5b3e30] [c00000000013d344] do_idle+0x224/0x3d0 > [c000001fed5b3ec0] [c00000000013d6e0] cpu_startup_entry+0x30/0x50 > [c000001fed5b3ef0] [c000000000047f34] start_secondary+0x4d4/0x520 > [c000001fed5b3f90] [c00000000000b370] start_secondary_prolog+0x10/0x14 > > This patch properly initialises the stack_canary of the secondary > idle tasks. > > Reported-by: Abdul Haleem > Fixes: 06ec27aea9fc ("powerpc/64: add stack protector support") > Signed-off-by: Christophe Leroy > --- > arch/powerpc/kernel/smp.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c > index 61c1fadbc644..e774d3bf3a03 100644 > --- a/arch/powerpc/kernel/smp.c > +++ b/arch/powerpc/kernel/smp.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -810,9 +811,16 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) > { > struct thread_info *ti = task_thread_info(idle); > > +#ifdef CONFIG_STACKPROTECTOR > + idle->stack_canary = get_random_canary(); > +#endif > + > #ifdef CONFIG_PPC64 > paca_ptrs[cpu]->__current = idle; > paca_ptrs[cpu]->kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD; > +#ifdef CONFIG_STACKPROTECTOR > + paca_ptrs[cpu]->canary = idle->stack_canary; > +#endif > #endif > ti->cpu = cpu; > secondary_ti = current_set[cpu] = ti; Thank you Christophe for the fix, Machine boots fine with above patch. Reported-and-tested-by: Abdul Haleem -- Regard's Abdul Haleem IBM Linux Technology Centre