Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp545362pxb; Tue, 9 Feb 2021 06:54:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1e2Bs7hotIRFIUEYsUPZWuC5N0n5XPJ3uyOPT/GnUTszyWLO+Cv8YU7MrofwdrR06hxbV X-Received: by 2002:a17:906:c010:: with SMTP id e16mr22176884ejz.91.1612882499358; Tue, 09 Feb 2021 06:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612882499; cv=none; d=google.com; s=arc-20160816; b=Rd2TzJB8cLMCszmtJHR/QEt0aWCMCGnPAYc8oYuIuAAbSI/faKSChvsN0hwfe1hajn fpG8/MV13TmchE4oyMznr+sdj1Xp5fRhpPLPJRZKXLmPs3RMA0KHZAwPKtCo3Gw9MaCF c03jITcq5uktSXd/O2y5GzxvcSfqX/5emGggm+JhOLsjKFuGp7IetTrmXnOZ/f3OcDgc 7CZWUu2/VGYiJbMlaBxDL+Tbb2xVVBOVmaGMTRiuiULxw3x7aIe3FtmlkqvfZ/xecDIn WRQLvbV3OoIfJpE8HViQpnZXR8FS89reI2LgxkajQn7NvAjmkXzGUTRujr911dUuQbCN CvZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KRsAZci16eh63BBJ76zwmn1S0GmT+PQfFUogcxLRYSE=; b=O6QiXqT1ytPefdq9Zmi92epBwVmjsSE4z4YaNzy095dHfFjJsM5XN/xfuCDg6AU4D0 iDjZwIqFLxGG50YlBiqIKcazYI3tv2kcxoc/0sGoiHc0I8Pv14LjVU6d4hCmpC82Y/9C U/g9fcRWJht8iG01s4pgf5G4YyZcS3yH2UKeQ7eSqma4FyXJo7+jfE3iIakfFkUvGlfI uXOTbA6owqVa35AwE9nS6Wa/pgHO/nL7oGC/PRSDfCZ3BS7ZDINhq1RyxP4JcBTnVdBl rstli2PgX5n2E9KOO5C0QRBbWb/OVuhbqM8YOKrxMkDAm1nATtPr+hbIXxWCMFf/39ys TTWg== ARC-Authentication-Results: i=1; mx.google.com; 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 s13si14956006edj.330.2021.02.09.06.54.34; Tue, 09 Feb 2021 06:54:59 -0800 (PST) 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; 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 S231998AbhBIOup (ORCPT + 99 others); Tue, 9 Feb 2021 09:50:45 -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: linux-kernel@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