From patchwork Wed Nov 28 08:12:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 152234 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp799439ljp; Wed, 28 Nov 2018 00:13:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/WZJPLQkh0kRTeQbOcEzudSfs6R4Ge3rNfIqvWqt/pO6g+7QBM42SafxId9QD1LQepCS8pr X-Received: by 2002:a63:2054:: with SMTP id r20mr32218478pgm.328.1543392804785; Wed, 28 Nov 2018 00:13:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543392804; cv=none; d=google.com; s=arc-20160816; b=wizMm3aNIH0jGajeGXQXROEYz8UmqV2Ch4C9RmcXove+PzPK253I7eW16iUTL+eCF6 W9yYNviOaZgZAvf87kFOS0Yc/AiQ6YhbJ3EDKY449vBKusONXWrgHWNFM/t5UT/BnniC LOkWL0re7+3dhH+OCO1OHMqD7mGzupeg9iTmNICFNzijvHkmbAKKHueWGsTtrC3gFE/I yliEu7grwPk2FacwGUvFu15+ClCVVhHq7up9mHW8OL5gmxLOMNSbEaQJ8UGrBH08nPWO LBpevSZAD1bf36RRJUfSD9JwJwAKMj1JD21tgO3g+kul68JdCaL83eri5QAW+ylyP7z9 I93w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=5DndGfj+rO1QfUt/p99pUy1MhXDetTHrbF5pavq8NU8=; b=kjXO8GT4Qr2ZWk794dQXJnO+Zw2mXE48yk+/KzRjuOtyIC1ZKnctMZeiO3wuSLYi9p stRpLuyGjsityaUvVKuwbTJ2WW7adEsyCsjTZNZBcWN5fq1gi54CI7PBdQiHtWoll0It FA43Yhe5jNVpA+Z38OuV+XTqZEFFu/4oCRD0PZCQ336fsf1dogGo17V+fiLgpFfYxYsp 89auBOrvIhnfWOzmima/0D56y6/R8yc3TY17lNp+3/tYGyAyd9RCuqiZ/77qAHNBrO0V Dyw2LkXjWFPe+zED+kE7Omd2fKMC8HkcGnnW40LE56iD8LtUCZPwTMCdHQ5UOcbUQ1wd rF8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jn4+ZB2O; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si6290042pgi.354.2018.11.28.00.13.24; Wed, 28 Nov 2018 00:13:24 -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=@linaro.org header.s=google header.b=Jn4+ZB2O; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbeK1TOH (ORCPT + 32 others); Wed, 28 Nov 2018 14:14:07 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45961 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727476AbeK1TOH (ORCPT ); Wed, 28 Nov 2018 14:14:07 -0500 Received: by mail-lj1-f196.google.com with SMTP id s5-v6so22562995ljd.12 for ; Wed, 28 Nov 2018 00:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5DndGfj+rO1QfUt/p99pUy1MhXDetTHrbF5pavq8NU8=; b=Jn4+ZB2O7N8A4mpqEFvOjLAnO6dDOZuQGt0wj5rPZGI3FBdD+V3Rg+WKww6xm7tGFR jY+2CYCjTBliu6PBMwOtv8k6uyPKB8w0jMnTfSxArxkU8MBTigDEym5tdG9fR4spqHvy gX+ML2II8NAZAWlP+oHDNP70wZBojfBXH7z3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5DndGfj+rO1QfUt/p99pUy1MhXDetTHrbF5pavq8NU8=; b=XjAfZtEw2pAkkul9lEiZCWlbuGUO5+u9QQ4XqfqhAO79ahMrkJRpZcfQ9x/4XT0Cp5 NZ08JlhJuPNXboCNq6Hwl0UaToFnlRIvyq9OwqcatCQsvSjr7FFmBNWEiJjIespHXKGK NgBBg3UBPaWGAUBOE1Ez5ucs1xUhZK//HCIClIYbXdDyXz05HFO9RX8ot4f+V12CID9v RhMyfPgt2lYtfTHCxmALDC9KgawVCAs+MKK3ngZRIOkEjgnX4q4zjTRQ2b7A/F/C9Ppl Ug+lNwVY+wTl+rvfZAKolW43vS+lzwjedt2U64brCnwfO8dlW0y87Y/Ugk8vudqTTzsy mVYQ== X-Gm-Message-State: AA+aEWbaBPP3uXi/ZJ29Ls/H2YGzTFosU8AzqkkmjbedYfIK90xVqd9e eO/T7aHFgJ6zt3Y58fwU2a2W5Q== X-Received: by 2002:a2e:9655:: with SMTP id z21-v6mr5577591ljh.136.1543392799723; Wed, 28 Nov 2018 00:13:19 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id h76sm1086248lfh.58.2018.11.28.00.13.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 00:13:19 -0800 (PST) From: Anders Roxell To: akpm@linux-foundation.org, dvyukov@google.com Cc: rostedt@goodmis.org, mingo@redhat.com, linux-kernel@vger.kernel.org, Anders Roxell , Arnd Bergmann Subject: [PATCH 1/2] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc as notrace Date: Wed, 28 Nov 2018 09:12:39 +0100 Message-Id: <20181128081239.18317-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since __sanitizer_cov_trace_pc is marked as notrace, function calls in __sanitizer_cov_trace_pc shouldn't be traced either. The function 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 the functions check_kcov_mode and canonicalize_ip that is callef from __sanitizer_cov_trace_pc also is marked as notrace. Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signen-off-by: Anders Roxell --- kernel/kcov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.2 Acked-by: Steven Rostedt (VMware) 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();