Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2164414ybh; Fri, 17 Jul 2020 10:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXMCSJrAeGwm4+JdzWk9aoA3ysKT08j59eBGWEwTsDtICX6W9vgQS+udOETuXi0GR2oCa7 X-Received: by 2002:a17:906:7e04:: with SMTP id e4mr10206132ejr.83.1595008126747; Fri, 17 Jul 2020 10:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008126; cv=none; d=google.com; s=arc-20160816; b=lT+2zt1ikvZyH27tq24d3eHyDKw48TVwq+V50a/CtujdTAkxLKwcJZof9RS8s92j1u uft+6eGlYf7dgoD7ulPMuQrfArfubOe5uJu8YXSZ+IWKCzl/21ybkdiOxW7ROEJh3gYl 5kWSfIycYPdCBSNyVhMs9c0Ia6Vm1H3eU9npd9ANJmsQ21xRKU5Oc3/KCsajMpb6nC8f hYHEuuQF1zvqR81S4ouULUNNwm97becqX+uXmBLO7lmp0HK6EoWlGT9o3hmk2GnFADyM 6cz2DcOka4L+GouyrdzIj5to36boB1U3Bo3nbhUo4iP9Q9/ro6Tha76gTRnZw9Hmy9Et SEOQ== 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; bh=ouPoIbaznwUvpvUZ+d9Lmd0+7ZlkFrw9Vubc0luuMm4=; b=P2+ZS2P80HUzXkudeGYbFdOQSG/OhQTShtjFTOtVhvxS3IGj/YdEpfx/O0Wu1UCzpf Zcx8yL1ceflU6fwhMnSS30IJ060s0FjmVGUxjaL9/yEnRwoKZoCTqzb25W0wPmeWHKap fwJwnzWtM2IA3jjPxWcuy9E0e0+tqejPA2S6YZrP8h+Rx3wKjl4c1IwFQylOSl2lRgcV Tk2weJ7te+JMBmpDHe2UEC33B6mOBydLzlPAlHvaZr7z4zih45oijaKo7ycQVd9sDfe+ 8EMwJesdnTMFEw5Bl33uYIrUMWTkymLXLdv3wjPeElrv0m6s+fPCeCvgITWW36VfpNsX Vavg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T6HKmBM9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj23si5405437ejb.746.2020.07.17.10.48.24; Fri, 17 Jul 2020 10:48:46 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=T6HKmBM9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbgGQRsF (ORCPT + 99 others); Fri, 17 Jul 2020 13:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgGQRsE (ORCPT ); Fri, 17 Jul 2020 13:48:04 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2942CC0619D2 for ; Fri, 17 Jul 2020 10:48:04 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id a21so11722521ejj.10 for ; Fri, 17 Jul 2020 10:48:04 -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=ouPoIbaznwUvpvUZ+d9Lmd0+7ZlkFrw9Vubc0luuMm4=; b=T6HKmBM9wpL/nF5N2IowQkS/pBz5KcI4emAgAF/8bejb3Rhx2qwrGgob1UjZiG3w7S sV6mfszfROVCaEu8RGIpZ4VkI2TfV76l3kRAt5KhIYLORviINuEzJTcBZun0PPQ+17yC sL7ngdlkBSr0haa/a+I8w89hJ7YH96WrmJqjEEQ0IghXlJVhpi5weKEIajlkG6ys7hyd bZmMEpFCkEu4wbXN27ODtK768/E5FhwvDDArao/vNYiIfxrf2lW3myBzMBQ5v233gbff d1eBjiTWMO6Gs1QkbbmCsFdWavwcujwbbYY4NlsshvUcQAPvgs23KuSHpFcZHhwd9zi3 jBBQ== 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=ouPoIbaznwUvpvUZ+d9Lmd0+7ZlkFrw9Vubc0luuMm4=; b=IKHatP6jDHRLrWAzIH2fLBL+/HdH/moHgEF1KQEkFoNloMFmHqtlFKJ0o5V+nBxJ45 UNx7y2SNA/D5Eu22ckfbJGv1e/5llSWA7gJo7d3WVchugZ38n1W7+1E+N/Bwa31TbD+R 84prQXlMw9wAIzslsSFenxfyKEFqZ9L2HtyAu1VRhkGyJKPjIM5fC3j7+OjdoBvDpFQ6 DctlUejfJDtBP4f2WWb4Nnbgtb8zUjf29JFhn0C2qlRiRr4EXo8h7BTlrVB7uqTwgt6n sCNAQ30i6UWlbViYOub9OPFOcRW4FjJjWpEooMv1BumtShkZHLqTH7/fwfEk9RlkAQuk jMzQ== X-Gm-Message-State: AOAM532dCLlPvDgxmNWCtrFZ4d5ktP9ybA3Y6+yh6kPB1eAjlxMAccPM bJhGaaK4+9tksDl2SJSz0/D12ztG8cNi2+hCC4hEwA== X-Received: by 2002:a17:906:6959:: with SMTP id c25mr9393908ejs.375.1595008082575; Fri, 17 Jul 2020 10:48:02 -0700 (PDT) MIME-Version: 1.0 References: <20200624203200.78870-1-samitolvanen@google.com> <20200624203200.78870-5-samitolvanen@google.com> <20200624212737.GV4817@hirez.programming.kicks-ass.net> <20200624214530.GA120457@google.com> <20200625074530.GW4817@hirez.programming.kicks-ass.net> <20200625161503.GB173089@google.com> <20200625200235.GQ4781@hirez.programming.kicks-ass.net> <20200625224042.GA169781@google.com> <20200626112931.GF4817@hirez.programming.kicks-ass.net> <20200717133645.7816c0b6@oasis.local.home> In-Reply-To: <20200717133645.7816c0b6@oasis.local.home> From: Sami Tolvanen Date: Fri, 17 Jul 2020 10:47:51 -0700 Message-ID: Subject: Re: [RFC][PATCH] objtool,x86_64: Replace recordmcount with objtool To: Steven Rostedt Cc: Peter Zijlstra , Masahiro Yamada , Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux , Kernel Hardening , linux-arch , linux-arm-kernel , linux-kbuild , LKML , linux-pci@vger.kernel.org, X86 ML , Josh Poimboeuf , Matt Helsley 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 Fri, Jul 17, 2020 at 10:36 AM Steven Rostedt wrote: > > On Fri, 17 Jul 2020 10:28:13 -0700 > Sami Tolvanen wrote: > > > On Fri, Jun 26, 2020 at 4:29 AM Peter Zijlstra wrote: > > > > > > On Thu, Jun 25, 2020 at 03:40:42PM -0700, Sami Tolvanen wrote: > > > > > > > > Not boot tested, but it generates the required sections and they look > > > > > more or less as expected, ymmv. > > > > > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > > > index a291823f3f26..189575c12434 100644 > > > > > --- a/arch/x86/Kconfig > > > > > +++ b/arch/x86/Kconfig > > > > > @@ -174,7 +174,6 @@ config X86 > > > > > select HAVE_EXIT_THREAD > > > > > select HAVE_FAST_GUP > > > > > select HAVE_FENTRY if X86_64 || DYNAMIC_FTRACE > > > > > - select HAVE_FTRACE_MCOUNT_RECORD > > > > > select HAVE_FUNCTION_GRAPH_TRACER > > > > > select HAVE_FUNCTION_TRACER > > > > > select HAVE_GCC_PLUGINS > > > > > > > > This breaks DYNAMIC_FTRACE according to kernel/trace/ftrace.c: > > > > > > > > #ifndef CONFIG_FTRACE_MCOUNT_RECORD > > > > # error Dynamic ftrace depends on MCOUNT_RECORD > > > > #endif > > > > > > > > And the build errors after that seem to confirm this. It looks like we might > > > > need another flag to skip recordmcount. > > > > > > Hurm, Steve, how you want to do that? > > > > Steven, did you have any thoughts about this? Moving recordmcount to > > an objtool pass that knows about call sites feels like a much cleaner > > solution than annotating kernel code to avoid unwanted relocations. > > > > Bah, I started to reply to this then went to look for details, got > distracted, forgot about it, my laptop crashed (due to a zoom call), > and I lost the email I was writing (haven't looked in the drafts > folder, but my idea about this has changed since anyway). > > So the problem is that we process mcount references in other areas and > that confuses the ftrace modification portion? Correct. > Someone just submitted a patch for arm64 for this: > > https://lore.kernel.org/r/20200717143338.19302-1-gregory.herrero@oracle.com > > Is that what you want? That looks like the same issue, but we need to fix this on x86 instead. Sami