From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: Re: [PATCH bpf-next v2 7/9] samples/bpf: add a test for bpf_get_stack helper Date: Thu, 19 Apr 2018 16:42:02 -0700 Message-ID: <064d7362-6c04-7f60-30e6-1e7dff0cf0fb@fb.com> References: <20180418165444.2263237-1-yhs@fb.com> <20180418165444.2263237-8-yhs@fb.com> <20180419043745.a23qak7peaurmiqg@ast-mbp> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , To: Alexei Starovoitov Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:39952 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753636AbeDSXmc (ORCPT ); Thu, 19 Apr 2018 19:42:32 -0400 In-Reply-To: <20180419043745.a23qak7peaurmiqg@ast-mbp> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 4/18/18 9:37 PM, Alexei Starovoitov wrote: > On Wed, Apr 18, 2018 at 09:54:42AM -0700, Yonghong Song wrote: >> The test attached a kprobe program to kernel function sys_write. >> It tested to get stack for user space, kernel space and user >> space with build_id request. It also tested to get user >> and kernel stack into the same buffer with back-to-back >> bpf_get_stack helper calls. >> >> Whenever the kernel stack is available, the user space >> application will check to ensure that sys_write/SyS_write >> is part of the stack. >> >> Signed-off-by: Yonghong Song >> --- >> samples/bpf/Makefile | 4 + >> samples/bpf/trace_get_stack_kern.c | 86 +++++++++++++++++++++ >> samples/bpf/trace_get_stack_user.c | 150 +++++++++++++++++++++++++++++++++++++ >> 3 files changed, 240 insertions(+) > > since perf_read is being refactored out of trace_output_user.c in the previous patch > please move it to selftests (instead of bpf_load.c) and move > this whole test to selftests as well. I put it here since I am attaching to a kprobe so that I can compare address. I guess I can still do it by attaching to a kernel tracepoint. Will move the tests to selftests as suggested.