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:	Mon, 3 Aug 2015 16:49:17 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	pi3orama <pi3orama@....com>
Cc:	"Wangnan (F)" <wangnan0@...wei.com>, He Kuang <hekuang@...wei.com>,
	Li Zefan <lizefan@...wei.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Xia Kaixu <xiakaixu@...wei.com>, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	David Ahern <dsahern@...il.com>,
	Namhyung Kim <namhyung@...nel.org>
Subject: Re: perf eBPF patch ordering.  was: Re: perf test LLVM was: Re: [GIT
 PULL 00/39] perf tools: filtering events using eBPF programs

Em Mon, Aug 03, 2015 at 01:11:16PM -0300, Arnaldo Carvalho de Melo escreveu:
> > >  ERROR:    unable to compile ./foo.c
> > >  Hint:    Check error message shown above.
> > >         LLVM 3.7 or newer is required. Which can be found from http://llvm.org
> > >         You may want to try git trunk:
> > >             git clone http://llvm.org/git/llvm.git
> > >                  and
<SNIP>
> > >      or: perf record [<options>] -- <command> [<options>]

> > >      -e, --event <event>   event selector. use 'perf list' to list available events
> > >  [root@...icio ~]#

> > > Now to find a hello.c BPF scriptlet...

So, we do not need to provide all this LLVM environment installation
hints when we get to any error, i.e. the one above was just becasuse
"./foo.c" doesn't exist, clang ran successfully, so no need for telling
the user how to install it.

The following error also shouldn't emit those hints:

  [root@...icio ~]# perf record -e ./lock_page.bpf.c sleep 1
  /root/./lock_page.bpf.c:1:5: error: expected parameter declarator
  SEC("lock_page=__lock_page page->flags")
      ^
  /root/./lock_page.bpf.c:1:5: error: expected ')'
  /root/./lock_page.bpf.c:1:4: note: to match this '('
  SEC("lock_page=__lock_page page->flags")
     ^
  /root/./lock_page.bpf.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  SEC("lock_page=__lock_page page->flags")
  ^
  /root/./lock_page.bpf.c:1:41: error: expected ';' after top level declarator
  SEC("lock_page=__lock_page page->flags")
                                          ^
                                          ;
  /root/./lock_page.bpf.c:2:22: warning: declaration of 'struct pt_regs' will not be visible outside of this function [-Wvisibility]
  int lock_page(struct pt_regs *ctx, int err, unsigned long flags)
                     ^
  2 warnings and 3 errors generated.
  ERROR:	unable to compile ./lock_page.bpf.c
  Hint:	Check error message shown above.
     	LLVM 3.7 or newer is required. Which can be found from http://llvm.org
     	You may want to try git trunk:
     		git clone http://llvm.org/git/llvm.git
     		     and
     		git clone http://llvm.org/git/clang.git

     	Or fetch the latest clang/llvm 3.7 from pre-built llvm packages for
     	debian/ubuntu:
     		http://llvm.org/apt

     	If you are using old version of clang, change 'clang-bpf-cmd-template'
     	option in [llvm] section of ~/.perfconfig to:

     	  "$CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS \
     	     -working-directory $WORKING_DIR -c $CLANG_SOURCE \
     	     -emit-llvm -o - | /path/to/llc -march=bpf -filetype=obj -o -"
     	(Replace /path/to/llc with path to your llc)

  Hint:	You can also pre-compile it into .o
  invalid or unsupported event: './lock_page.bpf.c'
  Run 'perf list' for a list of valid events

   usage: perf record [<options>] [<command>]
      or: perf record [<options>] -- <command> [<options>]

      -e, --event <event>   event selector. use 'perf list' to list available events
  [root@...icio ~]# 

And I am interested in that "Hint: You can also pre-compile it into .o", seems
like a useful one, if it  was on the screen, i.e. how can I pre-compile this
into a .o, its some random piece of eBPF "scriptlet" I found in one of your
csets, after this cset in your patchkit:

  [root@...icio ~]# cat lock_page.bpf.c 
  SEC("lock_page=__lock_page page->flags")
  int lock_page(struct pt_regs *ctx, int err, unsigned long flags)
  {
  	return 1;
  }
  [root@...icio ~]#

Also it would be nice to tell the user, when compilation fails, where to look
for a eBPF scriptlet primer, i.e. where can I find some documentation on how
to write such scriptlets?

At this point I expect it to build the .c into a .o, then, as the wiring up is
not there, tell the user that all went well, but more infrastructure is needed,
apply the following patches from Wang Nan! 8-)

- 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