Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3696695imm; Mon, 15 Oct 2018 02:34:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV60ImwDJydFPfJieVP0U8ij0JKilWaNJLVtLph9rZZccoYDSEYmlOa/a9MtlsmGL7jiWqGnS X-Received: by 2002:a17:902:f215:: with SMTP id gn21mr16453351plb.316.1539596047426; Mon, 15 Oct 2018 02:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539596047; cv=none; d=google.com; s=arc-20160816; b=fuh6XRN4pYNpaGsyeblaXqi1IJ6vm8UioDsS8VM4FV5l7/e/I3QjqiKZwE4hA6/n7q PqKSRgb6+ulnCUn+kZHmwKhv7ogXafDP9blVEmkohcwpID1eAuRJ+sIW6z6Xl5juRg3U APPCWa5/J2J4ZafBoWfCEEPmmaRzuowBGBNRyg1a+avZT+fn/o5VnYHar9zdJ3QlIK5w +BZfg53W/gA1sBXG8AognGogR6MnvWcaINexPQ0dQRpofxgdE0WU7JiSjS4aGIz6lqm/ Ww4nR+uhpjJk/jUruGNycndCU6ifIP+C7gGCXc5q55vakb06ZoWx+J/aqHUuFFLtWgzW 26CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=scxdF9E+Sm2urcg3Y4OhfLnoIarWyYGqVcFwRiCqIy8=; b=vMhSv3BNEO8VBrG0lmDC9iW8UvyH9zr9/OQ2MQy3KGK0AYxsyCFrfDm4ercocTMrue lTOgRMOawcRkJRC65M2wCETaYEvpD3xej4IFRvzGY6JaOziL0ftbfVDbUg/SgtrXVfzU p20JXs4aoYYmBOm1UauZYuMgGcK9wGY9fT85iFJPgq8qkFzkMF767xY7DAkjOaqWCyHM EZ2266qi9so8ylt5jlmDL/COfsbXpoSpxaUql2X8Zv5akigYv0AmGFjj21IxDyu5KRpy SBK8HMA/jw313KFsgk/YY04ajUkYtkP8Q4jOYl7ruI2m2qKgA0DJE+3Y4mIkShIpq+Kl ksNw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g35-v6si9831711pgm.514.2018.10.15.02.33.52; Mon, 15 Oct 2018 02:34:07 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbeJORR5 (ORCPT + 99 others); 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