Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1513413imd; Sun, 4 Nov 2018 04:30:43 -0800 (PST) X-Google-Smtp-Source: AJdET5e8dMrr6rbtTZ5hC7qn7WGBXBM52zpmE0ECtMfUEMcAhJ70ADY8u6+yInNS4oVhDLTX5YRu X-Received: by 2002:a17:902:8c84:: with SMTP id t4-v6mr18687428plo.188.1541334642933; Sun, 04 Nov 2018 04:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541334642; cv=none; d=google.com; s=arc-20160816; b=WekW321TaHeDH5oYsfnKtHxFp9Ky+RPdt+PNPD/OH2KGocj8nwWmTDEuqdUoqKGUTo OfacSWTwO8b9DY5v53wlRhCLgiFkt6sqBrbP1T43aIkXieg69YhPvDRdt+babBAM5uYX W6WWseFjwJTjG/YBgn9inutFjVt/pNhHEOtQqVE57CZLA33uPyEUUqbWwRHAa0ifowFw agBm5EnCw3HUXGXQaV8H+xQx7bkgKRspXKSIx5nbpQ/teQWKPbmXd0mnf3HXG//PcqlB CgIQ5sQydAJhV5+SFf0c1mt4dPMH+Ocui/P/E2wxgbNnYOkxAxxZ2K+8ytjJZcs3NiaX s1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mOmUC8/QL9SPe0bfXXb2flikTrLSnFuHCt0gLgLNwPw=; b=U5MVZ2rBKwVVAMbPIdvh/g4JlONdFutkzZoN6BXRsTAnMas+etY+M+h4bb2qiuV2C0 tcPnfGpjrIM0nDP0AaNSFdx52NNxc7WibPb1ECJehMpR0ZArR9FCy/TkP7C+cmLXqxCP 8agiVLyFmQyeMFKFl4X1Oo8XeByJLqqj4v4+4Vu5MX6BqeVBJhBXDg+A6STBylJGe3/9 ZIVq0vkro/hyY12k8e6V+AYDBI4Pe4sBiqc/ib97HAPbaKP0ylMaB5A78e0rkiDw0cLf YA/IIaa8+khpmg2CwW2Q8vZBKAdQLeGnt7gO2nQFw75KUiqQZEYcwCXddbGS8HiX2FnO 4cWw== 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 o127-v6si48682295pfb.128.2018.11.04.04.30.12; Sun, 04 Nov 2018 04:30:42 -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; 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 S1729495AbeKDVOR (ORCPT + 99 others); Sun, 4 Nov 2018 16:14:17 -0500 Received: from mx1.mailbox.org ([80.241.60.212]:20968 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729293AbeKDVOR (ORCPT ); Sun, 4 Nov 2018 16:14:17 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id D930B40555; Sun, 4 Nov 2018 12:59:29 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id NdV5wkatz1zb; Sun, 4 Nov 2018 12:59:28 +0100 (CET) Date: Sun, 4 Nov 2018 22:59:13 +1100 From: Aleksa Sarai To: Steven Rostedt Cc: "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Masami Hiramatsu , Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Brendan Gregg , Christian Brauner , Aleksa Sarai , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Josh Poimboeuf Subject: Re: [PATCH v3 1/2] kretprobe: produce sane stack traces Message-ID: <20181104115913.74l4yzecisvtt2j5@yavin> References: <20181101083551.3805-1-cyphar@cyphar.com> <20181101083551.3805-2-cyphar@cyphar.com> <20181101204720.6ed3fe37@vmware.local.home> <20181102050509.tw3dhvj5urudvtjl@yavin> <20181102065932.bdt4pubbrkvql4mp@yavin> <20181102091658.1bc979a4@gandalf.local.home> <20181103070253.ajrqzs5xu2vf5stu@yavin> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2yaciluwfpe2adhl" Content-Disposition: inline In-Reply-To: <20181103070253.ajrqzs5xu2vf5stu@yavin> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --2yaciluwfpe2adhl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-11-03, Aleksa Sarai wrote: > This is actually a general bug in ftrace as well, because (for > instance) while the unwinder calls into ftrace_graph_ret_addr() while > walking up the stack this isn't used to correct regs->ip in > perf_callchain_kernel(). I think this is the cause of the bug in > ftrace-graph (if you switch to the "frame" unwinder you might be able > to see it more clearly) -- but when trying to fix it I'm having > trouble figuring out what retp should be (stack_addr(regs) doesn't > give the right result for some reason). @Steven, @Masami: Can you verify whether this is an actual bug? The snippet is like (arch/x86/events/core.c): void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_r= egs *regs) { /* ... */ if (perf_callchain_store(entry, regs->ip)) return; /* rest of unwind code */ } And it seems to me that there's an ftrace_graph_ret_addr missing here (though I was having trouble figuring out what the right retp would be in this context -- both stack_addr(regs) and ®s->sp appear to be wrong when I was trying to get this to work with kretprobes -- while my patch worked with all other kretprobe_trampoline cases in the unwinder). The same issue is present in __save_stack_trace (arch/x86/kernel/stacktrace.c). This is likely the only reason that -- as Steven said -- stacktraces wouldn't work with ftrace-graph (and thus with the refactor both of you are discussing). Thanks. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --2yaciluwfpe2adhl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEb6Gz4/mhjNy+aiz1Snvnv3Dem58FAlve3w4ACgkQSnvnv3De m58I4g/8CFItPEhmf9/ruSZ+czcVr2kRsDAJsGofWkgUuGd3HTou7U2/r0xvZeDF 1XgpwSWDxwkTrEumRZOQDaCjLwIrXqOBi8l12pEiTPC7V4hkxkzeUZpoh5UzgO7O Tr9T/aW/5Tdqu93PJgX0ky2ECc6n4SJB8F2GDBZkVrRQoemFf3ulWWYWvUnrNk8y 8vxNrx4WoGYle32T9kTPwgQhReB86vyMSUZW3SjT1mLkIkqIf01hWHRefX8E66Ot DFQB7OG6ep4mQsbKuekWJ0DtCUY4u7T98EmhtFq6bQ53L5BmTmKSiiE0z6HF+iJB N1sGnkVyHIRNgjGxbchR8uxdJCpLg+MWM9rxpkMc4JWtQkTSoCRHXKnHMfYWOhN5 N4+xijxq4lCfJwXShKJNeFFOwM66rwls3KVEzUKcojn5H+UXxmR84SyWrhFHYnB0 5FSmJzvQcypLyuJuinxOt0EBXbQ6uDW5pgsFfWRcbfEu72VSXOZi+1AaAaYlBv3C zV//7hYQhzwd0FZoBinr2ukKqmQcy1w+2oUVeHckWU3NsXS0V02pSqna85Hzv6ce m82UwtpLUPcRtH53M7nmdwy4nOcAyPuuxGsscMfi0p+Fwc2i6R10Npr2wZ7/3zi8 Hbkss2B5r+YHW2YMiQGSUnfnB93LjnafPasol5iLWJFldcSdvl4= =AUFA -----END PGP SIGNATURE----- --2yaciluwfpe2adhl--