Skip to contentSkip to conversation

tracing/scripts: Fix some initialization problems

GIT PULL Merged Steven Rostedt 2 participants 2 messages Jan 18, 2022 – Jan 19, 2022

lore
Share & tools
lore
#0 lore raw

Yinan Liu <[email protected]>

Linus,

tracing/scripts: Possible uninitialized variable

The 0day bot discovered a possible uninitialized path in the scripts that sort the mcount sections at build time. Just needed to initialize that variable.

Please pull the latest trace-v5.17-2 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.17-2

Tag SHA1: f6512a8d14cbc7d3a9cb63c872fbbabe26399a5a Head SHA1: 35140d399db2b67153fc53b51a97ddb8ba3b5956

Yinan Liu (1):
script/sorttable: Fix some initialization problems

----

 scripts/sorttable.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---------------------------
commit 35140d399db2b67153fc53b51a97ddb8ba3b5956
Author: Yinan Liu <[email protected]>
Date:   Tue Jan 18 14:52:41 2022 +0800

script/sorttable: Fix some initialization problems

elf_mcount_loc and mcount_sort_thread definitions are not initialized immediately within the function, which can cause the judgment logic to use uninitialized values when the initialization logic of subsequent code fails.

Fixes 72b3942a173c ("scripts: ftrace - move the sort-processing in ftrace_init")
scripts/sorttable.h +3 -2
index 1e8b77928fa4..deb7c1d3e979 100644
@@ -199,6 +199,8 @@ static int compare_extable(const void *a, const void *b)
 	return 0;
 }
 #ifdef MCOUNT_SORT_ENABLED
+pthread_t mcount_sort_thread;
+
 struct elf_mcount_loc {
 	Elf_Ehdr *ehdr;
 	Elf_Shdr *init_data_sec;
@@ -282,10 +284,9 @@ static int do_sort(Elf_Ehdr *ehdr,
 	unsigned int shnum;
 	unsigned int shstrndx;
 #ifdef MCOUNT_SORT_ENABLED
-	struct elf_mcount_loc mstruct;
+	struct elf_mcount_loc mstruct = {0};
 	uint_t _start_mcount_loc = 0;
 	uint_t _stop_mcount_loc = 0;
-	pthread_t mcount_sort_thread;
 #endif
 #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED)
 	unsigned int orc_ip_size = 0;
merge bot Merged
#1 lore raw
The pull request you sent on Tue, 18 Jan 2022 18:17:09 -0500:

The pull request you sent on Tue, 18 Jan 2022 18:17:09 -0500:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git trace-v5.17-2

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e9f5cbc0c851c1cf98e4ecc5d72b5563d3fc5605

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html