Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5798446imw; Wed, 20 Jul 2022 12:47:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNI2AgJeJfDKr8JNG8cWDvGdZ3zSFqd4RGC6U0qOULU2WzkNlwk99ueGuyJ12rjB/KgRlw X-Received: by 2002:a17:902:d509:b0:16d:2191:c451 with SMTP id b9-20020a170902d50900b0016d2191c451mr4320464plg.131.1658346454053; Wed, 20 Jul 2022 12:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658346454; cv=none; d=google.com; s=arc-20160816; b=E/MWzzRGRApDyQPwoVUzUVSPDC6eOf4LiLs8Eh2uuozDeEFZ4iI7T+f06ENsREex6i iB7bkFSRKHbjLAnI0ZLJ/LDyNNlr3Di78JHlncn6kBYVLtwXac01g9fhSqHyHWvOChpb TT9lj/U4Gn3zfkSCaAK7+wsQ3UNScg+BqzwosS2kx5yYZLMgHTfaIjZGJsY8FtZ+p3WU foZCSHcszK6JWHaCYZPY7IlUlbmp2AXG9UnXX+cSouF/iOo6QKLnKJTuz7gNROmLc2Uo +C5Nj7vOChj6V61lceFWjEs6KTRDtsuVKJ4qSFe64BnxMhY2ysp0/uSc2pjNhWppovzG DkVQ== 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=Ox6O9Gm4Xocdz9Dx1hEcNVYNiyGO9dkfC4GAUnl++hQ=; b=PKFhsPYt5LaTXRr5awM4hYZy9Td0+UhtdJGOCtqa+/l/wWprmhSkSU3oUS5EJi1KB6 PwFQ9fzlk736Ox6jlwkBqoQIgZAghj3kiKYiNCzHn/baDYHJedXBV5SahA5mvEBzEXd4 sn5vMdS1xbjJeq5ER9mLOXSS/S3YXodz55cSUkhf05nl2Ihjt8/E0pEWyyYvDGTE9pYE 2bTz0UtZWsJKDHKoH1Z0F+q46T3+Nk2IZepF39ECT3iby0GpFghG+9POHod+FmTzZZd+ ksw/SlElzXml5zmx9MGikf301TFjBh94JSaaTz7XEYi0KQGLAVkR5uBJdAZUUIaPwP4Q Ksfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=UWq+thcx; 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 u11-20020a056a00158b00b0052acaf4a3c0si128067pfk.17.2022.07.20.12.47.20; Wed, 20 Jul 2022 12:47:34 -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=UWq+thcx; 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 S235494AbiGTTml (ORCPT + 99 others); Wed, 20 Jul 2022 15:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbiGTTmj (ORCPT ); Wed, 20 Jul 2022 15:42:39 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7307E54658 for ; Wed, 20 Jul 2022 12:42:38 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id q16so14215401pgq.6 for ; Wed, 20 Jul 2022 12:42:38 -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=Ox6O9Gm4Xocdz9Dx1hEcNVYNiyGO9dkfC4GAUnl++hQ=; b=UWq+thcxVh3baukLxLz7PR7+gR9zPMO3QUAYm3OiJ+S3pQu7yl9vhaMsaVCr26QfFj MCvdGPrjOdEecd7y7a0J6ADivBbOMurPWIxyM94wYX6aeB6WKRtwH4XF53rN6BREx/D9 KeqhTPKUTTfxu2M/I9HTGuS0yx1J0R3oyuHW1HZZQ7LFAIp/2dKKxtRyr8rFcbWFIFXe JsdNC/YF3O6zJPrtOVGPlqGpFSoHhkaDmys853IxgxIMr9zY4D/tyhFyD2Et6mAmUfCB SD9dq30xIYzQhtsNsN+ci2u1eqP4deAbiZ96U2Bu8TptzWFFETnDCxSGNQoZ9NEXZiNj aVOw== 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=Ox6O9Gm4Xocdz9Dx1hEcNVYNiyGO9dkfC4GAUnl++hQ=; b=NId5eovSSwfIlz3HENkrK9TPqgPtuIJJcBQxi/3T+aim1nlaIAOOjCLjeYhKrbI6QK A6AQ8tMd2cTHVQC5SMG8Wgw5kpS727CD+hq7R6fB7k5eZe/V/Hr9fWpwZSPprw8JKxl5 edSgmQjaBC6ZfsLDC/lNMMAj0tKOh+oQeMSc7AlxCGeaLZ051nKsIoHed8PgTwXT0NVd urKNEtpKsenkb9sHlqDC50chU8fTSwrgpmIH2V11d9SFist8PTCgSkTSgsP7BeJt06Xm qgToVgz/jkYt2MnZCkgqi5pOqBuxRjYr7VvOph6YU4fP8iUJe5VPaZOhaWH9y7fQGEWv S4og== X-Gm-Message-State: AJIora+rMnztHxpK5w4+Nb/OR9cBu32DeevA7jyEGtiiLw6AUJV2v9pO AEnpDr1YVzdIR2XCvHZ25KHjdBgb108W0vBB X-Received: by 2002:a05:6a00:3392:b0:52b:4896:b317 with SMTP id cm18-20020a056a00339200b0052b4896b317mr26940349pfb.17.1658346157737; Wed, 20 Jul 2022 12:42:37 -0700 (PDT) Received: from google.com ([2620:15c:201:2:2568:566e:fec7:763b]) by smtp.gmail.com with ESMTPSA id w23-20020a170902a71700b0016c9e5f290esm14196344plq.10.2022.07.20.12.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 12:42:37 -0700 (PDT) Date: Wed, 20 Jul 2022 12:42:30 -0700 From: Sami Tolvanen To: Peter Zijlstra Cc: Thomas Gleixner , Linus Torvalds , LKML , the arch/x86 maintainers , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Steven Rostedt , Juergen Gross , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann , Peter Collingbourne Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation Message-ID: References: <20220716230344.239749011@linutronix.de> <87wncauslw.ffs@tglx> <87tu7euska.ffs@tglx> <87o7xmup5t.ffs@tglx> 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 Tue, Jul 19, 2022 at 01:51:14AM +0200, Peter Zijlstra wrote: > That means the offset of +10 lands in the middle of the CALL > instruction, and since we only have 16 thunks there is a limited number > of byte patterns available there. > > This really isn't as nice as the -6 but might just work well enough, > hmm? pcc pointed out that we can also just add two more ud2 instructions to the check sequence if we want to be safe, with the cost of extra four bytes per callsite. > Also, since we're talking at least 4 bytes more padding over the 7 that > are required by the kCFI scheme, the FineIBT alternative gets a little > more room to breathe. I'm thinking we can have the FineIBT landing site > at -16. > > __fineibt_\func: > endbr64 # 4 > xorl $0x12345678, %r10d # 7 > je \func+4 # 2 > ud2 # 2 > > \func: > nop4 > ... I assume this means the preamble must also be 16-byte aligned to avoid performance issues with the FineIBT alternative? Which means we'll have a 16-byte preamble preceded by the usual nop padding. Sami