Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1739788ybp; Wed, 9 Oct 2019 19:44:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkmDGaQv0S7uHN2BSRKWHKS2pe2vCCFOwJchB00AopFpK00d1ps72e2u+MnQoN2qR0Jjy6 X-Received: by 2002:a17:906:134a:: with SMTP id x10mr5922816ejb.204.1570675474671; Wed, 09 Oct 2019 19:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570675474; cv=none; d=google.com; s=arc-20160816; b=l0Hf064qAiwsNGGiah4VunuInQRd5GbTEVElt/Q4AMeueI/qr058G2IStdSBco5tC9 fnzA3eszbdgbFUkgGwmdUUE92Jz2h55Ziy7T4SoZZWKLBfCKJSH0FblOs5T/yzr7NWFd Y7w/Z/2GaPnf1oFSYYvFfJXu32Uue0gkU04ShAUSAmsPmTDXlvrNzthuxo4j+IuiQ1Zr cwfH3JCKN4r1EfMDY3NmPYFcs0X77T3706C9wuDh7W1AyJ6EBHXFM1+Op96LGpn0PlMb KqmrkJyosBKhGqnbmqaiXLBcrzsONm8kK8yN7c4indexgdxfh+MrvCSTSm2QReX7nKYO 8b+g== 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:subject:cc:to:from:date; bh=g3SYeBSvQpqzGD0RZ4gbi2tUz9gcamgr4DEPsAoiwBQ=; b=UdLe8vid14SCdsg+wljOYWtDHXWVHGAkZEmGU7vqAyUeWG1nyXy1F6WhylpJHze8iT XugGzoBebUeTHaXkr6E0vNiTbwkLm4myYwOT5rJoLiFWh6PL24ejx59H6pGqOEaOnbu4 NFZGHLiHL6LBb4a4JTJOYsv/+x4JlUVEb7nITWXyCyz0dZ0ZICnIulsbCzT8/Og68KY5 tmxZDa7edr2uf8obfxyhUMv/nnDKKKaDhVTpE+j3050amFoe8AFdXwzxnZWx4eTgMyYh lOpQO+IbzdFBpCKK7Oxnw3zR8Sm4cL8RApqJCyHYWOA+7M1RmO225DwfOtJQQYRUeLYr z+gg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z55si2630013edb.41.2019.10.09.19.44.11; Wed, 09 Oct 2019 19:44:34 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732655AbfJJClj (ORCPT + 99 others); Wed, 9 Oct 2019 22:41:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbfJJClj (ORCPT ); Wed, 9 Oct 2019 22:41:39 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8EB12086D; Thu, 10 Oct 2019 02:41:36 +0000 (UTC) Date: Wed, 9 Oct 2019 22:41:35 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com Subject: Re: [PATCH v3 5/6] x86/ftrace: Use text_poke() Message-ID: <20191009224135.2dcf7767@oasis.local.home> In-Reply-To: <20191008104335.6fcd78c9@gandalf.local.home> References: <20191007081716.07616230.8@infradead.org> <20191007081945.10951536.8@infradead.org> <20191008104335.6fcd78c9@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Oct 2019 10:43:35 -0400 Steven Rostedt wrote: > BTW, I'd really like to take this patch series through my tree. That > way I can really hammer it, as well as I have code that will be built > on top of it. I did a bit of hammering and found two bugs. One I sent a patch to fix (adding a module when tracing is enabled), but the other bug I triggered, I'm too tired to debug right now. But figured I'd mention it anyway. If you add on the kernel command line: ftrace=function ftrace_filter=schedule You will get this (note, I had KASAN enabled, so it showed more info): [ 1.274356] ftrace: allocating 34274 entries in 134 pages [ 1.320059] Starting tracer 'function' [ 1.323724] ================================================================== [ 1.330798] BUG: KASAN: null-ptr-deref in __get_locked_pte+0x21/0x210 [ 1.337186] Read of size 8 at addr 0000000000000050 by task swapper/0 [ 1.343579] [ 1.345049] CPU: 0 PID: 0 Comm: swapper Not tainted 5.4.0-rc2-test+ #50 [ 1.351613] Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016 [ 1.360510] Call Trace: [ 1.362932] dump_stack+0x7c/0xc0 [ 1.366213] ? __get_locked_pte+0x21/0x210 [ 1.370272] ? __get_locked_pte+0x21/0x210 [ 1.374331] __kasan_report.cold.10+0x5/0x3e [ 1.378566] ? __get_locked_pte+0x21/0x210 [ 1.382625] kasan_report+0xe/0x20 [ 1.385993] __get_locked_pte+0x21/0x210 [ 1.389880] ? 0xffffffffa000005c [ 1.393162] __text_poke+0x1ca/0x5b0 [ 1.396705] ? optimize_nops.isra.8+0xd0/0xd0 [ 1.401023] ? insn_get_length+0x4f/0x70 [ 1.404910] ? text_poke_loc_init+0x186/0x220 [ 1.409229] ? text_poke_kgdb+0x10/0x10 [ 1.413031] ? 0xffffffffa0000000 [ 1.416312] text_poke_bp_batch+0xb4/0x1e0 [ 1.420372] ? __text_poke+0x5b0/0x5b0 [ 1.424088] ? do_raw_spin_lock+0x113/0x1d0 [ 1.428233] ? 0xffffffffa000005c [ 1.431515] ? 0xffffffffa0000000 [ 1.434797] text_poke_bp+0x7a/0xa0 [ 1.438253] ? text_poke_queue+0xb0/0xb0 [ 1.442139] ? 0xffffffffa0000000 [ 1.445421] ? 0xffffffffa000005c [ 1.448706] ? find_vmap_area+0x56/0x80 [ 1.452505] arch_ftrace_update_trampoline+0x114/0x380 [ 1.457603] ? ftrace_caller+0x4e/0x4e [ 1.461316] ? 0xffffffffa0000091 [ 1.464599] ? arch_ftrace_update_code+0x10/0x10 [ 1.469179] ? mutex_lock+0x86/0xd0 [ 1.472634] ? __mutex_lock_slowpath+0x10/0x10 [ 1.477039] ? mutex_unlock+0x1d/0x40 [ 1.480668] ? arch_jump_label_transform_queue+0x7a/0x90 [ 1.485937] ? __jump_label_update+0x91/0x140 [ 1.490256] ? mutex_unlock+0x1d/0x40 [ 1.493885] ? tracing_start_sched_switch.cold.0+0x60/0x60 [ 1.499327] __register_ftrace_function+0xaf/0xf0 [ 1.503991] ftrace_startup+0x24/0x130 [ 1.507706] register_ftrace_function+0x2d/0x80 [ 1.512198] function_trace_init+0xc1/0x100 [ 1.516346] tracing_set_tracer+0x1fb/0x3c0 [ 1.520492] ? free_snapshot+0x50/0x50 [ 1.524205] ? __kasan_kmalloc.constprop.6+0xc1/0xd0 [ 1.529131] ? __list_add_valid+0x29/0xa0 [ 1.533106] register_tracer+0x235/0x26c [ 1.536993] early_trace_init+0x29b/0x3a0 [ 1.540967] start_kernel+0x2a3/0x5f7 [ 1.544595] ? mem_encrypt_init+0x6/0x6 [ 1.548396] ? load_ucode_intel_bsp+0x5e/0xa3 [ 1.552715] ? init_intel_microcode+0xc3/0xc3 [ 1.557036] ? load_ucode_bsp+0xcc/0x154 [ 1.560923] secondary_startup_64+0xa4/0xb0 [ 1.565070] ================================================================== -- Steve