From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D93373546D2; Thu, 2 Jul 2026 16:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010444; cv=none; b=k5uPBksAlDSJCdG0oMVWrCfHOMYooEhRcKJR+M8Jdk3ISfP7iczQmNbH/wRbG75foDG+llXck5+DFOlN+ymwqhYdZHpCtAl07kLgBk4521MTStwjXY85bHq+3o0uPEmsUmbktcfEd5/ICrnCtcOkmkJaLvY1726CWvxfVXQhYRs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783010444; c=relaxed/simple; bh=VbGzL76yxx+LmKo6dnpTInbc22RnSUPmAGXugds8V40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nhRIJMm+LHU2yKNEXRGz+g7jStiP1+uKGP8n1rXE9dzFV9H1c91euCokB0VVcTYS+bPK3nfIi9TpF8kq58Xv/FRJdR+8wSklMuzQWQXRhRpSVnX97r1XaYKHIA55fsRABu9HQPc53gt9nCPAAy0VUgoA67syWYllgp3MMCXf9+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p9L5ga7F; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="p9L5ga7F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B8231F00A3A; Thu, 2 Jul 2026 16:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1783010442; bh=u7IBqxsoW0rRKI83D/jFM1x48mKPt6TwcUwb2ebTtE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=p9L5ga7F0nzC+iLzfPD8KQKAdvnclPhgdD28dr9EH9Q2qpyDndszJqxliv9RmXAm1 4N7b8LkMwo/bc8DKAoPQwlT3xDlMG8y70WJ5xmJuTQFUPNACetRchCGq9LM7zFrEF9 YhZCntTiXCug73gtlvdlDSWao1KNI3h2HwC9kUY0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, bpf , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Peter Zijlstra , Linus Torvalds , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Zheng Yejian , Martin Kelly , Christophe Leroy , Josh Poimboeuf , "Steven Rostedt (Google)" , Andrey Grodzovsky Subject: [PATCH 6.12 068/204] scripts/sorttable: Use uint64_t for mcount sorting Date: Thu, 2 Jul 2026 18:18:45 +0200 Message-ID: <20260702155120.088724118@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260702155118.667618796@linuxfoundation.org> References: <20260702155118.667618796@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt [ Upstream commit 1b649e6ab8dc9188d82c64069493afe66ca0edad ] The mcount sorting defines uint_t to uint64_t on 64bit architectures and uint32_t on 32bit architectures. It can work with just using uint64_t as that will hold the values of both, and they are not used to point into the ELF file. sizeof(uint_t) is used for defining the size of the mcount_loc section. Instead of using a type, define long_size and use that instead. This will allow the header code to be moved into the C file as generic functions and not need to include sorttable.h twice, once for 64bit and once for 32bit. Cc: bpf Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Peter Zijlstra Cc: Linus Torvalds Cc: Masahiro Yamada Cc: Nathan Chancellor Cc: Nicolas Schier Cc: Zheng Yejian Cc: Martin Kelly Cc: Christophe Leroy Cc: Josh Poimboeuf Link: https://lore.kernel.org/20250105162346.373528925@goodmis.org Signed-off-by: Steven Rostedt (Google) Signed-off-by: Andrey Grodzovsky Signed-off-by: Greg Kroah-Hartman --- scripts/sorttable.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/scripts/sorttable.h +++ b/scripts/sorttable.h @@ -23,7 +23,6 @@ #undef sort_mcount_loc #undef elf_mcount_loc #undef do_sort -#undef uint_t #undef ehdr_shoff #undef ehdr_shentsize #undef ehdr_shstrndx @@ -39,6 +38,7 @@ #undef sym_name #undef sym_value #undef sym_shndx +#undef long_size #ifdef SORTTABLE_64 # define extable_ent_size 16 @@ -47,7 +47,6 @@ # define sort_mcount_loc sort_mcount_loc_64 # define elf_mcount_loc elf_mcount_loc_64 # define do_sort do_sort_64 -# define uint_t uint64_t # define ehdr_shoff ehdr64_shoff # define ehdr_shentsize ehdr64_shentsize # define ehdr_shstrndx ehdr64_shstrndx @@ -63,6 +62,7 @@ # define sym_name sym64_name # define sym_value sym64_value # define sym_shndx sym64_shndx +# define long_size 8 #else # define extable_ent_size 8 # define compare_extable compare_extable_32 @@ -70,7 +70,6 @@ # define sort_mcount_loc sort_mcount_loc_32 # define elf_mcount_loc elf_mcount_loc_32 # define do_sort do_sort_32 -# define uint_t uint32_t # define ehdr_shoff ehdr32_shoff # define ehdr_shentsize ehdr32_shentsize # define ehdr_shstrndx ehdr32_shstrndx @@ -86,6 +85,7 @@ # define sym_name sym32_name # define sym_value sym32_value # define sym_shndx sym32_shndx +# define long_size 4 #endif #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED) @@ -193,25 +193,25 @@ pthread_t mcount_sort_thread; struct elf_mcount_loc { Elf_Ehdr *ehdr; Elf_Shdr *init_data_sec; - uint_t start_mcount_loc; - uint_t stop_mcount_loc; + uint64_t start_mcount_loc; + uint64_t stop_mcount_loc; }; /* Sort the addresses stored between __start_mcount_loc to __stop_mcount_loc in vmlinux */ static void *sort_mcount_loc(void *arg) { struct elf_mcount_loc *emloc = (struct elf_mcount_loc *)arg; - uint_t offset = emloc->start_mcount_loc - shdr_addr(emloc->init_data_sec) + uint64_t offset = emloc->start_mcount_loc - shdr_addr(emloc->init_data_sec) + shdr_offset(emloc->init_data_sec); - uint_t count = emloc->stop_mcount_loc - emloc->start_mcount_loc; + uint64_t count = emloc->stop_mcount_loc - emloc->start_mcount_loc; unsigned char *start_loc = (void *)emloc->ehdr + offset; - qsort(start_loc, count/sizeof(uint_t), sizeof(uint_t), compare_extable); + qsort(start_loc, count/long_size, long_size, compare_extable); return NULL; } /* Get the address of __start_mcount_loc and __stop_mcount_loc in System.map */ -static void get_mcount_loc(uint_t *_start, uint_t *_stop) +static void get_mcount_loc(uint64_t *_start, uint64_t *_stop) { FILE *file_start, *file_stop; char start_buff[20]; @@ -277,8 +277,8 @@ static int do_sort(Elf_Ehdr *ehdr, unsigned int shstrndx; #ifdef MCOUNT_SORT_ENABLED struct elf_mcount_loc mstruct = {0}; - uint_t _start_mcount_loc = 0; - uint_t _stop_mcount_loc = 0; + uint64_t _start_mcount_loc = 0; + uint64_t _stop_mcount_loc = 0; #endif #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED) unsigned int orc_ip_size = 0;