Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp974823imd; Thu, 1 Nov 2018 08:23:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5fVoDHmJXNlrCxPSk7V+EoDWy9uD+BNQvqo1GZxnx9ZQarD6kyvC+hEAJ0t6WlisQNscUmS X-Received: by 2002:a62:6041:: with SMTP id u62-v6mr8356677pfb.110.1541085790106; Thu, 01 Nov 2018 08:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541085790; cv=none; d=google.com; s=arc-20160816; b=WTR7eAc1bBylnQHumO859FsOOWpQS2Wt7wi/tgZR4AxE3LSUHGMmZF+BI61v8tIZ8b IOdXht4EfMwJBrqIQRunH6qfcVIi/30MWDJeJuWJyFJq+Y3xHaYvQSvGSQOflj0djBBy YXswwYXIvM80yLdL2L5eETGucC7wQnOqKhG1JkO7KuzcIKsIuRm6MM7JDZQsyMp45V5y +EDk3n+LR1Z/tGEYitttgMIhyadzVx0GlsbSoKgC2zhukwS5a4lau7QhfJCiB+/3tFTr LZtEBiXBn5AMxvhFu0Q3bDmhvA0r0MXyG4+xKOot0PtI8zrXuJSLjnPEWgZZSrPe/wLp 1qpg== 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 :dkim-signature; bh=SQ8EJfrFd0tkaeigkS/Vbw0+IM/yM2ZPRsvildvmA7Y=; b=x6kit//dNbQ58e+xooqNVcToznGa05woYwuO5rlvCAJvBPsFK9YXjnmQqNNKW3wuxJ r6lRcZbS6tD2m7iMyZfGwXE7bGhWgNDbPt1ewIRJEuE91s7A0V563f2QD8N5Vg8e3JIF Zo/9k6x8KpFVJuN1yFevevXYSVZvCd7ktNN2/weTO4kWoDnJgP+OsEuymHMnvwkNMKPr ZYic7PtJ0Sn81yny99u74I4uQmJ5ES0JvM4mcVwS88Wo2oTBI/miUs/iWbMstl9bC259 Du1xv1HwQhO6Xc3x/R0slnUf5/SrNgBiAgCIEpUG/RG44xpAaQtOdaxEvy5Y6aN2oY04 0kYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=168F7c7D; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si32055569pgn.313.2018.11.01.08.22.55; Thu, 01 Nov 2018 08:23:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=168F7c7D; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728542AbeKBAYI (ORCPT + 99 others); Thu, 1 Nov 2018 20:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:46130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728197AbeKBAYI (ORCPT ); Thu, 1 Nov 2018 20:24:08 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 3802E205F4; Thu, 1 Nov 2018 15:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541085644; bh=lNYBockCrAM/hLc1wichrNOE5bSTSWLbqDsp+qU2fkQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=168F7c7D2E4BEUKaecNYiSmrBXBbQ8j9PZ9IsGTwvJ8zWyYUHvaz0jBHhr7vmp0zM zhGmjdO2L2B4TtCx8sZUKtkJkL4MgJpo+GGHQv7UFnjTt4ZC5AXCCUclI+8iONfwWh F9am2EXOd+6BgWuaGB3y/1UainYQ3UgsjRiK1ESs= Date: Fri, 2 Nov 2018 00:20:39 +0900 From: Masami Hiramatsu To: Aleksa Sarai Cc: "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Steven Rostedt , 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 Subject: Re: [PATCH v3 1/2] kretprobe: produce sane stack traces Message-Id: <20181102002039.8f22c10fa47cae75fa709165@kernel.org> In-Reply-To: <20181101083551.3805-2-cyphar@cyphar.com> References: <20181101083551.3805-1-cyphar@cyphar.com> <20181101083551.3805-2-cyphar@cyphar.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-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 Hi Aleksa, On Thu, 1 Nov 2018 19:35:50 +1100 Aleksa Sarai wrote: [...] > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_stacktrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_stacktrace.tc Please split the test case as an independent patch. > new file mode 100644 > index 000000000000..03146c6a1a3c > --- /dev/null > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_stacktrace.tc > @@ -0,0 +1,25 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0+ > +# description: Kretprobe dynamic event with a stacktrace > + > +[ -f kprobe_events ] || exit_unsupported # this is configurable > + > +echo 0 > events/enable > +echo 1 > options/stacktrace > + > +echo 'r:teststackprobe sched_fork $retval' > kprobe_events > +grep teststackprobe kprobe_events > +test -d events/kprobes/teststackprobe Hmm, what happen if we have 2 or more kretprobes on same stack? It seems you just save stack in pre_handler, but that stack can already includes another kretprobe's trampline address... Thank you, > + > +clear_trace > +echo 1 > events/kprobes/teststackprobe/enable > +( echo "forked") > +echo 0 > events/kprobes/teststackprobe/enable > + > +# Make sure we don't see kretprobe_trampoline and we see _do_fork. > +! grep 'kretprobe' trace > +grep '_do_fork' trace > + > +echo '-:teststackprobe' >> kprobe_events > +clear_trace > +test -d events/kprobes/teststackprobe && exit_fail || exit_pass > -- > 2.19.1 > -- Masami Hiramatsu