Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp117240imm; Mon, 4 Jun 2018 14:08:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKImYqATA3MyUf6TzePNA4HF41qkFCok3AhNU7kfVsTb0vlVpEWyFwQult58BEPxVDDKasH X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr23446810plk.101.1528146527944; Mon, 04 Jun 2018 14:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528146527; cv=none; d=google.com; s=arc-20160816; b=ax4TB+cN954r3fUM2v4JGZolNfx+zwr3gLyp885uNXp5OXDB7OjqhgYSA8CBk6geBM Osws6i5Z0qBG7EIbZVs5kPCGjgBf10bVSHQw/xN9vHs0DvOz+KNTt+nfccdsvVHXY7wc lgRM0wC/Iv4hajY6Y2tVsKU6ornAbf1xtD4uM0CFvxpqehBPveTzwza/m3cqd79WFhnn +9suZvgV5SFnGiyGpCF+YF7gBvzT86hXdWlOIHRBtnPashzUKYZfd2vs+n+oMe9zBP0I KHgy4LIUx1zGf+MImOhHZkEP0tilbnKC1+eJz01TRVA4TI4JWsh0/06cGCBpUvtsWAm5 20JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=ImVRlnPwppHJVdlgNqRY1pKrS4LuNP29TSdwSC40iuw=; b=kmyzFlKiZ+qGINlzH32JL4yvcriW+P3UJKHYfbQlSbMIM/pYb4UJU5iWKMQCEvz16u uWOUjv8s/DG4KmI7oRVJcAgNG6lHei+H0g6knXypsgW8pXMnjzbAQLY4EfIOG5migldV IsL2o+cKb0jCumHgXJRk6yO1/Nq2sSz+ukmv6Ls+hLN/6VKeLNPYPBnqxN48dGCW1bz1 kQ/3NzcVFKVwnAYi51oaHSWunH5LyRKvF/GsOIwzkyjTVGNb6tfUMq7+pNW4YmgWgTb6 nhWvLFSxC5v5aLs0k0Fq0HJF6mGQ2azp2w1boIzA5jg4BCGev5GhRB2cvgqYGbLf6f7N wl0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YYP1ftM/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67-v6si48096554pfm.167.2018.06.04.14.08.31; Mon, 04 Jun 2018 14:08:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YYP1ftM/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751530AbeFDVGQ (ORCPT + 99 others); Mon, 4 Jun 2018 17:06:16 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:34306 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbeFDVGP (ORCPT ); Mon, 4 Jun 2018 17:06:15 -0400 Received: by mail-io0-f195.google.com with SMTP id e15-v6so698620iog.1 for ; Mon, 04 Jun 2018 14:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ImVRlnPwppHJVdlgNqRY1pKrS4LuNP29TSdwSC40iuw=; b=YYP1ftM/d/RUTS4VQ6onLemaPJSXJBe9yGriq+JYR3gIq8inJxpaz9ESNZnOCwtErW ZxAp0Cua+8z6/2JzlP8NtkNLJQszhNG4FvJfPAlzLA7VEmNFqLnQ57JjrZjxYHg4nobE xYRodG/rTAPHwuDWPTDORrNBUAe/wJVbq5lsFBdcWDfIsdqh5v26J6xuA7m4W5Gtf9+z I2/fIM1o8iovLJE2/bZpcbARdpts2UGP66/cxzHzi77at7l5rYijXB7phwl6Sbdy8iGa wI4rOxitvfBqBxGsCsZZUGHGD42Flir8Bz8QeA5aYyq0CTDxu9TQ5xQDl8gbAh33KHp/ u+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ImVRlnPwppHJVdlgNqRY1pKrS4LuNP29TSdwSC40iuw=; b=dq56R8gW3Ba1/CsnDjKgpyPnnfjNhroA76cuams4cRoA0PP9iDw/LyKtAcryNaVNiF +DCaxBUINblF4o3VkXeKyjqC8tw3aCLx4VytW4TUwBSH3wRqAdVqDRJeoDle/G+qFI+8 RorcnXha6VS5gU0QfDd+8umR/ijvNp9eEg7FCxf9657d2byG21de60AHTPqbbPUpxxfj 7hUlAeln1PXsKRHOrWg0EVgUAUjQU/kaOcpKl7wzmqWGJKOq0M2PaGaZaKOJIK7Tpy3K 2qTUd/mZ9ifzqPRREpRAFb6qaHM+42b9gpD2mre/kLo/9kuUh1SUCOAxpmMnS+VqTuaF 2Sog== X-Gm-Message-State: APt69E1GxlMPfxK/Y1qOxqWoILA4RKRDPihba1Hgo2OMsejw0MRB3TpF rjOTnWuppki/8r3RhesdZ7KQyQn1TFZQ3Ne33tvD6Q== X-Received: by 2002:a6b:b802:: with SMTP id i2-v6mr3433618iof.41.1528146374375; Mon, 04 Jun 2018 14:06:14 -0700 (PDT) MIME-Version: 1.0 References: <20180529221625.33541-1-thgarnie@google.com> <20180529221625.33541-22-thgarnie@google.com> <20180604161612.6d48d8d2@gandalf.local.home> In-Reply-To: <20180604161612.6d48d8d2@gandalf.local.home> From: Thomas Garnier Date: Mon, 4 Jun 2018 14:06:03 -0700 Message-ID: Subject: Re: [PATCH v4 21/27] x86/ftrace: Adapt function tracing for PIE support To: Steven Rostedt Cc: Kernel Hardening , Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , "the arch/x86 maintainers" , Francis Deslauriers , Greg KH , Andrew Morton , Peter Zijlstra , Guenter Roeck , nixiaoming , James Hogan , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 4, 2018 at 1:16 PM Steven Rostedt wrote: > > On Tue, 29 May 2018 15:15:22 -0700 > Thomas Garnier wrote: > > > When using -fPIE/PIC with function tracing, the compiler generates a > > call through the GOT (call *__fentry__@GOTPCREL). This instruction > > takes 6 bytes instead of 5 on the usual relative call. > > > > If PIE is enabled, replace the 6th byte of the GOT call by a 1-byte nop > > so ftrace can handle the previous 5-bytes as before. > > > > Position Independent Executable (PIE) support will allow to extend the > > KASLR randomization range 0xffffffff80000000. > > I thought you were going to write a update to recordmcount.c to handle > this at compile time? I can correctly calculate the start of the call instruction with recordmcount (no need for addr-1) but I still need to handle the different size of the instructions. I don't think I can completely replace the GOT call with a relative call. Maybe I am missing something on the way recordmcount is used? Should it replace all mcount locations with a nop slide? Why is it done at runtime too then? > > -- Steve > > > > > Signed-off-by: Thomas Garnier > > --- > > -- Thomas