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 20C4FC433F5 for ; Thu, 17 Mar 2022 20:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiCQU32 (ORCPT ); Thu, 17 Mar 2022 16:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbiCQU31 (ORCPT ); Thu, 17 Mar 2022 16:29:27 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37EAD184B47; Thu, 17 Mar 2022 13:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=xR0Xh4vh08GEl/31xYqetrKFkUBS7jcWFuxXcXOUiME=; b=G9VgrZnwukc9WnA56jnt1JnSCn ueDpys8XWKhJlTH4ahmaGBXsQJUFZ50tnyCEBWYsKl30epdutFgvh0irWbEpe0mIZYcRS8mH1nK4o QA6YkQ1618lPwoIiMzC+6ZcWBl5f7l7LGbnLQbbv9jTvZ0Pz/4iLJH2aPmdyKGt206i7HGa2QIRTU 8NfXL99Pl44PXadqMmU/AGzs2uhNUdqcIMw3as8FwAbeG8tTxInU8OK6jFg4qYHvZ9dAxT33m9DFD VDSFNtc+USneRVDuSwFBgPKLAydAOLXDG6XzudS5bts1WPKceRkcBEvmu7gyu39FQ5Z51M5VPCAa5 UfetWT/Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUwik-001zXL-0y; Thu, 17 Mar 2022 20:27:43 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 558339882B3; Thu, 17 Mar 2022 21:27:41 +0100 (CET) Date: Thu, 17 Mar 2022 21:27:41 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Kumar Kartikeya Dwivedi , X86 ML , joao@overdrivepizza.com, hjl.tools@gmail.com, Josh Poimboeuf , Andrew Cooper , LKML , Nick Desaulniers , Kees Cook , Sami Tolvanen , Mark Rutland , alyssa.milburn@intel.com, Miroslav Benes , Steven Rostedt , Masami Hiramatsu , Daniel Borkmann , Andrii Nakryiko , bpf Subject: Re: [PATCH v4 00/45] x86: Kernel IBT Message-ID: <20220317202741.GP8939@worktop.programming.kicks-ass.net> References: <20220309190917.w3tq72alughslanq@ast-mbp.dhcp.thefacebook.com> <20220312154407.GF28057@worktop.programming.kicks-ass.net> <20220314204402.rpd5hqzzev4ugtdt@apollo> 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, Mar 15, 2022 at 11:26:10AM -0700, Alexei Starovoitov wrote: > The bpf trampoline can attach to both indirect and non-indirect > functions. My understanding is that only indirect targets will have > endbr first insn. So the fix totally makes sense. Correct, the compiler is free to not emit endbr if it can determine the function will never be called indirectly (or it is explicitly marked so with a function attribute).