Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3637152imu; Mon, 28 Jan 2019 08:13:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5tPJoE6T/wKGfaTuh/Q0GTSz9H4YXpeVQoIGLbmJ5AlA5GVjL0uIqTcGU60ylgxwT6lJv7 X-Received: by 2002:a62:39cb:: with SMTP id u72mr22399123pfj.223.1548691998515; Mon, 28 Jan 2019 08:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691998; cv=none; d=google.com; s=arc-20160816; b=GWiEfow5ogjhDPdH9+d1QppeEOM6q5Jj2xQ5UB51IeCksfiuiQLRx8lQGbn68l934y Uo+H1cBHGV5nQQtyI32AJbL2on+47odid1Hr3323U2cjqkwKdWNoiRY8iM5cCsYy+mj3 xaHz0GivQmuJyoW6LJzImFxw2gcwjM6g4Hnlr/LBzEy8nceUFuuXAd7l0kZZLT8mnaup veUUI1oYdo5w6ies6+bznFoaaRsothKB6W3Ht4+Pq+RXWYIf9AIOIIzVY300LEQBibUs HlG+IhnpCzTeRaM/+FsoQ2MzHFvtYv4X5ShuciMfHHb2hV6HE9yY1h6PJ2QurzoaIira 521Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5FaCVJo0kixVXhGM4EXj0buxeI0nCCn3IFbaSn7UMpI=; b=dH3WzpgLIW/kf0kIl22CGXLuGaK/23YYfHqfjM55oOI1XYo1aA41s1PThGhl0ZCcJ8 y/1906zpgEvw1HqMSTVPHnSwhCMw0vHkmh5H1R1fjLZhaeEsIeaqYO6ANhGxvIxHUwUM tC58DJ9/OB4BFZjg6180b01nHP5v7EH3tVYNZaQmhySBBrOwLnSU+pJVnDbBZ0M4FBjA Z1GJ2vwoOOS9DkX64GWjIdI3ClgZsLY3DQIiqnyZUKzNvx8BBnRhCMlJclOvGxeKqaZm BO91uQ4Apr/CNEOf5xyO5sWfKuR3yHu7jxUCv7lEg744vP9wgRVJ8iRwfb0Y5YxASAy+ 5klg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bK4TvwSJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si18390122pfb.92.2019.01.28.08.13.02; Mon, 28 Jan 2019 08:13:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bK4TvwSJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733064AbfA1QMB (ORCPT + 99 others); Mon, 28 Jan 2019 11:12:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733054AbfA1QL4 (ORCPT ); Mon, 28 Jan 2019 11:11:56 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 959272147A; Mon, 28 Jan 2019 16:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691915; bh=KZ51WbxuHMBDzOgtr0oM85ZM/uLWiX2hpYMI96fMqh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bK4TvwSJXm9XA2vfv7vMatb5SIjipCoqhMca+w+uaKL5GjV8SLXdCn05y9CDSe/UR 3eM+Uh9uPBe3zuoKUBUjzlgrutd/eyMxbXX/MO1NGHBeTyhnC0Fsh2BJh3luvAl3ar R1F/silbCS+V0Eh9+lPwirkNmVYb4BCkAaDrMpnc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anders Roxell , Arnd Bergmann , Will Deacon , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.19 257/258] kernel/kcov.c: mark write_comp_data() as notrace Date: Mon, 28 Jan 2019 10:59:23 -0500 Message-Id: <20190128155924.51521-257-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anders Roxell [ Upstream commit 634724431607f6f46c495dfef801a1c8b44a96d9 ] Since __sanitizer_cov_trace_const_cmp4 is marked as notrace, the function called from __sanitizer_cov_trace_const_cmp4 shouldn't be traceable either. ftrace_graph_caller() gets called every time func write_comp_data() gets called if it isn't marked 'notrace'. This is the backtrace from gdb: #0 ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:179 #1 0xffffff8010201920 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:151 #2 0xffffff8010439714 in write_comp_data (type=5, arg1=0, arg2=0, ip=18446743524224276596) at ../kernel/kcov.c:116 #3 0xffffff8010439894 in __sanitizer_cov_trace_const_cmp4 (arg1=, arg2=) at ../kernel/kcov.c:188 #4 0xffffff8010201874 in prepare_ftrace_return (self_addr=18446743524226602768, parent=0xffffff801014b918, frame_pointer=18446743524223531344) at ./include/generated/atomic-instrumented.h:27 #5 0xffffff801020194c in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:182 Rework so that write_comp_data() that are called from __sanitizer_cov_trace_*_cmp*() are marked as 'notrace'. Commit 903e8ff86753 ("kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace") missed to mark write_comp_data() as 'notrace'. When that patch was created gcc-7 was used. In lib/Kconfig.debug config KCOV_ENABLE_COMPARISONS depends on $(cc-option,-fsanitize-coverage=trace-cmp) That code path isn't hit with gcc-7. However, it were that with gcc-8. Link: http://lkml.kernel.org/r/20181206143011.23719-1-anders.roxell@linaro.org Signed-off-by: Anders Roxell Signed-off-by: Arnd Bergmann Co-developed-by: Arnd Bergmann Acked-by: Steven Rostedt (VMware) Cc: Will Deacon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/kcov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kcov.c b/kernel/kcov.c index 97959d7b77e2..c2277dbdbfb1 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c @@ -112,7 +112,7 @@ void notrace __sanitizer_cov_trace_pc(void) EXPORT_SYMBOL(__sanitizer_cov_trace_pc); #ifdef CONFIG_KCOV_ENABLE_COMPARISONS -static void write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) +static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) { struct task_struct *t; u64 *area; -- 2.19.1