From patchwork Wed Dec 5 09:35:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 152881 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9090301ljp; Wed, 5 Dec 2018 01:42:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/VtgoDRr2J5HLOPkxdP4OZ9gg2BtRx3KqaUtt85jnmr2QZpkU1xhMy/ar/AlAptF3iTCeNj X-Received: by 2002:a17:902:12f:: with SMTP id 44mr5520542plb.74.1544002963815; Wed, 05 Dec 2018 01:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544002963; cv=none; d=google.com; s=arc-20160816; b=f2qwuPriN4QX7Gw92eouVj1mP+qv82o1qjEKTt7QsXzAjWwGAxpfr5bOjd00x2ok62 JLfMX5AC3NuzEl/b1cRURAaVNuHeKuNDN3yRxTgNgvPt5JVdtYml4m/rkPBIpYR49Wf9 gzTqKQfaQvVfFEMt1WlP45K4gFAQjg2ltbjNelPqe/dme2oB44HlrsKgx+Ji8BdKb8JO t7gHjkksZcgCfm+HI/GLzclCpMt+EPG6vwPExFInwTdVDM7wAazG+RisA5irApQQdkEV Xcsizc1X6IoGlibuKHnv3ouXBeu6hEKKiht4OyVwcyPK5ruRo8D/dMVEHeodHojbBGiw DqNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=6Q6eTcoBvNrVczdZ0vj2hLIjzOSQYhra507grmaWAKg=; b=fRlNS6C2TYVxN3XP0lbj4i5GWq735lx403x6zGThH3ykwtULe0z0lweTKd7oev+wVP nM0SrW/2inWLQsbwdphEg0v4bLQ7UsVcDq/hrbo4ZLt/ps1jm+QKyJCd88laM5v0fgn1 o9/M+2lDsDEaTW+MDLGBs1wZU6wYCXGIx/KbiKRFTPjSDU2D3RVHe6XQrDKac4suqSvN iG2L4akgYMJ6fyiK393iuqzV9CsD6xzxGRxfHyrmcGuCMs76UJqyjre9VHd4X5eQWcBC IQO940UmDj2+olPA+R3w5SoxdgU/0m9lOLIGhYmdsTlcpHtZaAAOk0CgQmUGRCWTVduJ 9PNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nd61+pK5; 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 87si19759394pfs.7.2018.12.05.01.42.43; Wed, 05 Dec 2018 01:42:43 -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=Nd61+pK5; 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 S1729084AbeLEJml (ORCPT + 31 others); Wed, 5 Dec 2018 04:42:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:47210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728038AbeLEJmi (ORCPT ); Wed, 5 Dec 2018 04:42:38 -0500 Received: from sasha-vm.mshome.net (unknown [213.57.143.11]) (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 31FAA2084C; Wed, 5 Dec 2018 09:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544002957; bh=XrjACaW2SbwXiwPnkNZKwG2V44abROTSNb64Vc0wWYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nd61+pK5673DpIccWRf2cPMuU9oTP+6HGsl4B6ycLRlGt4AqO2ToxYet44PZZPAmd s9oeZ2nhoBAQ0YNnPlvHzh0wbP99Km4AyGrhxpgNkgaYt3SymqDDgrLoynlGW95wvC kzaelc5pdpLf+Xe+Bb9Qbaj5CDygNvCBZnY+jutU= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Anders Roxell , Arnd Bergmann , Dmitry Vyukov , Ingo Molnar , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.19 121/123] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace Date: Wed, 5 Dec 2018 04:35:53 -0500 Message-Id: <20181205093555.5386-121-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181205093555.5386-1-sashal@kernel.org> References: <20181205093555.5386-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anders Roxell [ Upstream commit 903e8ff86753e6f327bb92166a0665e4ecb8e2e7 ] Since __sanitizer_cov_trace_pc() is marked as notrace, function calls in __sanitizer_cov_trace_pc() shouldn't be traced either. ftrace_graph_caller() gets called for each function that isn't marked 'notrace', like canonicalize_ip(). This is the call trace from a run: [ 139.644550] ftrace_graph_caller+0x1c/0x24 [ 139.648352] canonicalize_ip+0x18/0x28 [ 139.652313] __sanitizer_cov_trace_pc+0x14/0x58 [ 139.656184] sched_clock+0x34/0x1e8 [ 139.659759] trace_clock_local+0x40/0x88 [ 139.663722] ftrace_push_return_trace+0x8c/0x1f0 [ 139.667767] prepare_ftrace_return+0xa8/0x100 [ 139.671709] ftrace_graph_caller+0x1c/0x24 Rework so that check_kcov_mode() and canonicalize_ip() that are called from __sanitizer_cov_trace_pc() are also marked as notrace. Link: http://lkml.kernel.org/r/20181128081239.18317-1-anders.roxell@linaro.org Signed-off-by: Arnd Bergmann Signen-off-by: Anders Roxell Co-developed-by: Arnd Bergmann Acked-by: Steven Rostedt (VMware) Cc: Dmitry Vyukov Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/kcov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/kernel/kcov.c b/kernel/kcov.c index 3ebd09efe72a..97959d7b77e2 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c @@ -56,7 +56,7 @@ struct kcov { struct task_struct *t; }; -static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) +static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) { unsigned int mode; @@ -78,7 +78,7 @@ static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) return mode == needed_mode; } -static unsigned long canonicalize_ip(unsigned long ip) +static notrace unsigned long canonicalize_ip(unsigned long ip) { #ifdef CONFIG_RANDOMIZE_BASE ip -= kaslr_offset();