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 2EC60CCA489 for ; Fri, 22 Jul 2022 15:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbiGVPia (ORCPT ); Fri, 22 Jul 2022 11:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233186AbiGVPi1 (ORCPT ); Fri, 22 Jul 2022 11:38:27 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886779B9E2 for ; Fri, 22 Jul 2022 08:38:26 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id f11so4723733pgj.7 for ; Fri, 22 Jul 2022 08:38:26 -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=/rSrjqI9Kq8RGPKAfu3pLnMgTVnevgNO0y+F18A2TzA=; b=WV5ctrz1+PeXgAcPRgqLh7wTHjXOYjUq7qOFHH+CFxhTLBBYOLTD+T3aVeQ1iTf3FA GbZ7o8cHdT5y5ztZFwpClnuN12p9WyBM7hU5B1u8zJBOz+KcUddlwgj6imTzQdZlyqPk 4CLZUWxvX0Ok+/+BTIJ/8g/nnstbkvCescOLG5DLZwysC4X0X94hY/3EM+XKtKfPfPXE HD5I4/NC0qfDahqJ3gzdmQ6nbSSfTmW5El49xlu8tPrNeTrxiLpxVUITqdG4u1JgoKMu UTG4p3PGbkF4GZXtTcYNnXop/EHetIENWcN9rzpO3wQiGhKULw+UIaW1iPE8qhkoZEjm mQOA== 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=/rSrjqI9Kq8RGPKAfu3pLnMgTVnevgNO0y+F18A2TzA=; b=w4N6+JlbMMS8u89lhdMhufiYJN7aewJS3ORfm4yrSdlPY4zp8qrVlQc7XwIXQcVv/z RfmrdAWiYRfV2qSk3GM15Vm1Ddsn+YjKP16vsfa2exl3nmgDFvrHeK3TWutobPbtkFmK T3+YQUDbft6TNLre/Ue41RA8RH6azIDFWzO5Knol3zvlRYU1PQopxlIDqO2RiokjUgd5 ANwJzDLns1fIbxY8A1WXdwjfxebgZuZ0vslSS6eqEXMpYuLlTdBTuliJMdeUefmYp/+l JIlP+Yp7r7KjsWYG2C7UCAEZTIg8CuL/eZaMyLL5ivZR/PIV4p6rp4dpN1X97cB+SAmB bQBw== X-Gm-Message-State: AJIora8eegYw6UiPLUz01nLewcLGa415XFqpBFVNM1QNHxIg5gdX53nm zHxq15xJHeWCJWNzKpUSELzXfg== X-Google-Smtp-Source: AGRyM1uUCt0KWEUdn9kQFCsjfgk6yZN3GCybr7vj94Wr78VgjCgbCHabQq7Pyo+XCqIkQs17HeKssg== X-Received: by 2002:a05:6a00:1d8f:b0:52a:b787:b480 with SMTP id z15-20020a056a001d8f00b0052ab787b480mr455620pfw.71.1658504305473; Fri, 22 Jul 2022 08:38:25 -0700 (PDT) Received: from google.com ([2620:15c:201:2:9655:152c:19f:5d09]) by smtp.gmail.com with ESMTPSA id k4-20020a170902c40400b0016782c55790sm3983157plk.232.2022.07.22.08.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 08:38:24 -0700 (PDT) Date: Fri, 22 Jul 2022 08:38:17 -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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 22, 2022 at 12:23:30PM +0200, Peter Zijlstra wrote: > and things are 'good' again, except for functions that don't get a kcfi > preamble, those are unaligned... One way to fix this would be to just emit an empty KCFI preamble for non-address-taken functions when patchable-function-prefix > 0, so all the functions end up with the same alignment. Note that Clang doesn't keep the function entry aligned with -fpatchable-function-entry=N,M, where M>0. It generates .p2align 4, 0x90 before the nops, but if you want to maintain alignment for the entry, you just have to tell it to generate the correct number of prefix nops. > I couldn't find where the patchable-function-prefix nops are generated > to fix this up :/ It's all in AsmPrinter::emitFunctionHeader, look for emitNops. > Also; could you perhaps add a switch to supress ENDBR for functions with > a kCFI preamble ? I'm planning to do that in a follow-up patch. I would rather not add features that are not critical to the initial patch to avoid further delays in getting the compiler changes accepted. Sami