From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C7C1C00307 for ; Fri, 6 Sep 2019 06:01:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ED2642081B for ; Fri, 6 Sep 2019 06:01:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cq9fnAbM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED2642081B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mOHWLYsYBfaMgK0d3iHzwjxCa4vL7XchSQ/XUDRB0m0=; b=Cq9fnAbMKGLTOo obmUfN1A0pLiXk2saQAhImmoO173wSwuKIalbwBMBdE29ZFfO2ZRDLb75vIudsEcZltG3crTUARkF 658aFShb7xJv+ETX8lXm8nyWM6jRCJdAYuVcQifJV/p59OePjp7QrpxKGKsnon0h+tmlhdSz5nIn0 Rn7CXC2/jqFD7kQ0YGY2O2sDw+2GlNMmq99E8thgwg1RX9MgwF7FwuGhN87PoUpAhJgJJ5YRhIKAL 21sH8v6ambZ6g8E6CEEM2pdxYsR9jRuiF5/MHqy908so0OnCuoiTBv9bM93J9ekpyUrDKSF/w/qfi X6rX2dj+xr+M0V3s4nEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i67Jc-0005t9-U8; Fri, 06 Sep 2019 06:01:48 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i67JZ-0005s0-Ia; Fri, 06 Sep 2019 06:01:46 +0000 X-UUID: 4abd6e27ed744027a7453885ec125f70-20190905 X-UUID: 4abd6e27ed744027a7453885ec125f70-20190905 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 401149852; Thu, 05 Sep 2019 22:01:34 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 5 Sep 2019 23:01:32 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 6 Sep 2019 14:01:31 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 6 Sep 2019 14:01:31 +0800 From: Mark-PK Tsai To: , , , , , , Subject: [PATCH] perf/hw_breakpoint: Fix arch_hw_breakpoint use-before-initialization Date: Fri, 6 Sep 2019 14:01:16 +0800 Message-ID: <20190906060115.9460-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190905_230145_622514_33FF0E70 X-CRM114-Status: UNSURE ( 8.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alix Wu , YJ Chiang , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Mark-PK Tsai Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org If we disable the compiler's auto-initialization feature (-fplugin-arg-structleak_plugin-byref or -ftrivial-auto-var-init=pattern) is disabled, arch_hw_breakpoint may be used before initialization after the change 9a4903dde2c86. (perf/hw_breakpoint: Split attribute parse and commit) On our arm platform, the struct step_ctrl in arch_hw_breakpoint, which used to be zero-initialized by kzalloc, may be used in arch_install_hw_breakpoint without initialization. Signed-off-by: Mark-PK Tsai Cc: YJ Chiang Cc: Alix Wu --- kernel/events/hw_breakpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index c5cd852fe86b..8fb842394924 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c @@ -413,7 +413,7 @@ static int hw_breakpoint_parse(struct perf_event *bp, int register_perf_hw_breakpoint(struct perf_event *bp) { - struct arch_hw_breakpoint hw; + struct arch_hw_breakpoint hw = {0}; int err; err = reserve_bp_slot(bp); @@ -461,7 +461,7 @@ int modify_user_hw_breakpoint_check(struct perf_event *bp, struct perf_event_attr *attr, bool check) { - struct arch_hw_breakpoint hw; + struct arch_hw_breakpoint hw = {0}; int err; err = hw_breakpoint_parse(bp, attr, &hw); -- 2.18.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel