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.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 71C58C433E2 for ; Wed, 22 Jul 2020 16:36:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56FF9207CD for ; Wed, 22 Jul 2020 16:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbgGVQgy (ORCPT ); Wed, 22 Jul 2020 12:36:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:50424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbgGVQgy (ORCPT ); Wed, 22 Jul 2020 12:36:54 -0400 Received: from gaia (unknown [95.146.230.158]) (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 23557206C1; Wed, 22 Jul 2020 16:36:53 +0000 (UTC) Date: Wed, 22 Jul 2020 17:36:50 +0100 From: Catalin Marinas To: Steven Rostedt Cc: gregory.herrero@oracle.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64. Message-ID: <20200722163650.GI27540@gaia> References: <20200717143338.19302-1-gregory.herrero@oracle.com> <20200717133003.025f2096@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200717133003.025f2096@oasis.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Fri, Jul 17, 2020 at 01:30:03PM -0400, Steven Rostedt wrote: > On Fri, 17 Jul 2020 16:33:38 +0200 > gregory.herrero@oracle.com wrote: > > From: Gregory Herrero > > Currently, if a section has a relocation to '_mcount' symbol, a new > > __mcount_loc entry will be added whatever the relocation type is. > > This is problematic when a relocation to '_mcount' is in the middle of a > > section and is not a call for ftrace use. > > > > Such relocation could be generated with below code for example: > > bool is_mcount(unsigned long addr) > > { > > return (target == (unsigned long) &_mcount); > > } > > > > With this snippet of code, ftrace will try to patch the mcount location > > generated by this code on module load and fail with: > > > > Call trace: > > ftrace_bug+0xa0/0x28c > > ftrace_process_locs+0x2f4/0x430 > > ftrace_module_init+0x30/0x38 > > load_module+0x14f0/0x1e78 > > __do_sys_finit_module+0x100/0x11c > > __arm64_sys_finit_module+0x28/0x34 > > el0_svc_common+0x88/0x194 > > el0_svc_handler+0x38/0x8c > > el0_svc+0x8/0xc > > ---[ end trace d828d06b36ad9d59 ]--- > > ftrace failed to modify > > [] 0xffffa2dbf3a3a41c > > actual: 66:a9:3c:90 > > Initializing ftrace call sites > > ftrace record flags: 2000000 > > (0) > > expected tramp: ffffa2dc6cf66724 > > > > So Limit the relocation type to R_AARCH64_CALL26 as in perl version of > > recordmcount. > > I'd rather have this go through the arm64 tree, as they can test it > better than I can. > > Acked-by: Steven Rostedt (VMware) Thanks Steve. > > Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount") This Fixes tag looks wrong. The above commit was for arm32. -- Catalin