Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp836466imi; Thu, 21 Jul 2022 11:57:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sp1C2UGdAl3P2o5t+yiSZ0EQV283Al37bWsJzfbv/iex6eyrlc16TTEhurMpYXrZI/Ihzn X-Received: by 2002:a05:6402:1cc8:b0:437:a61a:5713 with SMTP id ds8-20020a0564021cc800b00437a61a5713mr11326348edb.340.1658429864253; Thu, 21 Jul 2022 11:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658429864; cv=none; d=google.com; s=arc-20160816; b=OX6X3J0V7QWoMXPQUcBbse/BTLYmquZg5rrvzpPuQmpa44XXg4Y1oKPvfZj17rrMWY w66kKkELKISy4BuPOV2KnuuWz/MK60fETGJUL5/ZRYYEkoBRRj9FQ+RrLoq8BZUIL7UB TrUBy/keKz6yBKL7Bogr81n2vXKSxN0deceSAOpO8LbrQoB6yeuKBBN72Lz3am1YZH/Q TK9VjutNFep+2SeUlaBz10PBhOkc6lfZFCfLRKthagUJfKEEUiGhcRPM8eMNYrLFr8sq U3+E8EF2Kt2iW/RZ4o/4v+5Oe3CuXdWcXlwRY4SpGsQ3+LNF9/UFRr/IsPY590zhX8lh 3JuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=D9JpqZEU53bh6AtYjF7r1cnDZYnRyvg5wYCppRK50vo=; b=zhgk656NQdgLrwC7p6LdjFHDYBE8cVlc8+uhoGhYVOKT7YLXos8vpMMsq+bLcVEj0a Hfx0UEv7lLiVqXf1pZfBQHxgl8EH6jjoacv/Zo7PFoXrEwwOnpI/8yrDDY+LeYX2JjNU nZiCbxg06Eztpd50B1V8N/3buLG1qESACKnL6ePOGV10Jt23cpngEGuhSExEuM535XaD eH/nHvvkRoh0iubGGMLUrlYbCZvFmFeAl3cPOXpVCn8DWmDKnrQdZ6hvTx2XSDzBZWSP RN+msX3w8IyPEF1zsJf5tCVb6be0PrYf3uXsg9xufFR4cKM2SEeQzt7NcDvJTSnEK+zK 2KJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WOvbUVqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh13-20020a1709076e8d00b0072b4bdab026si3137326ejc.92.2022.07.21.11.57.19; Thu, 21 Jul 2022 11:57:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WOvbUVqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbiGUS2I (ORCPT + 99 others); Thu, 21 Jul 2022 14:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiGUS2G (ORCPT ); Thu, 21 Jul 2022 14:28:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCEDD8C77F for ; Thu, 21 Jul 2022 11:28:04 -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=D9JpqZEU53bh6AtYjF7r1cnDZYnRyvg5wYCppRK50vo=; b=WOvbUVqcHiJQyqPbaLBzH6gyBy aMUPEUk5TqIKVTz5C1g0IRBwPoRCrUAyjfSn+Bx+yMweT6Ycj251VGuOthWvlPHpQn25BLZSx3Zzi ok8Xy6aKFfU9eUmPC5Zp6GX2S+fvUhsV4uhAyS7PpeSOLtOhR6mD6n7ubwLbvTQrJpGinJ2PUR5Lo j3xmwcwVmCjm6++q7ZLFgaZrBQZYa9X0FRNasXzQ7Xkyv20c9wUXElXCWgcoO7NZuPjRNbrmvUZsj /f/NHmKAp3YPV9hNmoaZ0aDGgxi8CT4kVx1/1nbGTAdIn9lIcEbQ3pyyI9NhO22LWYHhJJUfPpHtm xaqgwTcQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEatF-00FZ2w-Q1; Thu, 21 Jul 2022 18:27:13 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 333DB980BD2; Thu, 21 Jul 2022 20:27:12 +0200 (CEST) Date: Thu, 21 Jul 2022 20:27:12 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Sami Tolvanen , Thomas Gleixner , Joao Moreira , LKML , the arch/x86 maintainers , Tim Chen , Josh Poimboeuf , "Cooper, Andrew" , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , "Moreira, Joao" , "Nuzman, Joseph" , Steven Rostedt , "Gross, Jurgen" , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann , Peter Collingbourne , Kees Cook Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022 at 11:06:42AM -0700, Linus Torvalds wrote: > On Thu, Jul 21, 2022 at 10:56 AM Peter Zijlstra wrote: > > > > this seems to work, let me go hack the kernel.. > > Am I missing something? > > Isn't this generating > > movl $~IMM,%r10d > negl %r10d > cmpl %r10d,-4(%calldest) > > for the sequence? > > That seems bogus for two reasons: > > (a) 'neg' is not the opposite of '~'. Did you mean 'notl' or did you mean '-'? > > Or am I missing something entirely? No, you're right, I'm being daft again. > (b) since you have that r10 use anyway, why can't you just generate the simpler > > movl $-IMM,%r10d > addl -4(%calldest),%r10d > > instead? You only need ZF anyway. Right, lemme see if I can wrangle llvm to generate that. > Maybe you need to add some "r10 is clobbered" thing, I don't know. R11,R11 are caller-saved, and since this is the actual call site, the caller must already have saved them or marked them clobbered.