Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp153676pxb; Wed, 3 Nov 2021 01:40:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx225otHer4GGs3sKXcVwbyKNG+H5+gAGuBWtj9ZF3HGhawutypybpwgpKmMUwhHHZCWoGF X-Received: by 2002:a05:6602:2d49:: with SMTP id d9mr4762899iow.11.1635928850924; Wed, 03 Nov 2021 01:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635928850; cv=none; d=google.com; s=arc-20160816; b=G8bmMRpA+gcAE1rRyXQCoyZQCnuTLRtnZZSo0tCJN8eN6aN2FMaUtxlF5UKGqdoIuY tGGN+t8OqX534EYenva6KbGBOR/weHS7VTlm2rHC07VeKscqSZIzsZofRNerL3fthgWo hyQILFr0u+PZsWNfIJkVAONa52qmNNCYWKX3RyQP3lQp+fJM8c/FCOsBaF+V5k7f6hO+ VLfkDNRNvqUy7IAUc3qytPIL6PihwZ9c4Ru+6DjroEVHjauwlO/7ZIqB+AAs3wLfFgIg +/KLYcRkJveMzxGRrrjci7Jz1GVId9bOqKmfsans0ApseWywJQnq4p7NQeO+WNUOsMiM AmvQ== 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=JsSCd4BUHuy7v+Nl/hcJhjaRwZ5I4g7Y8Z+ohPTpfsQ=; b=vC9Qj9fmY74stCiAC7y2Wfv2cn/DLCuqYLV0L8O/Ylykr7uZDlCmdKot03r/TVBxEU 7EiwLcklTJHBgGRTr5gkWd+hvuqQ8qXb1dm3NXh7k94J6bDmeNM5aQ2x3oV021wPxN8S 0wlTcaU5+hq9OcwnGGYj2Vw3iU6TaZh1i5oTSiuixtWpiCsCbSusG8tzTD7tXYJF9t4m guZLVp3tqrdKPvth3XacZXsNy9cSBLBZnLXlAUWhUsNt2XjZ/s8aFvpE9WEkWGLU6UgW 5KOvcFm63X2c68LnEAPVb/YGCCxq4atSK5TkSQg44/uY0YvHpuyYWP/ZB5lYM2/9X+M2 FyIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sOFEALaj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si2003482ios.12.2021.11.03.01.40.15; Wed, 03 Nov 2021 01:40:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sOFEALaj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbhKCIly (ORCPT + 99 others); Wed, 3 Nov 2021 04:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbhKCIlx (ORCPT ); Wed, 3 Nov 2021 04:41:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0B2C061714; Wed, 3 Nov 2021 01:39:17 -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=JsSCd4BUHuy7v+Nl/hcJhjaRwZ5I4g7Y8Z+ohPTpfsQ=; b=sOFEALajwKbrh4NJXZglhMjojt sslQXZ6An3xS/C5R4ixgCsmtppAP2XYyjf6b+umCO0YCJ4Q9vocClZkgKgu767KW7hmBIWoCiwqH/ SJem8ZBkFM3C0RhR4e8SmS5GwsFSdX0VQUpf5vyP6aH8thGxQw4HwE58snW4k97RxqQuHhOLKP7Xq lWJTy4x6UO20nW2URnTbs2k5GMR87vi5jrbWcdHPnWESyp3ZaVAcYoCsDo0mRGojnkOCgKGeKgxUF 15kUPASdSFIG+XRyerIRFVGDKbdmKvWSfNZMG/6idh2SoXYBar2S7Rn9tuCjRQ1EDUaiETM21lcgV D/95v6Tw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1miBkW-00550p-6T; Wed, 03 Nov 2021 08:36:35 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id C745F986378; Wed, 3 Nov 2021 09:35:59 +0100 (CET) Date: Wed, 3 Nov 2021 09:35:59 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Kees Cook , Ard Biesheuvel , Sami Tolvanen , Mark Rutland , the arch/x86 maintainers , Josh Poimboeuf , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, Linux Kernel Mailing List , llvm@lists.linux.dev Subject: Re: [PATCH] static_call,x86: Robustify trampoline patching Message-ID: <20211103083559.GB174703@worktop.programming.kicks-ass.net> References: <20211101090155.GW174703@worktop.programming.kicks-ass.net> <202111021040.6570189A5@keescook> <90a14299-ce56-41d5-9df9-f625aae1ac70@www.fastmail.com> <202111021603.EDE5780FE@keescook> 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 Tue, Nov 02, 2021 at 05:20:05PM -0700, Andy Lutomirski wrote: > I think that's a big mistake -- any sane ENDBR-using scheme would > really prefer that ENDBR to be right next to the actual function body, > and really any scheme would benefit due to better cache locality. Agreed, IBT/BTI want the landing pad in front of the actual function. > But, more importantly, IMO any sane ENDBR-using scheme wants to > generate the indirect stub as part of code gen for the actual > function. Sorta, I really want to be able to not have a landing pad for functions whose address is never taken. At that point it doesn't matter if it gets generated along with the function and then stripped/poisoned later, or generated later. As such, the landing pad should not be part of the function proper, direct calls should never observe it. Less landing pads is more better.