Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4695565imw; Tue, 19 Jul 2022 11:23:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1smtKIoQ68Dew/xorP+K6597PpibbtRSQEkrynZh8ebyO5irBkXeEVpegZniTdELSy5OQho X-Received: by 2002:a17:907:3e82:b0:6ff:1e04:a365 with SMTP id hs2-20020a1709073e8200b006ff1e04a365mr31580650ejc.617.1658255009683; Tue, 19 Jul 2022 11:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658255009; cv=none; d=google.com; s=arc-20160816; b=VMg8g/i8ILlmAXmrpvYL7nQIlkpK3caTH/njNYryK5H3dsaNOoExDCvk86SGEsxN2F DPKPJe6P+yKhNKXYtikBqoiITAwPGNj5N9ziPwQfdzF7UxW3/ZdksFxEshVn1SJ20T9O +lZZY4sdCRion2q6anfNa2WeFtvatN9Xy/iDk4+TLDkKezkvQM3f40aROkhuCjyMq4W5 k1x1zNPcFWXOeGL2Jrt2TJT9PifXGhb5A+d3wPURT5bC2hYjvWeXSke9pv3642k31/dp v5AoeprcNKVNCAsyrAJ3QXR03qrjAK3HyKssy6l4ndCED7BNZWuomaNiEivAnTlNCAwp Q3Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:references :in-reply-to:subject:cc:to:from:date:mime-version; bh=MRgIJKPEP5jJ6H1hxnfKX1Y0Cnn0IixGBC20Y8vMJQg=; b=zfEAgke/CqSPLZyKzAi5tE9D+bqVWE5wbJwqMTtZZwVomNhyQqija428sWJB+5/L4k 2Wulg7//lhGiiHf9SYUv1QsVJn5zsWPFBNvME1kc0o4l/dpVldXHfQTEJ62oF+IBSV++ vdX99axNRRrrUa8b2RXCVOCetcbjyVccdXn6vxcnNBcHkvXycZFNi2SC+sPyfw0qNZz9 0TffGnk/AkLYl+3ydxyVariCt3g7B1ZoXa/HuwfYPPs4ynKIudtGi9Mtmlgblz+EEbFK H3mPng3ukAFFa22XsQvbH4srgRgHBGa8WQEOmUnG+4Lx39ZwF6wb2bf8S8iVEc73h6O5 sFaA== ARC-Authentication-Results: i=1; mx.google.com; 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 mp9-20020a1709071b0900b0072f00759bfbsi18103346ejc.634.2022.07.19.11.23.05; Tue, 19 Jul 2022 11:23:29 -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; 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 S239767AbiGSR6l (ORCPT + 99 others); Tue, 19 Jul 2022 13:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236212AbiGSR6j (ORCPT ); Tue, 19 Jul 2022 13:58:39 -0400 X-Greylist: delayed 63558 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 19 Jul 2022 10:58:38 PDT Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3515B491F8 for ; Tue, 19 Jul 2022 10:58:37 -0700 (PDT) Received: (Authenticated sender: joao@overdrivepizza.com) by mail.gandi.net (Postfix) with ESMTPA id 352F6240006; Tue, 19 Jul 2022 17:58:30 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 19 Jul 2022 10:58:30 -0700 From: Joao Moreira To: Sami Tolvanen Cc: Linus Torvalds , Thomas Gleixner , Peter Zijlstra , 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 Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation In-Reply-To: References: <87o7xmup5t.ffs@tglx> <87lesqukm5.ffs@tglx> <2f7f899cb75b79b08b0662ff4d2cb877@overdrivepizza.com> <87fsiyuhyz.ffs@tglx> Message-ID: <656a965d6241d3a697180cc4d05ada2b@overdrivepizza.com> X-Sender: joao@overdrivepizza.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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 > Clang always uses r11 for the indirect call with retpolines, so we'd > need to use another register. Nevertheless, splitting the constant into > two instructions would solve the call target gadget issue. Yeah, it clicked later yesterday. But, FWIIW, R10 is also considered a scratch register, although used for passing static chain pointers which I think is not a thing in kernel context. Last case scenario we can always do liveness analysis and I doubt we'll have a significant (if any) number of spills. If we are comparing through registers, I would suggest using a sub instruction instead of a cmp, as this will destroy the contents of the register and prevent it from being re-used on further unprotected indirect branches, if any exists.