Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2823650pxb; Mon, 17 Jan 2022 06:31:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdhmZNhrONgIkzQusMfINUl8vdrDBFYmIX12OJTCcGd9oxl3fGruP6+u4d+5C7HGYEBMmf X-Received: by 2002:a63:3645:: with SMTP id d66mr19324132pga.417.1642429901951; Mon, 17 Jan 2022 06:31:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642429901; cv=none; d=google.com; s=arc-20160816; b=OkfdmOZ2Z7ccfzIem3t3O+Hb+KBcmsRWaStYTmGXjHiCyDnwa4dBf5goqmXEIRR/f4 jqHKAjUz5FjSRcH7bjL/dWn5opS9y6nAMeUt4Y+rvwSsAbsTvoSnIEpXuX49OwCMbh1t AHsxVlOAVOGqCzeY0vmgOeFwrf5DIemFRk+N1LhEo4+HSdmvmgZHEUbRhIziFRlB9Vrv BY3wr6YddMpNCuDr0zyDhycN8LydElrvEpc+fLu6nWaMXl4h62Or/mp/j0W2rbjQBbkH tckMDJIrrzIYjEmG3gm9TfeevZDeNiupp+jeTcVaXueVdcK1BOU/uBH/LcGtZr1y/Xgk B9lw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=D90aO4CLK1lVEFGGz3amh2JdXWpqxojgV31Io//giF0=; b=knXL+mdFZvQut3Wgzc1PWeEuFvFwuABDBz4aRDrZYq1/e9lJkikXrDaiSTZPdgUEM2 lR0RP0Z5U/W+Lt24oeLaUAbuNQaoR7F9HCOg4AO5RhkeM8enFTLoF6YOx3e9KMaY8d8P H8CvqMldJCJm8LfLw78CbtOkGmqx4GwJYbfpKDAY5aDE7+3Wd3MwXKt8cT2zInXOD64J Udo0HsJpEqwFC8+NK95HFDodogadL0ZqMRS/RtjLUBzQMS2kPLijSW3wWfeIqs4oqVxt 0LQBojbejVtpWJqBVyqq3ub61ik67ry7fCS/Rq5selX8e9UmYjkRc7U7Wu+dE0c93HLz pQRQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si8142368pfm.262.2022.01.17.06.31.29; Mon, 17 Jan 2022 06:31: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234638AbiAQGXt (ORCPT + 99 others); Mon, 17 Jan 2022 01:23:49 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:47771 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbiAQGXs (ORCPT ); Mon, 17 Jan 2022 01:23:48 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R571e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=yinan@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0V2-m4ej_1642400624; Received: from localhost.localdomain(mailfrom:yinan@linux.alibaba.com fp:SMTPD_---0V2-m4ej_1642400624) by smtp.aliyun-inc.com(127.0.0.1); Mon, 17 Jan 2022 14:23:46 +0800 From: Yinan Liu To: rostedt@goodmis.org, nathan@kernel.org Cc: mingo@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] script/sorttable: fix some initialization problems Date: Mon, 17 Jan 2022 14:23:44 +0800 Message-Id: <20220117062344.15633-2-yinan@linux.alibaba.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220117062344.15633-1-yinan@linux.alibaba.com> References: <20220115225920.0e5939aa@gandalf.local.home> <20220117062344.15633-1-yinan@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Link: https://lkml.kernel.org/r/20211212113358.34208-2-yinan@linux.alibaba.com Fixes:72b3942a173c (scripts: ftrace - move the sort-processing in ftrace_init) Signed-off-by: Yinan Liu --- scripts/sorttable.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/sorttable.h b/scripts/sorttable.h index 1e8b77928fa4..13ae3262ec96 100644 --- a/scripts/sorttable.h +++ b/scripts/sorttable.h @@ -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 = {NULL, NULL, 0, 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; -- 2.19.1.6.gb485710b