Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp581484imm; Wed, 3 Oct 2018 23:15:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV62+c2Z4qsyW58CrowvKiToxB3LfVoaq593ZwvV8Vcr9mhs8Mj4uce9YDLHzbinlo8KtSXga X-Received: by 2002:a17:902:70c3:: with SMTP id l3-v6mr4968486plt.185.1538633722554; Wed, 03 Oct 2018 23:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538633722; cv=none; d=google.com; s=arc-20160816; b=FgoURC9Np6mRcWdrXv1p0BdWyc2G4MI3haHW2l5prSYIZjnfq6USIb++SeibN/0DMI WgpQoRdLUZ2vO+fYCW72YNpCK7D3aeHNIwdqgdhZD5Lij0CH/AkdohBRFdLK/IC844XF W6FrHhaa5rAJq18f7tRPhLzgP/i0G1u6G/rXrOCNq1d8n+CXcKFTxeEqzujk9n7DzdC3 h3Wr5KMl5jlW7RUeafN9aM0Mo9xEvudTrFHmQgNuXI2v5b1nDm5mYfwj18ozTuGVwppe A41uM/Z1jfnIJwpelW98KWtDC2S3Ph04lV1VsAaw9jifBOrAfMfrqfoTWrtqp3GGG5ty fkfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=k9j37xHHx3s6DOfI8kocOhjXfiPsGfNuSV57N4lRm/U=; b=oxzHaront+gVtMamKl0J2ncJsJkfJfh5kXA7UvxXu9fdLKllr8pyfVtQycOsERgVpr SsWejXUSaX6y87/c1Bv5jHNnd7Ab8sJYhxt+9dqrPJzY2j4KVu8aVjHAwzVDhyxCy5FZ pv0GlyyWJQGnB7zwVUhid0EZmmmS8lWF4HvyFy5F/EUHf0UpZT5zSoC1yVmn47oQnOfj 7hqcjKQQofnIkJk/k8YQh3keSaXk8og5lggMKikBmsb92jo5RwNqWAbrbu6Cx59GEfpS UkItDAlZKecq2f4rLIutkrfbISLBGCosQd99uhxof+qqPZbakE5QL5prOdyMeYo8DHPJ 2ccw== 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 c32-v6si3905346plj.272.2018.10.03.23.15.06; Wed, 03 Oct 2018 23:15:22 -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 S1727589AbeJDNGY (ORCPT + 99 others); Thu, 4 Oct 2018 09:06:24 -0400 Received: from ozlabs.org ([203.11.71.1]:56065 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727537AbeJDNGX (ORCPT ); Thu, 4 Oct 2018 09:06:23 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 42QjKH73vwz9sj3; Thu, 4 Oct 2018 16:14:42 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: c3ff2a5193fa61b1b284cfb1d79628814ed0e95a In-Reply-To: <8e81b0647fea15e533a73ad4e9063c059fdfc6df.1537987712.git.christophe.leroy@c-s.fr> To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras From: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [v5,1/2] powerpc/32: add stack protector support Message-Id: <42QjKH73vwz9sj3@ozlabs.org> Date: Thu, 4 Oct 2018 16:14:42 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-09-27 at 07:05:53 UTC, Christophe Leroy wrote: > This functionality was tentatively added in the past > (commit 6533b7c16ee5 ("powerpc: Initial stack protector > (-fstack-protector) support")) but had to be reverted > (commit f2574030b0e3 ("powerpc: Revert the initial stack > protector support") because of GCC implementing it differently > whether it had been built with libc support or not. > > Now, GCC offers the possibility to manually set the > stack-protector mode (global or tls) regardless of libc support. > > This time, the patch selects HAVE_STACKPROTECTOR only if > -mstack-protector-guard=tls is supported by GCC. > > On PPC32, as register r2 points to current task_struct at > all time, the stack_canary located inside task_struct can be > used directly by using the following GCC options: > -mstack-protector-guard=tls > -mstack-protector-guard-reg=r2 > -mstack-protector-guard-offset=offsetof(struct task_struct, stack_canary)) > > The protector is disabled for prom_init and bootx_init as > it is too early to handle it properly. > > $ echo CORRUPT_STACK > /sys/kernel/debug/provoke-crash/DIRECT > [ 134.943666] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: lkdtm_CORRUPT_STACK+0x64/0x64 > [ 134.943666] > [ 134.955414] CPU: 0 PID: 283 Comm: sh Not tainted 4.18.0-s3k-dev-12143-ga3272be41209 #835 > [ 134.963380] Call Trace: > [ 134.965860] [c6615d60] [c001f76c] panic+0x118/0x260 (unreliable) > [ 134.971775] [c6615dc0] [c001f654] panic+0x0/0x260 > [ 134.976435] [c6615dd0] [c032c368] lkdtm_CORRUPT_STACK_STRONG+0x0/0x64 > [ 134.982769] [c6615e00] [ffffffff] 0xffffffff > > Signed-off-by: Christophe Leroy Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/c3ff2a5193fa61b1b284cfb1d79628 cheers