Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1709413pxb; Mon, 8 Mar 2021 04:36:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7f5ony4fkobMesmqNJwQouzRh041ibRE9e5i+WIQhNWMcYzT6/lLev1QpZGkHval6hIQ+ X-Received: by 2002:aa7:cf17:: with SMTP id a23mr22608815edy.30.1615207002741; Mon, 08 Mar 2021 04:36:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615207002; cv=none; d=google.com; s=arc-20160816; b=hibbLBHmhvq6NiQN7Im+0qM2lXcH2dvTvQHTqwpKvL3jlgdAph9S1QQGS7Y5ZFKWRD s6YSGWy6H7zDBcUhQ3FR5GOZabfKG4z+desHXGx5occqyeLUo8INpOKipompFb9Y+7Dz fU/A69lD1c8uOc/fh809LAnWoe2OeNpPUNEof72KcLbwNdU7TYZb7S/BYTzXCdWEd3xR ck+wsqOb7eKZ6jrB/7RsrvKoeGMiNTGCgMn5XFJ2oiRuTJwTlAr/MGlXzvM50p4/XZOg rSdxuED3o/enSS4T558QcNwlC41L7Zqw+NMWfOTbPuJMr8CIMtocQ+0AxTybqcMkVw/D C8Gw== 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=C5uM3r7AwSCDg86y2smfJlZlOMRClRWkajGm7oZ/1cDLhGv0N8bHtMIE+SDakExEkE A0p6Z8yQwpGnySaukuBel3wyoz8bUWLvJ7VKJnahrx+sP8ugu1DOn9Ht3u1FCUjQsSsG muAAbhwIxtftWBtJwH+Xkl6Zn6dCT2dHWj3o6c52nSBJasLzoXet5X11PMOpYUi7rbZd /rV5puqrTK9dvn1KJbkTtO0/1QynggmI0gEheSiq+SboEgNal7VeNua4nU6EfvkTCa9y +t76yX4qtQTkm/cmzv9SNn9EsNrRIa/LdWE0GJVN7R9CO6PKyX3+5P+4od60fss2WPSX rzmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Wfwevur; 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 t13si6952743ejr.172.2021.03.08.04.36.19; Mon, 08 Mar 2021 04:36:42 -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=1Wfwevur; 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 S230143AbhCHMfK (ORCPT + 99 others); Mon, 8 Mar 2021 07:35:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:43474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbhCHMeg (ORCPT ); Mon, 8 Mar 2021 07:34:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C22F8651CF; Mon, 8 Mar 2021 12:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615206876; bh=glepnS2PyHI4cIirF6sXbPDf6waIMx8obG42NtzmUmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WfwevuresGkZ6FllRbAlRgCF/8xZOAFiqDfzxaxugTHYWdvDRqs3DUVCx8c1W7TG 3Md8YjK/KzSr+doRO0cmPTONZ4JMn/N+j9TS/a1mvoARnoBNnjDFtVRYG0iXAgQI2f j0+2Jxe0oC5sDyr/Ycpek60pqLPbr8qE5/y8ej/M= 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.10 36/42] ftrace: Have recordmcount use w8 to read relp->r_info in arm64_is_fake_mcount Date: Mon, 8 Mar 2021 13:31:02 +0100 Message-Id: <20210308122719.881477587@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308122718.120213856@linuxfoundation.org> References: <20210308122718.120213856@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