Commit 3a3b0f98 authored by Brenden Blanco's avatar Brenden Blanco Committed by GitHub

Merge pull request #916 from pchaigno/use-pid-to-resolve-lib

Use PID to resolve path of target libraries
parents 6a94f777 d73c58f0
...@@ -201,9 +201,10 @@ if not library: ...@@ -201,9 +201,10 @@ if not library:
b.attach_kretprobe(event_re=pattern, fn_name="trace_func_return") b.attach_kretprobe(event_re=pattern, fn_name="trace_func_return")
matched = b.num_open_kprobes() matched = b.num_open_kprobes()
else: else:
b.attach_uprobe(name=library, sym_re=pattern, fn_name="trace_func_entry") b.attach_uprobe(name=library, sym_re=pattern, fn_name="trace_func_entry",
pid=args.pid or -1)
b.attach_uretprobe(name=library, sym_re=pattern, b.attach_uretprobe(name=library, sym_re=pattern,
fn_name="trace_func_return") fn_name="trace_func_return", pid=args.pid or -1)
matched = b.num_open_uprobes() matched = b.num_open_uprobes()
if matched == 0: if matched == 0:
......
...@@ -130,18 +130,20 @@ b = BPF(text=prog) ...@@ -130,18 +130,20 @@ b = BPF(text=prog)
# on its exit (Mark Drayton) # on its exit (Mark Drayton)
# #
if args.openssl: if args.openssl:
b.attach_uprobe(name="ssl", sym="SSL_write", fn_name="probe_SSL_write") b.attach_uprobe(name="ssl", sym="SSL_write", fn_name="probe_SSL_write",
b.attach_uprobe(name="ssl", sym="SSL_read", fn_name="probe_SSL_read_enter") pid=args.pid or -1)
b.attach_uprobe(name="ssl", sym="SSL_read", fn_name="probe_SSL_read_enter",
pid=args.pid or -1)
b.attach_uretprobe(name="ssl", sym="SSL_read", b.attach_uretprobe(name="ssl", sym="SSL_read",
fn_name="probe_SSL_read_exit") fn_name="probe_SSL_read_exit", pid=args.pid or -1)
if args.gnutls: if args.gnutls:
b.attach_uprobe(name="gnutls", sym="gnutls_record_send", b.attach_uprobe(name="gnutls", sym="gnutls_record_send",
fn_name="probe_SSL_write") fn_name="probe_SSL_write", pid=args.pid or -1)
b.attach_uprobe(name="gnutls", sym="gnutls_record_recv", b.attach_uprobe(name="gnutls", sym="gnutls_record_recv",
fn_name="probe_SSL_read_enter") fn_name="probe_SSL_read_enter", pid=args.pid or -1)
b.attach_uretprobe(name="gnutls", sym="gnutls_record_recv", b.attach_uretprobe(name="gnutls", sym="gnutls_record_recv",
fn_name="probe_SSL_read_exit") fn_name="probe_SSL_read_exit", pid=args.pid or -1)
# define output data structure in Python # define output data structure in Python
TASK_COMM_LEN = 16 # linux/sched.h TASK_COMM_LEN = 16 # linux/sched.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment