Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp135530imi; Thu, 21 Jul 2022 17:45:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNJMzSFKhLYg+wARZTohJP4RLxPLLVnHInPYso+EFjAaFVPgnQ3x5lAg4aJ70WD5+m5zP7 X-Received: by 2002:a17:907:6e1d:b0:72f:20ad:e1b6 with SMTP id sd29-20020a1709076e1d00b0072f20ade1b6mr974201ejc.545.1658450756836; Thu, 21 Jul 2022 17:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658450756; cv=none; d=google.com; s=arc-20160816; b=BZcgzFdoKx2qFFOIUnTk1R8ol9j2pZrAWiN+LTaPuWpCuwRWuEecwgAWKTfASgkzfB W0ZhDtf8L4N44mMn0kJiBozBpQ/yJ/XJqstZuvd3yFEc0pILTmI9ft+QfL8ddtE+Qdvu RJl1hUxzMfbMsEzpoJz3VNd9fDWbAVAz1+ieO3T3oM0vgcY+NEdXOXu7KAU33Vf6ceLF +VgABn+xebj//2eh72YuY8ivZnZ/a7n8yHYo0e+Z23AAECy5ulS5FSPnNl9hsEXVOYWd qkRxbTIeQOf6g1lSwJE1WiJyexuriZ8kXDs8mVLkFS8yLc/NGha2nEC+VPo6+ZAVQHr1 MUbg== 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=u/7fNiPODzfNSY8xglDMrNgh+Uge6m986wMEeL9p7bI=; b=LXPvGLsP19up3NkDNcXaNQjjBt5MBpJQA2jJDTTt2z3Uk4ie/GoGt3xcbLct5V0TFx PCRqaS83YsEHuMWs+jqs/SEc+aW249H0XR8XkEZIgIjB8nMn4jYaqSxFZWXTss4fMX1R eP5XZDn3OGVRs9HWfttt0yz1TQZvBImDDKIq6BpvqiHEP6Da20muHGK+FkWP8VmkJCIE MWJVRFucjxRwuZ99uFo2ESKVxE0MjSpBzCBUhe5vvWvx3E3BoEtKPKGVMhkCdsrW5REC NtF3/xvX90keLENNL+cCxCiBOfpJBq9ghIr0U8M991uHI/7PVT3/lV/YGyz3wycUNyQo XWbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=OYXiFFdK; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh38-20020a1709076ea600b006f3b19b0bb9si4439988ejc.89.2022.07.21.17.45.32; Thu, 21 Jul 2022 17:45:56 -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=@google.com header.s=20210112 header.b=OYXiFFdK; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbiGVAQ0 (ORCPT + 99 others); Thu, 21 Jul 2022 20:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiGVAQX (ORCPT ); Thu, 21 Jul 2022 20:16:23 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABCDB1054E for ; Thu, 21 Jul 2022 17:16:22 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id b7-20020a17090a12c700b001f20eb82a08so6772961pjg.3 for ; Thu, 21 Jul 2022 17:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=u/7fNiPODzfNSY8xglDMrNgh+Uge6m986wMEeL9p7bI=; b=OYXiFFdKLiJasr7Ms3YN0oM0sfXeyJvx409brzZxSYQkTBECYyqnwd04V/wl1FHGrs uxT1wFXSwl7ZRo9v42KgMXBGyZMunMFN2KSCvKZKcJhxMROnkkgXQGpObYNoQaj6eYxR gZZiWzvhe6O/3lCqgWBlWsTjmk8YTQ4YX++OhgYV1L+s4FnGgU5b0YB+H9RerMKLcE5a 5tay/wZinslnm2QQn5oBam3oVyXiaY6LXmn6HVKjPBr1gjkGWVZ6kJYAjfyqDtY78j6K ScKXpReCWxriBni4velseVW8mxaaARx8p5XD8+fBe2GplVH22HAQaYP3RoxDdENUR+Zm qe3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=u/7fNiPODzfNSY8xglDMrNgh+Uge6m986wMEeL9p7bI=; b=EBfNERLCJPwy/8kNWz/YcXcCLJvW7gHTwPVeirJT2YXfugMgVYjE4JyvbvNIqYUwD3 VJuX4EKB1RRaNOOQitm/kRSylUjQgY6i1vJwd+sOxHqZK8FEi0uSZ4C0IMbrJVIjLZeq WMB7QRZs8ql7OoAHq7hUPdoFmijrEqGmiZsc3ehCVrCtJcV1O5azQvuct94VT+EGD07G DEuYYHZF+a4ZY2BRD6fpDMLYLRVYlTXGwKzTmIPxbKo7+rdOrLNrrrjOT1st8a8thfIy 8iVLBj7pD4fMr8t/GHCTx8hxJpSlvhjazND7nsGR9EXTR24hrSj1J0zvlwlbwdxkTE89 qmaQ== X-Gm-Message-State: AJIora85+/2nmDieGFKEdPtBLGVPVlBiDqtWTRBXxeaIajqPL++defRI Yhls5JLjcgl5wqXK31N7XfVTPA== X-Received: by 2002:a17:902:8647:b0:16c:e60e:570a with SMTP id y7-20020a170902864700b0016ce60e570amr784158plt.77.1658448981870; Thu, 21 Jul 2022 17:16:21 -0700 (PDT) Received: from google.com ([2620:15c:201:2:9655:152c:19f:5d09]) by smtp.gmail.com with ESMTPSA id z10-20020a170903018a00b0016bfb09be10sm2292188plg.305.2022.07.21.17.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 17:16:21 -0700 (PDT) Date: Thu, 21 Jul 2022 17:16:14 -0700 From: Sami Tolvanen To: Peter Zijlstra Cc: Linus Torvalds , 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 08:27:12PM +0200, Peter Zijlstra wrote: > 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. That looks good to me. I updated my LLVM tree to generate this code for the checks: https://github.com/samitolvanen/llvm-project/commits/kcfi Sami