From nobody Fri Apr 11 05:52:31 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D274515CD46 for ; Wed, 2 Apr 2025 21:30:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743629448; cv=none; b=kZWzk2aLRwO87hJDOaoFLnglb5e9u+SfEnFKYutcnNd98OBcWc4tN6uH/TwgXpSQlbIRGJvqcDneo4aoc+5nuw+iPGybb8FuA3fUo9SqLSBls0e7gq0Xh24K9ukTRsvnqig6O2ai9ghNR9N1Jxw/br6WKVDMff88+6QRsTWIb7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743629448; c=relaxed/simple; bh=C2dSjSNqShMrX0gTQcD/Bl2yjMkTPLELhQfm6lR1qi0=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Rt+l6gcOWKbWZIZimo17hqiKmomyFDHSYS6Zj+lXBPAK6crWLNsLWq2FV4uLcrdOyp0kzqfRHwU21lORmxZk6LbfInGnOHkCAFaCbDyPDPvY/dbJBtpxcmis/imBcieWqBSmKI81jYCoEQyP+wiNeZWYyDTRKWA8crpI5p0L750= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 620FDC4CEEA; Wed, 2 Apr 2025 21:30:48 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1u05ge-00000006YAx-23DI; Wed, 02 Apr 2025 17:31:52 -0400 Message-ID: <20250402213152.339815163@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 02 Apr 2025 17:31:37 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Catalin Marinas , Nathan Chancellor , Heiko Carstens , Alexander Gordeev , Ilya Leoshkevich , Ihor Solodrai , Vasily Gorbik Subject: [for-linus][PATCH 1/2] scripts/sorttable: Fix endianness handling in build-time mcount sort References: <20250402213136.747061769@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vasily Gorbik Kernel cross-compilation with BUILDTIME_MCOUNT_SORT produces zeroed mcount values if the build-host endianness does not match the ELF file endianness. The mcount values array is converted from ELF file endianness to build-host endianness during initialization in fill_relocs()/fill_addrs(). Avoid extra conversion of these values during weak-function zeroing; otherwise, they do not match nm-parsed addresses and all mcount values are zeroed out. Cc: Masami Hiramatsu Cc: Catalin Marinas Cc: Nathan Chancellor Cc: Heiko Carstens Cc: Alexander Gordeev Link: https://lore.kernel.org/patch.git-dca31444b0f1.your-ad-here.call-0174= 3554658-ext-8692@work.hours Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_= loc table") Reported-by: Ilya Leoshkevich Reported-by: Ihor Solodrai Closes: https://lore.kernel.org/all/your-ad-here.call-01743522822-ext-4975@= work.hours/ Signed-off-by: Vasily Gorbik Signed-off-by: Steven Rostedt (Google) --- scripts/sorttable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sorttable.c b/scripts/sorttable.c index 7b4b3714b1af..deed676bfe38 100644 --- a/scripts/sorttable.c +++ b/scripts/sorttable.c @@ -857,7 +857,7 @@ static void *sort_mcount_loc(void *arg) for (void *ptr =3D vals; ptr < vals + size; ptr +=3D long_size) { uint64_t key; =20 - key =3D long_size =3D=3D 4 ? r((uint32_t *)ptr) : r8((uint64_t *)ptr); + key =3D long_size =3D=3D 4 ? *(uint32_t *)ptr : *(uint64_t *)ptr; if (!find_func(key)) { if (long_size =3D=3D 4) *(uint32_t *)ptr =3D 0; --=20 2.47.2