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]
Message-ID: <4A228988.4060909@redhat.com>
Date:	Sun, 31 May 2009 09:43:36 -0400
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Christoph Hellwig <hch@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	lkml <linux-kernel@...r.kernel.org>, Avi Kivity <avi@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Jim Keniston <jkenisto@...ibm.com>,
	"K.Prasad" <prasad@...ux.vnet.ibm.com>,
	Przemys??awPawe??czyk <przemyslaw@...elczyk.it>,
	Vegard Nossum <vegard.nossum@...il.com>,
	"Frank Ch. Eigler" <fche@...hat.com>,
	Tom Zanussi <tzanussi@...il.com>,
	systemtap <systemtap@...rces.redhat.com>,
	kvm <kvm@...r.kernel.org>,
	DLE <dle-develop@...ts.sourceforge.net>
Subject: Re: [PATCH -tip v8 0/7] tracing: kprobe-based event tracer and x86
 instruction decoder

Christoph Hellwig wrote:
> Small question to start with: What's your (or Hitachi s/Red Hat's) use case
> for this?  It's obviously really cool technology, but I fear without
> some good user space side to make it easy to use it will most likely
> bit-rot which would be sad.

Good question,
Frankly to say, this was started just for the in-kernel user of kprobes.
However, now I think this can be used for some ideas,
- Quick debugging (checking variables, execution path, etc.) in asm level.
  (elfutils might help us to make it source level debugging)
- Prototyping new tracepoints.
- Stress test of kprobes to find functions which should be __kprobes.
- Vehicle of tracing facilities which will be ported from systemtap runtime.
- As Frank said, we can make systemtap to control this for simple scripts.

Even now, it's not hard to use systemtap for finding variables in
stack/registers. Key options are -v and -p2,

e.g.
$ stap -v -p2 -e 'probe kernel.statement("*@...open.c:1024")\
 {printf("%d", $files)}'

Then, you'll get below output,
------
# functions
_dwarf_tvar_get_files_0:long ()
%{{
  {
    uint64_t addr;
    { // DWARF expression: 0x5c
    { uint64_t value = fetch_register (12);addr = value; }
    }
    THIS->__retvalue = addr;
  }
  goto out;
if (0) goto deref_fault;
deref_fault:
  goto out;
}
/* pure */%}
# probes
kernel.statement("fd_install@...me/mhiramat/ksrc/linux-2.6-tip/fs/open.c:1024")
 /* pc=_stext+0xd1f72 */ /* <- kernel.statement("*@...open.c:1024") */
printf("%d", _dwarf_tvar_get_files_0())
------

This shows that 'fs/open.c:1024' is located at _stext+0xd1f72, and
'files' is mapped to %r12 (note, pt_regs mapping is different from
dwarf register mapping.) So, below command adds probe at
fs/open.c:1024 and trace 'files' variable :-)

$ echo p _stext+0xd1f72 %r12 > /debug/tracing/kprobe_events


Thank you,

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com

--
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