From patchwork Wed Dec 12 18:34:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 153589 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2133211ljp; Wed, 12 Dec 2018 10:36:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/VqVmiVj2S7dcKUWSyttUJ6WRHHBTHUQsCsF6xYQCM3w7ZIEqCKFmjzwJbfF18JMVRw20sZ X-Received: by 2002:a62:9419:: with SMTP id m25mr22217183pfe.147.1544639810540; Wed, 12 Dec 2018 10:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544639810; cv=none; d=google.com; s=arc-20160816; b=mDMIBNp8oUtuk1p0A/ye1+6xaiM7e7rj35oGKM93Ihqps3/1X9tKhxdfHSx9Bxu+38 6AUa5bjlIoN/0bt/R5z1Kl1X8hiqagcExlYdaTMMzgN/Kmor4Q/FsZRCl1JA5at5Ewhd WDwFTCJ6SC3jsr8LOUSqNdrfqGNf/Jbb1+JCLHLqDN7WCQ9Y3tIF7BD/Pwr1dLZ1iSfm +jSKwf0jwKMMqoGa3zl1IuCQBjM/RV5Ab2ZySI+gIIhZe00FXXL/VpIK7upUWa5HcQvC OqZ8rhp8KagKM7yqRbKmQDeeI7DAXouY7Am/i0rV0XTgN+6kEXJrPkcMY2lZp+dGyz4s zUYw== 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=w4dZfQj97m6orxImud5MEJdclSGLyzwnb1g9Ebn+haA=; b=flQZXGTR8WwX7JVVkJpuebidxfj1AHdKJhjh0Puq6S8cqcuMLq2nRKJVIElXzmHSUl ygInIFpXpQYojFHQ0F/DdFxWILJj3x+vVDUJix7nluY/xiUgYY0+Inx3+VxIrHfBM4A6 PZm1Hi24D4AXnOimPNdU2LxLUY23Nu9bysuBUB1RIUxCg19O+VNw1T4PGWRnTlP4/p6c 3ZsY1OLDydWtN6UWPZeAvCT8fBWKUg7hKPCg/3Bcuevp8b0UCuyH476khxGCWQeDgiP1 2FOspBZa5GXy2y1wNYoZFHhpfV5PE6Z9p44i6jCBpsXJH+Zohu/XsYQO+/EjQ+EQRH/p HR/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bDOlfENP; 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 x191si16094483pfd.220.2018.12.12.10.36.50; Wed, 12 Dec 2018 10:36:50 -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=bDOlfENP; 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 S1728270AbeLLSgs (ORCPT + 31 others); Wed, 12 Dec 2018 13:36:48 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35467 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727888AbeLLSgr (ORCPT ); Wed, 12 Dec 2018 13:36:47 -0500 Received: by mail-lj1-f196.google.com with SMTP id x85-v6so17211345ljb.2 for ; Wed, 12 Dec 2018 10:36:46 -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=w4dZfQj97m6orxImud5MEJdclSGLyzwnb1g9Ebn+haA=; b=bDOlfENPPw/TLc4DlZr3C10SP5/ex7BM1Al+74hV7+AuPzIqcxmJqS3P5weqws+sjM JOU0gTvS3z3hjAOkCd33s3ywj6z/K3DJ52Bv0+QGVdIR0iTCMQGGuiYlM2U9pBsjTeP4 R00Blc9T5Xbkc4kfgbl0Pwe+UUdw1ykrXei14= 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=w4dZfQj97m6orxImud5MEJdclSGLyzwnb1g9Ebn+haA=; b=sElkt6ew9ba2z8e2fg/Z733UhC87kR6hZQV7INnnH9Qe8a5sWLkCJWfCcdz9x1Vdjx iB35Vi00wzAwdO5K3fqssi+hKeDis48YUQfkjJY8QDvW8K9sEQXwU0M3I4rwZOLhsbbz dP+OLktkJZjrQY8Ku6UzanqRALBUJePllkXiW5X93CiVK+/LQyEa+Dof8lE0uF7t3Tva vunAXkoZkg/LW9SCHB/ZSDfpAq9qZuLlq/UEDzO2G9iqTfh2w90bMarx3oLCjTkJniFO RSPdHCzg5rNWOlK9vzJndNipfCMbeTD68U2RYhcT1bQP45tL8pLIxr0L+RvXRAKGO47p s4Ew== X-Gm-Message-State: AA+aEWaoktFkzSB4pX2WH7Tb0E9FrW63RoY67r5fwqlxz34tvE9WBpS+ ag9ovHjP6M/biDwwjC/NVAAj8w== X-Received: by 2002:a2e:9f56:: with SMTP id v22-v6mr12650009ljk.114.1544639805366; Wed, 12 Dec 2018 10:36:45 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id e13-v6sm3365322ljk.53.2018.12.12.10.36.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 10:36:44 -0800 (PST) From: Anders Roxell To: aryabinin@virtuozzo.com, dvyukov@google.com Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, Anders Roxell Subject: [PATCH v2] kasan: mark file common so ftrace doesn't trace it Date: Wed, 12 Dec 2018 19:34:47 +0100 Message-Id: <20181212183447.15890-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 When option CONFIG_KASAN is enabled toghether with ftrace, function ftrace_graph_caller() gets in to a recursion, via functions kasan_check_read() and kasan_check_write(). Breakpoint 2, ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:179 179 mcount_get_pc x0 // function's pc (gdb) bt #0 ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:179 #1 0xffffff90101406c8 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:151 #2 0xffffff90106fd084 in kasan_check_write (p=0xffffffc06c170878, size=4) at ../mm/kasan/common.c:105 #3 0xffffff90104a2464 in atomic_add_return (v=, i=) at ./include/generated/atomic-instrumented.h:71 #4 atomic_inc_return (v=) at ./include/generated/atomic-fallback.h:284 #5 trace_graph_entry (trace=0xffffffc03f5ff380) at ../kernel/trace/trace_functions_graph.c:441 #6 0xffffff9010481774 in trace_graph_entry_watchdog (trace=) at ../kernel/trace/trace_selftest.c:741 #7 0xffffff90104a185c in function_graph_enter (ret=, func=, frame_pointer=18446743799894897728, retp=) at ../kernel/trace/trace_functions_graph.c:196 #8 0xffffff9010140628 in prepare_ftrace_return (self_addr=18446743592948977792, parent=0xffffffc03f5ff418, frame_pointer=18446743799894897728) at ../arch/arm64/kernel/ftrace.c:231 #9 0xffffff90101406f4 in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:182 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) Rework so that the kasan implementation isn't traced. Signed-off-by: Anders Roxell --- mm/kasan/Makefile | 1 + 1 file changed, 1 insertion(+) -- 2.19.2 Acked-by: Dmitry Vyukov diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile index 0a14fcff70ed..e2bb06c1b45e 100644 --- a/mm/kasan/Makefile +++ b/mm/kasan/Makefile @@ -5,6 +5,7 @@ UBSAN_SANITIZE_generic.o := n UBSAN_SANITIZE_tags.o := n KCOV_INSTRUMENT := n +CFLAGS_REMOVE_common.o = -pg CFLAGS_REMOVE_generic.o = -pg # Function splitter causes unnecessary splits in __asan_load1/__asan_store1 # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533