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 F0BC8C433E0 for ; Tue, 9 Feb 2021 14:50:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A74C964E7C for ; Tue, 9 Feb 2021 14:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232236AbhBIOuo (ORCPT ); Tue, 9 Feb 2021 09:50:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbhBIOuh (ORCPT ); Tue, 9 Feb 2021 09:50:37 -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 DE54B64DB2; Tue, 9 Feb 2021 14:49:54 +0000 (UTC) Date: Tue, 9 Feb 2021 09:49:53 -0500 From: Steven Rostedt To: Miroslav Benes Cc: Peter Zijlstra , 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: <20210209094953.65d2f322@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> <20210208111546.5e01c3fb@gandalf.local.home> 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: live-patching@vger.kernel.org On Tue, 9 Feb 2021 09:32:34 +0100 (CET) Miroslav Benes wrote: > powerpc has this > > static inline unsigned long klp_get_ftrace_location(unsigned long faddr) > { > /* > * Live patch works only with -mprofile-kernel on PPC. In this case, > * the ftrace location is always within the first 16 bytes. > */ > return ftrace_location_range(faddr, faddr + 16); > } > > > > 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). > > And we can do this if a hard-coded value live above is not welcome. If I > remember correctly, we used to have exactly this in the old versions of > kGraft. We walked through all ftrace records, called > kallsyms_lookup_size_offset() on every record's ip and if the offset+ip > matched faddr (in this case), we returned the ip. Either way is fine. Question is, should we just wait till CET is implemented for the kernel before making any of these changes? Just knowing that we have a solution to handle it may be good enough for now. -- Steve