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 6C7BEC43334 for ; Thu, 21 Jul 2022 18:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231295AbiGUS2J (ORCPT ); Thu, 21 Jul 2022 14:28:09 -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: 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.