Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 939DBC433F5 for ; Fri, 29 Oct 2021 11:22:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B59161167 for ; Fri, 29 Oct 2021 11:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B59161167 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XJcuBEMu6HGxjtLg9gIKP4BwzGSLkHHt8KHbdWtKDIU=; b=yUihBnTbVsRzYp EZzWxXs9oXRxB0bamFES/ivorMuj7r82O6932IexjDKTCRRm1F5qcp2JdzUUo8EiuIl/AOeNEN69s LeYea1K8tkPgtc4luYGOD7km4mcTZEUdIzsHFfWzjCdD0l7EAZyJRoWP5BTHn97C2ONi4H4HNo1Zz q/SdAwZ7KL8AqiKJTpvbjOmgQRqMJ0jfwa9shSAt2hXcyRvqaxxYI7LNGEE+fAqj3gUFq6GIlOFaI 1IXNjsccM2ysLFjdaV6UKEnpp+tpx2XBLRqmbBihzY84BV+BlDGu7Gdj5nm6KjiibKeGKuNHNyYN1 VJWVuvQxzxYmTTTGAzog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgPwD-00Ajh8-74; Fri, 29 Oct 2021 11:20:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgPw9-00AjgB-0I for linux-arm-kernel@lists.infradead.org; Fri, 29 Oct 2021 11:20:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47F251FB; Fri, 29 Oct 2021 04:20:37 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 437B73F5A1; Fri, 29 Oct 2021 04:20:36 -0700 (PDT) Date: Fri, 29 Oct 2021 12:20:34 +0100 From: Mark Rutland To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org, catalin.marinas@arm.com, madvenka@linux.microsoft.com, rostedt@goodmis.org Subject: Re: [PATCH] arm64: ftrace: use HAVE_FUNCTION_GRAPH_RET_ADDR_PTR Message-ID: <20211029112032.GC24060@lakrids.cambridge.arm.com> References: <20211027132529.30027-1-mark.rutland@arm.com> <20211028085225.GA23581@willie-the-truck> <20211028134539.GA48435@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211028134539.GA48435@lakrids.cambridge.arm.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_042041_165542_3C689975 X-CRM114-Status: GOOD ( 19.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 28, 2021 at 02:45:42PM +0100, Mark Rutland wrote: > I had a go with the selftests and there are some latent issues which show up on > a pristine v5.15-rc4 (or v5.15-rc7), using defconfig + the ftrace selftest > config fragment, including an OOM that could be a memory leak. > > I see the following warning: > > | [15] Generic dynamic event - check if duplicate events are caught > | ------------[ cut here ]------------ > | WARNING: CPU: 24 PID: 912 at kernel/trace/trace_eprobe.c:853 __trace_eprobe_create+0x3ec/0x71c > | Modules linked in: > | CPU: 24 PID: 912 Comm: ftracetest Not tainted 5.15.0-rc4 #1 > | Hardware name: linux,dummy-virt (DT) > | pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > | pc : __trace_eprobe_create+0x3ec/0x71c > | lr : __trace_eprobe_create+0x3ec/0x71c > | sp : ffff80001370bb60 > | x29: ffff80001370bb60 x28: ffff5ee1944cc299 x27: ffff80001370bc28 > | x26: 00000000000001c8 x25: ffffa8db50eece78 x24: 0000000000000010 > | x23: ffffa8db50eece48 x22: 00000000ffffffed x21: 0000000000000003 > | x20: ffff5ee1944cc008 x19: ffffa8db4fd2e398 x18: 0000000000000000 > | x17: 7473753a29656d61 x16: 6e656c6966242830 x15: 2b3d656c69662074 > | x14: 616e65706f5f7265 x13: 676e69727473753a x12: 29656d616e656c69 > | x11: 0000000000000003 x10: 0101010101010101 x9 : ffffa8db4edda690 > | x8 : 7f7f7f7f7f7f7f7f x7 : 726b6b6062727872 x6 : 1a171a17020d001f > | x5 : 1f000d02171a171a x4 : ffff5ee18d2b3900 x3 : ffffa8db50eece48 > | x2 : 0000000000000000 x1 : ffff5ee18d2b3900 x0 : ffff5ee18d2b3900 > | Call trace: > | __trace_eprobe_create+0x3ec/0x71c > | trace_probe_create+0x90/0xb0 > | eprobe_dyn_event_create+0x1c/0x30 > | create_dyn_event+0x74/0x114 > | trace_parse_run_command+0x104/0x7d0 > | dyn_event_write+0x1c/0x30 > | vfs_write+0xfc/0x290 > | ksys_write+0x74/0x100 > | __arm64_sys_write+0x28/0x3c > | invoke_syscall+0x50/0x120 > | el0_svc_common.constprop.0+0x104/0x124 > | do_el0_svc+0x34/0x9c > | el0_svc+0x2c/0x90 > | el0t_64_sync_handler+0xa8/0x12c > | el0t_64_sync+0x1a0/0x1a4 > | ---[ end trace 24f9a9e45b173e0b ]--- > | [FAIL] > > That seems to be the following in __trace_eprobe_create(): > > | mutex_lock(&event_mutex); > | event_call = find_and_get_event(sys_name, sys_event); > | ep = alloc_event_probe(group, event, event_call, argc - 2); > | mutex_unlock(&event_mutex); > | > | if (IS_ERR(ep)) { > | ret = PTR_ERR(ep); > | /* This must return -ENOMEM, else there is a bug */ > | WARN_ON_ONCE(ret != -ENOMEM); > | ep = NULL; > | goto error; > | } > > ... but I haven't yet dug into exactly why that's returning an > unexpected error code. It turns out this is a latent bug when the user requests a bogus event, find_and_get_event() fails and returns NULL, causing alloc_event_probe() to return -ENODEV. The right thing to do there is to check the result of find_and_get_event(); I have a local patch for that. The reason that was bogus at all was that I didn't have CONFIG_FTRACE_SYSCALLS selected and so `syscalls:sys_enter_openat` didn't exist. I didn't have that selected because it wasn't in the Kconfig fragment for the ftrace selftests; I have a local patch for that. I'm still working through the other bits. If I sovle that shortly I'll send that as a series with the two patches above, otherwise I'll send those out on their own. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel