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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DF35C433E0 for ; Mon, 8 Feb 2021 18:33:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5BF064E84 for ; Mon, 8 Feb 2021 18:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235739AbhBHSc5 (ORCPT ); Mon, 8 Feb 2021 13:32:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:48410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbhBHQQl (ORCPT ); Mon, 8 Feb 2021 11:16:41 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 87DC464E82; Mon, 8 Feb 2021 16:15:48 +0000 (UTC) Date: Mon, 8 Feb 2021 11:15:46 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: Josh Poimboeuf , Linus Torvalds , Borislav Petkov , Dave Hansen , x86-ml , lkml , Alexei Starovoitov , live-patching@vger.kernel.org Subject: Re: [GIT PULL] x86/urgent for v5.11-rc7 Message-ID: <20210208111546.5e01c3fb@gandalf.local.home> In-Reply-To: References: <20210207104022.GA32127@zn.tnic> <20210207175814.GF32127@zn.tnic> <20210207224540.ercf5657pftibyaw@treble> <20210208100206.3b74891e@gandalf.local.home> <20210208153300.m5skwcxxrdpo37iz@treble> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Feb 2021 16:47:05 +0100 Peter Zijlstra wrote: > > /* > > * Convert a function address into the appropriate ftrace location. > > * > > * Usually this is just the address of the function, but on some architectures > > * it's more complicated so allow them to provide a custom behaviour. > > */ > > #ifndef klp_get_ftrace_location > > static unsigned long klp_get_ftrace_location(unsigned long faddr) > > { > > return faddr; > > } > > #endif > > I suppose the trivial fix is to see if it points to endbr64 and if so, > increment the addr by the length of that. I thought of that too. But one thing that may be possible, is to use kallsym. I believe you can get the range of a function (start and end of the function) from kallsyms. Then ask ftrace for the addr in that range (there should only be one). -- Steve