Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5607100img; Wed, 27 Mar 2019 11:35:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtklullOASOIVzLmANsmbZKkhrUx041y0KY31EfMtnMSD5T3qjz/mkbhWnNT7EurKNepTK X-Received: by 2002:a17:902:7786:: with SMTP id o6mr38222323pll.206.1553711709068; Wed, 27 Mar 2019 11:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553711709; cv=none; d=google.com; s=arc-20160816; b=lxxv1KHMRtDp0gDhZFtQWRGX8daiFR5aTLCWPeON3qFJ1JIB1icENHuP2RUI8/qozb KJ4YsouBJjVTBLkRHFvFAtK+zBaDWhZJ+GMc+aplv/oWuTVFKC8+MvP3ZPgKQv6VEvBP 9Wt1HAAyZOhv3Dr/VeuB5t0NWxweGmVcKZ9F45tpuK4u10qR2MvFCTUMT8ThqXvzYMVx LBqpKPb8YidQZSoai4iqtnsk+rBukgk4o6WxY3hwejKdIPYy+N2qNi1k5WkSvMTNGm/S jgFwqDXSSOCdD6GWpFw5qVUw8aJHYgoJoEhwqxz6GjkghMvi8Mxt2n7RgZWeMlDztefw MFUA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZvYgc05xq7KN8pKLxJirtkuzT1mKtgOHOSYMiK0ApdM=; b=M+JOk+S52jyqpQ6YYcIazKCk2qs2z5pqN4qCff07qTOTdcsoEejecN5oH0UyM0V2Xu p/NQqiMuIacATinldqqUwxyPBh9z38cDeWpEj5AXv/Vqi/JqR9cy2xDTvjSLNIK0YzyO Wq1ZiTF9T2i+OJwkQ+uso19uxz1VdzCPF3AFAm2KYfarnrx9AZZSOdboTZ0LawsUQljf wJTzWReTiRN4PJREMsAQCBe0iBXaIhcxppjy61RO9WQKIdSud/wcJTsz/tBAsg0lVXso tU9lmS16h0wLWzFAROEp9AKYcaXrt1bANJjjPo1c2boOZemVOI+hbQwxosQmmPBTZaTw WteA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si2473942pff.61.2019.03.27.11.34.54; Wed, 27 Mar 2019 11:35:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391670AbfC0Sde (ORCPT + 99 others); Wed, 27 Mar 2019 14:33:34 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51485 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391481AbfC0SdR (ORCPT ); Wed, 27 Mar 2019 14:33:17 -0400 Received: from localhost ([127.0.0.1] helo=flow.W.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1h9DMN-0004Tc-Dk; Wed, 27 Mar 2019 19:33:11 +0100 From: Sebastian Andrzej Siewior To: LKML , linux-rt-users Cc: Thomas Gleixner , Steven Rostedt Subject: [PATCH 2/4] powerpc/stackprotector: work around stack-guard init from atomic Date: Wed, 27 Mar 2019 19:33:08 +0100 Message-Id: <20190327183310.1015-2-bigeasy@linutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190327183310.1015-1-bigeasy@linutronix.de> References: <20190320171511.icjhdlulgal2yeho@linutronix.de> <20190327183310.1015-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is invoked from the secondary CPU in atomic context. On x86 we use tsc instead. On Power we XOR it against mftb() so lets use stack address as the initial value. Signed-off-by: Sebastian Andrzej Siewior --- arch/powerpc/include/asm/stackprotector.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/include/asm/stackprotector.h b/arch/powerpc/include/asm/stackprotector.h index 1c8460e235838..e764eb4b6c284 100644 --- a/arch/powerpc/include/asm/stackprotector.h +++ b/arch/powerpc/include/asm/stackprotector.h @@ -24,7 +24,11 @@ static __always_inline void boot_init_stack_canary(void) unsigned long canary; /* Try to get a semi random initial value. */ +#ifdef CONFIG_PREEMPT_RT_FULL + canary = (unsigned long)&canary; +#else canary = get_random_canary(); +#endif canary ^= mftb(); canary ^= LINUX_VERSION_CODE; canary &= CANARY_MASK; -- 2.20.1