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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34114C6FD18 for ; Tue, 25 Apr 2023 11:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233927AbjDYLx4 (ORCPT ); Tue, 25 Apr 2023 07:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233685AbjDYLxw (ORCPT ); Tue, 25 Apr 2023 07:53:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B742D13F8D; Tue, 25 Apr 2023 04:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RuyX3d7D1azwsn4TOGYEeBa8zDHbPol4DtyJcZjYy1w=; b=YLzLX23gAqE/afcAhQhX/CCgMI c94ZoDFe8oTJK2JSS/FuFGg8KUS5MYESVL9zKBUuFX7pze6a+rQ5PaTvvIeSr87dHaWiZmxJTRf4k ZnYkaXPe9I8mpJ6ZFo6m4WPVvHZUc9bpUolM4kAQW5pfuUzoAT4BSZcvoCfBYgEp055GC/jb8VTv8 yBrlzwI/q0hZhcGAjBwsIg3GQ6498b4k6et/MqH9pyecJ+1MLldg1AIA1Viioh+zJ+jpg94WqSC4Y zTgteBn+91FFU6o2Y2N8N4q4l0FvCaHhNqzrDnQH+jP5wtpEGUOET5GiAols0niV9kFXp6T89bCa6 n7YxfyQQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1prHER-001PFv-P0; Tue, 25 Apr 2023 11:53:15 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 968D5300380; Tue, 25 Apr 2023 13:53:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7990C241943F2; Tue, 25 Apr 2023 13:53:13 +0200 (CEST) Date: Tue, 25 Apr 2023 13:53:13 +0200 From: Peter Zijlstra To: Joel Fernandes Cc: Boqun Feng , Segher Boessenkool , Michael Ellerman , Zhouyi Zhou , linuxppc-dev , rcu , linux-kernel , lance@osuosl.org, "Paul E. McKenney" Subject: Re: BUG : PowerPC RCU: torture test failed with __stack_chk_fail Message-ID: <20230425115313.GD1335080@hirez.programming.kicks-ass.net> References: <87fs8pzalj.fsf@mail.concordia> <20230424151351.GP19790@gate.crashing.org> <20230425101324.GD1331236@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 25, 2023 at 06:59:29AM -0400, Joel Fernandes wrote: > > I'm a little confused; the way I understand the whole stack protector > > thing to work is that we push a canary on the stack at call and on > > return check it is still valid. Since in general tasks randomly migrate, > > the per-cpu validation canary should be the same on all CPUs. > AFAICS, the canary is randomly chosen both in the kernel [1]. This Yes, at boot, once. But thereafter it should be the same for all CPUs. > also appears to be the case in glibc. That makes sense because you > don't want the canary to be something that the attacker can easily > predict and store on the stack to bypass buffer overflow attacks: > > [1] kernel : > /* > * Initialize the stackprotector canary value. > * > * NOTE: this must only be called from functions that never return, > * and it must always be inlined. > */ > static __always_inline void boot_init_stack_canary(void) > { > unsigned long canary = get_random_canary(); > > current->stack_canary = canary; > #ifdef CONFIG_PPC64 > get_paca()->canary = canary; > #endif > } > > thanks, > > - Joel