Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1708600pxb; Mon, 8 Mar 2021 04:35:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5J8uaN+ICOUGl/3K8dygqQ3R09H+kyonGhVRttb4r4YcAYx9I3Vr0va25wq94IYWE+lO4 X-Received: by 2002:a17:906:abcd:: with SMTP id kq13mr15185921ejb.477.1615206941753; Mon, 08 Mar 2021 04:35:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615206941; cv=none; d=google.com; s=arc-20160816; b=HqOyHe8037qc3iXIzNMeasDTdPqHxqE1vS85sb4CtWK91DEr9ukNhKDKWQNDZmZb+/ JS1PjfRqK1jaKHMtfjvAbf5kwmB+sDA0nTxBMhdYkD6LTtgPu4FoOEbgB4JBikjnXrKM 57ROinhViBqltu2YygL6eD/iqZ547yPZgO874uT5WzqbUe1taHgiDkZ8A0LFffE8lJVP 7lexv6VYPOoHyJZeWY9G5FZRML+LVi4KbfISUzti5WJiDjvKUYo+XFrU6a1pEeLAziPk 3tKOsenARR3UctlYngbxMRySWK041sVGPc6ZyA8SDgnd5dyyVaaUpCxgWilA+YfzRvqK FQbQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oG1jdsL27d1qjsprZNeLDvDO303a1CcYm3aD2G5+hX0=; b=Enbkjl8J2q65hF3ji+DvYL5BSCw6tkyXlhQBEgZ6+o7SpW5HVxq9WtM5i4HJafS/U6 2YkR2bXbdphFGCRDfFc3tHX6yjH130aTKTlft2p79E+zgg5UoywNa7khBu7EwoXspL2l bG2gbeqt52aqbYYgR2Pp7kPWO0VKRDGzX9omHulr2mJ8sGrV4/OQ/wLcq/B4Cd2GcNpQ atpL3/7whSVbwE2p2sycxhdJd0NtaJjqGFeK17eshPc+Qy48EuaMThZ4Hyur/Q8gLrVt 57hUGfZudK9Z71QuG3yPa5fk4X728Wo0f31o78OokKYJ9sEqlwilOh4lWehfCadWdY+M Mw1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GB2c7dsR; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e19si5759523edj.230.2021.03.08.04.35.19; Mon, 08 Mar 2021 04:35:41 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GB2c7dsR; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231734AbhCHMcV (ORCPT + 99 others); Mon, 8 Mar 2021 07:32:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:40978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbhCHMbv (ORCPT ); Mon, 8 Mar 2021 07:31:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C2974651CC; Mon, 8 Mar 2021 12:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615206711; bh=glepnS2PyHI4cIirF6sXbPDf6waIMx8obG42NtzmUmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GB2c7dsRnKaYGPq5Yta2wJK1n7MqSBWvGZAvN5v8Q4KtQ48w6VXaaf3AWdKGxuK16 PzuhsG2fkL8hItPvzGOwl3ifneRz2aN2EI+AE3c0B1wSOTYb6TiJcBZbntiGyyqA9d ccHVqmC/VLwgc1rp80JLc4+1Ne8pr7oxnDK4xK5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Chen Jun , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.4 20/22] ftrace: Have recordmcount use w8 to read relp->r_info in arm64_is_fake_mcount Date: Mon, 8 Mar 2021 13:30:37 +0100 Message-Id: <20210308122715.374350160@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308122714.391917404@linuxfoundation.org> References: <20210308122714.391917404@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Jun [ Upstream commit 999340d51174ce4141dd723105d4cef872b13ee9 ] On little endian system, Use aarch64_be(gcc v7.3) downloaded from linaro.org to build image with CONFIG_CPU_BIG_ENDIAN = y, CONFIG_FTRACE = y, CONFIG_DYNAMIC_FTRACE = y. gcc will create symbols of _mcount but recordmcount can not create mcount_loc for *.o. aarch64_be-linux-gnu-objdump -r fs/namei.o | grep mcount 00000000000000d0 R_AARCH64_CALL26 _mcount ... 0000000000007190 R_AARCH64_CALL26 _mcount The reason is than funciton arm64_is_fake_mcount can not work correctly. A symbol of _mcount in *.o compiled with big endian compiler likes: 00 00 00 2d 00 00 01 1b w(rp->r_info) will return 0x2d instead of 0x011b. Because w() takes uint32_t as parameter, which truncates rp->r_info. Use w8() instead w() to read relp->r_info Link: https://lkml.kernel.org/r/20210222135840.56250-1-chenjun102@huawei.com Fixes: ea0eada45632 ("recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64.") Acked-by: Will Deacon Signed-off-by: Chen Jun Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- scripts/recordmcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index b9c2ee7ab43f..cce12e1971d8 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -438,7 +438,7 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp) static int arm64_is_fake_mcount(Elf64_Rel const *rp) { - return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26; + return ELF64_R_TYPE(w8(rp->r_info)) != R_AARCH64_CALL26; } /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. -- 2.30.1