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: 10726935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19EBF13AF for ; Wed, 12 Dec 2018 18:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EB6D2B882 for ; Wed, 12 Dec 2018 18:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 011A62B88A; Wed, 12 Dec 2018 18:36:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A93B2B882 for ; Wed, 12 Dec 2018 18:36:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 983F18E0137; Wed, 12 Dec 2018 13:36:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 90AB58E00E5; Wed, 12 Dec 2018 13:36:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AC248E0137; Wed, 12 Dec 2018 13:36:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by kanga.kvack.org (Postfix) with ESMTP id 0A5038E00E5 for ; Wed, 12 Dec 2018 13:36:48 -0500 (EST) Received: by mail-lf1-f70.google.com with SMTP id g16so1984891lfb.22 for ; Wed, 12 Dec 2018 10:36:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:mime-version:content-transfer-encoding; bh=w4dZfQj97m6orxImud5MEJdclSGLyzwnb1g9Ebn+haA=; b=PZahYYwF5wW8ZgXjnQmnXWNmbImPPZ835WDyOeGkb1gzXom+K4pyrsMEurYEn9IQkp n4eZNeqRE9GDl+OFF7TTd94hxkJnCdP55Da3KuKexg4SCyPxI2S2FcOvjcE9eHg+d526 bWYw1UB3B6ItF/ZyCWnyTwZ6qn589zgssk7in7NCxwJsr5xAN0n0yIpeYRYCfKcmSdHu vSBqSrueIjq4HfcHTnjXa0Ncr5yIz8Uj9sHnH2ISQKDhseknVDmysfyAkKS6JBt4RFJq mznREGoBLY17EEFgRICnQhx7wYCIEVQksUSGqBBScg2a3+oKaiSDnAYY7nVVJZ6pnUR3 A+OA== X-Gm-Message-State: AA+aEWYt7aLvCRTSIEtm22EO6XYCxKDKQa7KmZ+w2aVx7jvbwMd4kXDX 4YJMr0z6ZPpRlnhpVKdLekqWMITP0TamcVH2sz5EI9A7j45Q3ScLklUT7stbVvYPKixjvJZpXRC zZGNq4/nc9Q8Fs85DMuBd5lBFYVvfa7bYNrUrdQCu+4JAZYXkwhSTvmc8GbL0h2Tq1cGCKvIAYz uPu4L8rCgxGaLr5K+MOI2stiU+ejS95/CO85xNZW8gWKRo2QBZRacGNq93yAecwP/CbD7TR/znK cAlY9MbDIzQJyZqZ5W+B/f4wsx60Pwr5EFXzdX29x4rAgLG8oQnvulgSKixwRo28C5A7RCBHhFJ SUHAapPzwDEL5zcXyV7K8+EWoZzCq6kDcroRYhhqJgjZV1/DvK9GhaTTPCQiw0rM5uRtJhF+Tuk r X-Received: by 2002:a2e:841:: with SMTP id g1-v6mr13960062ljd.21.1544639807248; Wed, 12 Dec 2018 10:36:47 -0800 (PST) X-Received: by 2002:a2e:841:: with SMTP id g1-v6mr13960030ljd.21.1544639806183; Wed, 12 Dec 2018 10:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544639806; cv=none; d=google.com; s=arc-20160816; b=SAI9OCzIcRIaqVhR5jg1TvPHkpbYXV3W7H7R0hYvWXmO8IJ99kgm7INnMLJlTHjAzs 2/yvTZ5pf9Q1VWW5CkjAmaE6eC0a9U04AYK5txG1yxoKcECUc2Nywl9ZjdwkxGbxKmnh mYcO5KCPeuhL162ST4Q0qyY+NMEQ5Kt/n4lYHePNKXCXbsksZoWHtbxYDu7opiUoC6o9 Ozf9ORkSn1ClKb1+6BAW5Jxoqk0mlffMp5+9EYi9Qv2F07qvJurSG8SmT2yb7k4oLUoT Er6AEXqSouyFFky8WGQz9BX49XcHcFIdX6zY74YV/7qlNWdHQeIYIQ+wmLBQqbUz0LDz OF8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=w4dZfQj97m6orxImud5MEJdclSGLyzwnb1g9Ebn+haA=; b=TUTMU69S57mGrlpd1lEBOal2OVe2RIvwMi+fru6Q1aozyiGCXUyVLm4oSNgHCy20Xp KzgX59+HmPJaNaXJw2QJZvTnX/5miBCEFJlKYs0nrAAhcZfxkDiuD6kTxx5gQcRI+ZLz E3F/pCFmFc9V/oquaQY6M4KTc2+HCqN/E/0Xyp/+hVPornBnsWTSeiIz/xBAYAu80fCF 7nQFaCQSQ+kdZZ2jgVXhVtCbhDYuoVTudtpO0YT9H+ut8lK8jB3vKsvJm4KT9sWfJPu7 VKjGUTKMvwfNMghtYGTC2Zx7RuHCbZ6eRnwzXwgsYqpjSHe1z1KHPZq0EebgWjI/rvYF Eh+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: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l20-v6sor11248149lji.21.2018.12.12.10.36.45 for (Google Transport Security); Wed, 12 Dec 2018 10:36:46 -0800 (PST) Received-SPF: pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bDOlfENP; spf=pass (google.com: domain of anders.roxell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=anders.roxell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-Smtp-Source: AFSGD/UERtjzgGHEKDpTMesz7cIhv6Ctej//vqi4XZC013pIvGU7O0i9hxMcasgR4upJVtFYkKj3Vg== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Dmitry Vyukov --- mm/kasan/Makefile | 1 + 1 file changed, 1 insertion(+) 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