lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Nov 2015 10:16:00 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	"Wangnan (F)" <wangnan0@...wei.com>
Cc:	masami.hiramatsu.pt@...achi.com, ast@...nel.org,
	lizefan@...wei.com, pi3orama@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/13] perf tools: Use same BPF program if arguments are
 identical

Em Tue, Nov 17, 2015 at 11:05:41AM +0800, Wangnan (F) escreveu:
> 
> 
> On 2015/11/16 20:10, Wang Nan wrote:
> >This patch allows creating only one BPF program for different
> >'probe_trace_event'(tev) generated by one 'perf_probe_event'(pev), if
> >their prologues are identical.
> >
> >This is done by comparing argument list of different tev, and maps type
> >of prologue and tev using a mapping array. This patch utilizes qsort to
> >sort tevs. After sorting, tevs with identical argument list will be
> >grouped together.
> >
> >Test result:
> >
> >Sample BPF program:
> >
> >  SEC("inlines=no\n"
> >      "func=SyS_dup? oldfd")
> >  int func(void *ctx)
> >  {
> >      return 1;
> >  }
> >
> >It would probe at SyS_dup2 and SyS_dup3, extracts oldfd as its argument.
> >
> >Following cmdline shows BPF program loaded into kernel by perf:
> >
> >  # ./perf record  -e  ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog
> >
> >Before this patch:
> >
> >  # ./perf record  -e  ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog
> >  [1] 24858
> >  lrwx------ 1 root root 64 Nov 14 04:09 3 -> anon_inode:bpf-prog
> >  lrwx------ 1 root root 64 Nov 14 04:09 4 -> anon_inode:bpf-prog
> >  ...
> >
> >After this patch:
> >
> >  # ./perf record  -e  ./test_bpf_arg.c sleep 4 & sleep 1 && ls /proc/$!/fd/ -l | grep bpf-prog
> >  [1] 25699
> >  lrwx------ 1 root root 64 Nov 14 04:10 3 -> anon_inode:bpf-prog
> >  ...
> >
> >Signed-off-by: Wang Nan <wangnan0@...wei.com>
> >Cc: Alexei Starovoitov <ast@...nel.org>
> >Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> >Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
> >Cc: Zefan Li <lizefan@...wei.com>
> >Cc: pi3orama@....com
> >---
> 
> [SNIP]
> 
> >@@ -462,7 +570,19 @@ static int hook_load_preprocessor(struct bpf_program *prog)
> >  		return -ENOMEM;
> >  	}
> >-	err = bpf_program__set_prep(prog, pev->ntevs,
> >+	priv->type_mapping = malloc(sizeof(int) * pev->ntevs);
> >+	if (!priv->type_mapping) {
> >+		pr_debug("No enough memory: alloc type_mapping failed\n");
> >+		return -ENOMEM;
> >+	}
> >+	memset(priv->type_mapping, 0xff,
> >+	       sizeof(int) * pev->ntevs);
> >+
> 
> We can change 0xff to -1 like previous patches. Will do it by resending.

Thanks for doing that, 

Applied the new version of this patch,

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ