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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 E12C4C65C20 for ; Mon, 8 Oct 2018 16:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97BE52145D for ; Mon, 8 Oct 2018 16:31:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97BE52145D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbeJHXoR convert rfc822-to-8bit (ORCPT ); Mon, 8 Oct 2018 19:44:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbeJHXoR (ORCPT ); Mon, 8 Oct 2018 19:44:17 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (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 38C912089D; Mon, 8 Oct 2018 16:31:43 +0000 (UTC) Date: Mon, 8 Oct 2018 12:31:40 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Andy Lutomirski , linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Masami Hiramatsu , Mathieu Desnoyers , Matthew Helsley , "Rafael J . Wysocki" , David Woodhouse , Paolo Bonzini , Josh Poimboeuf , Jason Baron , Jiri Kosina , ard.biesheuvel@linaro.org, Andy Lutomirski Subject: Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function" Message-ID: <20181008123140.666fa405@gandalf.local.home> In-Reply-To: <20181008155757.GC5663@hirez.programming.kicks-ass.net> References: <20181006015110.653946300@goodmis.org> <20181006015720.634688468@goodmis.org> <20181006121211.GA5663@hirez.programming.kicks-ass.net> <20181006093905.46276505@vmware.local.home> <20181008072134.GB5663@hirez.programming.kicks-ass.net> <20181008155757.GC5663@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Oct 2018 17:57:57 +0200 Peter Zijlstra wrote: > On Mon, Oct 08, 2018 at 01:33:14AM -0700, Andy Lutomirski wrote: > > > Can't we hijack the relocation records for these functions before they > > > get thrown out in the (final) link pass or something? > > > > I could be talking out my arse here, but I thought we could do this, > > too, then changed my mind. The relocation records give us the > > location of the call or jump operand, but they don’t give the address > > of the beginning of the instruction. > > But that's like 1 byte before the operand, right? We could even double check > this by reading back that byte and ensuring it is in fact 0xE8 (CALL). > > AFAICT there is only the _1_ CALL encoding, and that is the 5 byte: E8 , > so if we have the PLT32 location, we also have the instruction location. Or am > I missing something? Yes, this is exactly what I was thinking of doing. All we need to do is have objtool (or a modification of whatever we come up with), to find the call sites of a specific function (we can have a table to look up for), that creates a section listing all these call sites, and on boot up, we can confirm that they are indeed calls (e8 operations). -- Steve