SlideShare una empresa de Scribd logo
1 de 109
Descargar para leer sin conexión
beyond breakpointsA Tour of Dynamic Analysis
Nathan Taylor, Fastly
http://nathan.dijkstracula.net
@dijkstracula
T. Ball: The Concept of Dynamic Analysis ESEC ‘99
“Dynamic analysis is the
analysis of the properties
of a running program […]
(usually through program
instrumentation).”
From Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation
From ReVirt: Enabling Intrusion Analysis through Virtual-Machine Logging and Replay
classic use-cases
Debugging a program crash or race condition
Input to understand a new codebase
Analysis of obfuscated software or malware
who cares
Huge gulf between what tools practitioners use in
industry, and academic dynamic analysis work
Many techniques shared with other cool areas
like OS virtualization and compiler theory
Techniques have different performance tradeoffs;
knowing the lay of the land will help you choose
the right tool for your problem
dynamic vs static analysis
Static analysis is a conservative approximation of
runtime behavior
Programs are only partially known (dynamic linking;
user input)
Imprecise: consider a program that typechecks but still
has a bug
Language specifications often assume a single thread
of execution (or, don’t specify at all): “valid” programs
can still allow race conditions!
can’t prove correctness
but can demonstrate failure
today’s topics
Omniscient Debugging and State Tracking
Analyzing Concurrent Systems
Areas of Future Work
for each topic…
What open-source tooling exists?
How does it work under the hood?
What contributions has academia made?
J. Mickens: The Night Watch ;login Nov 2013
“Despair is when you’re
debugging a kernel driver and
you look at a memory dump and
you see that a pointer has a value
of 7. THERE IS NO
HARDWARE ARCHITECTURE
THAT IS ALIGNED ON 7.
Furthermore, 7 IS TOO SMALL
AND ONLY EVIL CODE WOULD
TRY TO ACCESS SMALL
NUMBER MEMORY. ”
Time-Traveling
Debugging
line 9
old i: N/A
new i: 7
line 10
old i: 7
new i: 8
line 11
old j: N/A
new j: 5
line 12
old i: 8
new j: 13
gdb/record-full.c
Hofer et al. Design And Implementation of
a Backward-In-Time Debugger
NODe ‘06
Efficient time-
traveling
King et al. Debugging Operating Systems
with Time-Traveling Virtual Machines
Usenix ‘05
“…operating systems run
for long periods of time,
such as weeks, months, or
even years.”
King et al. Debugging Operating Systems
with Time-Traveling Virtual Machines
Usenix ‘05
King et al. Debugging Operating Systems
with Time-Traveling Virtual Machines
Usenix ‘05
“Replay causes the virtual
machine to transition
through the same states as
it went through during the
original run”
“A VM can be replayed by
starting from a checkpoint,
then replaying […] the
network, keyboard, clock,
and timing of interrupts”
Deterministic
Replay
King et al. Debugging Operating Systems
with Time-Traveling Virtual Machines
Usenix ‘05
“Taking checkpoints every minute
added less than 4% time overhead
and 1-5 MB/sec space overhead.”
“The logging added 3-12% in
running time and 2-85 KB/sec in
log space.”
“Taking checkpoints every 10
second added 16-33% overhead
and enabled reverse debugging
commands to complete in about
12 seconds”
GDB: linked list storage of every memory op
Easy to build and reason about
Both recording and replaying is very slow-
+
King (et al): Periodic state checkpointing
Easy to jump between large period of time
Can trade better fidelity for greater overhead
Have to replay execution between checkpoints
+
+
-
King (et al): Only records external, non-deterministic events
Reduces log size and improves performance
synchronizing external events becomes complicated
+
-
Improving
performance with
JIT compilation
compilation-based tooling
Rather than interrupt execution to
return control-flow to a debugger,
weave instrumentation into the
existing codebase at runtime
Allows for both better
performance and more flexible
analysis tools
Luk et al. Pin: Building Customized Program
Analysis Tools w/ Dynamic Instrumentation PLDI ‘05
“The goal is to provide an
implementation platform for
building program analysis tools”
“Its API allows a tool to insert
calls to instrumentation at
arbitrary locations in the
executable”
“Pin provides efficient
instrumentation by using a just-
in-time compiler to insert and
optimize code”
…

4 byte write to 0x7fff572b3b1c
4 byte write to 0x7fff572b3b1c

1 byte write to 0x7f86c0c04b00
1 byte write to 0x7f86c0c04b04
4 byte write to 0x7fff572b3b20
…
Luk et al. Pin: Building Customized Program
Analysis Tools w/ Dynamic Instrumentation PLDI ‘05
recordMemWrite(%rip,	
  &i);
recordMemWrite(%rip,	
  &i);
recordMemWrite(%rip,	
  &j);
recordMemWrite(%rip,	
  &i);
movl	
  	
  	
  	
  $0x7,	
  -­‐0x8(%rbp)INS_AddInstrumentFunction()
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>
TRACE_AddInstrumentFunction()
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
RTN_AddInstrumentFunction()
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
IMG_AddInstrumentFunction()
thread-sanitizer/blob/master/gcc/tree-tsan.c
static	
  void	
  
instrument_gimple	
  (gimple_stmt_iterator	
  gsi)	
  
{	
  
	
  	
  unsigned	
  i;	
  
	
  	
  gimple	
  stmt;	
  
	
  	
  enum	
  gimple_code	
  gcode;	
  
	
  	
  tree	
  rhs,	
  lhs;	
  
	
  	
  stmt	
  =	
  gsi_stmt	
  (gsi);	
  
	
  	
  gcode	
  =	
  gimple_code	
  (stmt);	
  
	
  	
  if	
  (gcode	
  ==	
  GIMPLE_ASSIGN)	
  {	
  
	
  	
  	
  	
  	
  	
  /*	
  Handle	
  assignment	
  lhs	
  as	
  store.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  lhs	
  =	
  gimple_assign_lhs	
  (stmt);	
  
	
  	
  	
  	
  	
  	
  instrument_expr	
  (gsi,	
  lhs,	
  1);	
  
	
  	
  	
  	
  	
  	
  /*	
  Handle	
  operands	
  as	
  loads.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  for	
  (i	
  =	
  1;	
  i	
  <	
  gimple_num_ops	
  (stmt);	
  i++)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  rhs	
  =	
  gimple_op	
  (stmt,	
  i);	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  instrument_expr	
  (gsi,	
  rhs,	
  0);	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  }	
  
}
static	
  void	
  
instrument_expr	
  (gimple_stmt_iterator	
  gsi,	
  tree	
  expr,	
  int	
  is_write)	
  
{	
  
	
  	
  enum	
  tree_code	
  tcode;	
  
	
  	
  unsigned	
  fld_off,	
  fld_size;	
  
	
  	
  tree	
  base,	
  rhs;	
  
	
  	
  gimple	
  stmt;	
  
	
  	
  gimple_seq	
  gs;	
  
	
  	
  location_t	
  loc;	
  
	
  	
  base	
  =	
  get_base_address	
  (expr);	
  
	
  	
  if	
  (base	
  ==	
  NULL_TREE	
  ||	
  TREE_CODE	
  (base)	
  ==	
  SSA_NAME	
  
	
  	
  	
  	
  	
  	
  ||	
  TREE_CODE	
  (base)	
  ==	
  STRING_CST)	
  
	
  	
  	
  	
  return;	
  
	
  	
  tcode	
  =	
  TREE_CODE	
  (expr);	
  
	
  	
  /*	
  Below	
  are	
  things	
  we	
  do	
  not	
  instrument	
  
	
  	
  	
  	
  	
  (no	
  possibility	
  of	
  races	
  or	
  not	
  implemented	
  yet).	
  	
  */	
  
	
  	
  if	
  (/*	
  Compiler-­‐emitted	
  artificial	
  variables.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  (DECL_P	
  (expr)	
  &&	
  DECL_ARTIFICIAL	
  (expr))	
  
	
  	
  	
  	
  	
  	
  /*	
  The	
  var	
  does	
  not	
  live	
  in	
  memory	
  -­‐>	
  no	
  possibility	
  of	
  races.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  ||	
  (tcode	
  ==	
  VAR_DECL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  &&	
  TREE_ADDRESSABLE	
  (expr)	
  ==	
  0	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  &&	
  TREE_STATIC	
  (expr)	
  ==	
  0)	
  
	
  	
  	
  	
  	
  	
  /*	
  Not	
  implemented.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  ||	
  TREE_CODE	
  (TREE_TYPE	
  (expr))	
  ==	
  RECORD_TYPE	
  
	
  	
  	
  	
  	
  	
  ||	
  tcode	
  ==	
  CONSTRUCTOR	
  
	
  	
  	
  	
  	
  	
  ||	
  tcode	
  ==	
  PARM_DECL	
  
	
  	
  	
  	
  	
  	
  /*	
  Load	
  of	
  a	
  const	
  variable/parameter/field.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  ||	
  is_load_of_const	
  (expr,	
  is_write))	
  
	
  	
  	
  	
  return;	
  
static	
  gimple_seq	
  
instr_memory_access	
  (tree	
  expr,	
  int	
  is_write)	
  
{	
  
	
  	
  tree	
  addr_expr,	
  expr_type,	
  call_expr,	
  fdecl;	
  
	
  	
  gimple_seq	
  gs;	
  
	
  	
  unsigned	
  size;	
  
	
  	
  gcc_assert	
  (is_gimple_addressable	
  (expr));	
  
	
  	
  addr_expr	
  =	
  build_addr	
  (unshare_expr	
  (expr),	
  current_function_decl);	
  
	
  	
  expr_type	
  =	
  TREE_TYPE	
  (expr);	
  
	
  	
  while	
  (TREE_CODE	
  (expr_type)	
  ==	
  ARRAY_TYPE)	
  
	
  	
  	
  	
  expr_type	
  =	
  TREE_TYPE	
  (expr_type);	
  
	
  	
  size	
  =	
  (TREE_INT_CST_LOW	
  (TYPE_SIZE	
  (expr_type)))	
  /	
  BITS_PER_UNIT;	
  
	
  	
  fdecl	
  =	
  get_memory_access_decl	
  (is_write,	
  size);	
  
	
  	
  call_expr	
  =	
  build_call_expr	
  (fdecl,	
  1,	
  addr_expr);	
  
	
  	
  gs	
  =	
  NULL;	
  
	
  	
  force_gimple_operand	
  (call_expr,	
  &gs,	
  true,	
  0);	
  
	
  	
  return	
  gs;	
  
static	
  tree	
  
get_memory_access_decl	
  (int	
  is_write,	
  unsigned	
  size)	
  
{	
  
	
  	
  tree	
  typ,	
  *decl;	
  
	
  	
  char	
  fname	
  [64];	
  
	
  	
  static	
  tree	
  cache	
  [2][17];	
  
	
  	
  is_write	
  =	
  !!is_write;	
  
	
  	
  if	
  (size	
  <=	
  1)	
  
	
  	
  	
  	
  size	
  =	
  1;	
  
	
  	
  else	
  if	
  (size	
  <=	
  3)	
  
	
  	
  	
  	
  size	
  =	
  2;	
  
	
  	
  else	
  if	
  (size	
  <=	
  7)	
  
	
  	
  	
  	
  size	
  =	
  4;	
  
	
  	
  else	
  if	
  (size	
  <=	
  15)	
  
	
  	
  	
  	
  size	
  =	
  8;	
  
	
  	
  else	
  
	
  	
  	
  	
  size	
  =	
  16;	
  
	
  	
  decl	
  =	
  &cache[is_write][size];	
  
	
  	
  if	
  (*decl	
  ==	
  NULL)	
  {	
  
	
  	
  	
  	
  	
  	
  snprintf(fname,	
  sizeof	
  fname,	
  "__tsan_%s%d",	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  is_write	
  ?	
  "write"	
  :	
  "read",	
  size);	
  
	
  	
  	
  	
  	
  	
  typ	
  =	
  build_function_type_list	
  (void_type_node,	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ptr_type_node,	
  NULL_TREE);	
  
	
  	
  	
  	
  	
  	
  *decl	
  =	
  build_func_decl	
  (typ,	
  fname);	
  
	
  	
  	
  	
  }	
  
	
  	
  return	
  *decl;	
  
}
	
  	
  if	
  (tcode	
  ==	
  COMPONENT_REF)	
  {	
  
	
  	
  	
  	
  	
  	
  tree	
  field	
  =	
  TREE_OPERAND	
  (expr,	
  1);	
  
	
  	
  	
  	
  	
  	
  if	
  (TREE_CODE	
  (field)	
  ==	
  FIELD_DECL)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fld_off	
  =	
  TREE_INT_CST_LOW	
  (DECL_FIELD_BIT_OFFSET	
  (field));	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fld_size	
  =	
  TREE_INT_CST_LOW	
  (DECL_SIZE	
  (field));	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  (((fld_off	
  %	
  BITS_PER_UNIT)	
  !=	
  0)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ||	
  ((fld_size	
  %	
  BITS_PER_UNIT)	
  !=	
  0))	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  /*	
  As	
  of	
  now	
  it	
  crashes	
  compilation.	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TODO:	
  handle	
  bit-­‐fields	
  as	
  if	
  touching	
  the	
  whole	
  field.	
  	
  */	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return;	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  }	
  
	
  	
  /*	
  TODO:	
  handle	
  other	
  cases	
  
	
  	
  	
  	
  	
  (FIELD_DECL,	
  MEM_REF,	
  ARRAY_RANGE_REF,	
  TARGET_MEM_REF,	
  ADDR_EXPR).	
  	
  */	
  
	
  	
  if	
  (tcode	
  !=	
  ARRAY_REF	
  
	
  	
  	
  	
  	
  	
  &&	
  tcode	
  !=	
  VAR_DECL	
  &&	
  tcode	
  !=	
  COMPONENT_REF	
  
	
  	
  	
  	
  	
  	
  &&	
  tcode	
  !=	
  INDIRECT_REF	
  &&	
  tcode	
  !=	
  MEM_REF)	
  
	
  	
  	
  	
  return;	
  
	
  	
  func_mops++;	
  
	
  	
  stmt	
  =	
  gsi_stmt	
  (gsi);	
  
	
  	
  loc	
  =	
  gimple_location	
  (stmt);	
  
	
  	
  rhs	
  =	
  is_vptr_store	
  (stmt,	
  expr,	
  is_write);	
  
	
  	
  if	
  (rhs	
  ==	
  NULL)	
  
	
  	
  	
  	
  gs	
  =	
  instr_memory_access	
  (expr,	
  is_write);	
  
	
  	
  else	
  
	
  	
  	
  	
  gs	
  =	
  instr_vptr_update	
  (expr,	
  rhs);	
  
	
  	
  set_location	
  (gs,	
  loc);	
  
	
  	
  /*	
  Instrumentation	
  for	
  assignment	
  of	
  a	
  function	
  result	
  
	
  	
  	
  	
  	
  must	
  be	
  inserted	
  after	
  the	
  call.	
  	
  Instrumentation	
  for	
  
	
  	
  	
  	
  	
  reads	
  of	
  function	
  arguments	
  must	
  be	
  inserted	
  before	
  the	
  call.	
  
	
  	
  	
  	
  	
  That's	
  because	
  the	
  call	
  can	
  contain	
  synchronization.	
  	
  */	
  
	
  	
  if	
  (is_gimple_call	
  (stmt)	
  &&	
  is_write)	
  
	
  	
  	
  	
  gsi_insert_seq_after	
  (&gsi,	
  gs,	
  GSI_NEW_STMT);	
  
	
  	
  else	
  
	
  	
  	
  	
  gsi_insert_seq_before	
  (&gsi,	
  gs,	
  GSI_SAME_STMT);	
  
}
Luk et al. Pin: Building Customized Program
Analysis Tools w/ Dynamic Instrumentation PLDI ‘05
“Pin compiles from one ISA
directly into the same ISA
without going through an
intermediate format and
stored in a software-based
code cache”
“only code residing in the
code cache is executed - the
original code is never
executed.”
Luk et al. Pin: Building Customized Program
Analysis Tools w/ Dynamic Instrumentation PLDI ‘05
“Pin compiles from one ISA
directly into the same ISA
without going through an
intermediate format”
movl	
  	
  	
  	
  $0x7,	
  -­‐0x8(%rbp)
addl	
  	
  	
  	
  $0x1,	
  -­‐0x8(%rbp)
mov	
  	
  	
  	
  	
  -­‐0x8(%rbp),	
  %eax
sub	
  	
  	
  	
  	
  $0x3,	
  %eax
mov	
  	
  	
  	
  	
  %eax,	
  -­‐0x4(%rbp)
mov	
  	
  	
  	
  	
  $0x4(%rbp),	
  %eax
add	
  	
  	
  	
  	
  %eax,	
  -­‐0x8(%rbp)
recordMemWrite(%rip,	
  -­‐0x8(%rbp))
recordMemWrite(%rip,	
  -­‐0x8(%rbp))
recordMemWrite(%rip,	
  -­‐0x4(%rbp))
recordMemWrite(%rip,	
  -­‐0x8(%rbp))
movl	
  	
  	
  	
  $0x7,	
  -­‐0x8(%rbp)
addl	
  	
  	
  	
  $0x1,	
  -­‐0x8(%rbp)
mov	
  	
  	
  	
  	
  -­‐0x8(%rbp),	
  %eax
sub	
  	
  	
  	
  	
  $0x3,	
  %eax
mov	
  	
  	
  	
  	
  %eax,	
  -­‐0x4(%rbp)
mov	
  	
  	
  	
  	
  $0x4(%rbp),	
  %eax
add	
  	
  	
  	
  	
  %eax,	
  -­‐0x8(%rbp)
code rewriting
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
jump rewriting
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%wax	
  
callq	
  	
  0xdeadbeef	
  
pop	
  	
  	
  	
  %rbp	
  
retq
callq	
  	
  0x400540	
  <bar>callq	
  	
  0xdeadbeef
jump rewriting
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0xdeadbeef	
  
leaveq	
  
retq
jump rewriting
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  $0x100,%edi	
  
callq	
  	
  0x400430	
  <malloc@plt>	
  
mov	
  	
  	
  	
  %rax,0x200ac8(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x400540	
  <bar>	
  
pop	
  	
  	
  	
  %rbp	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
sub	
  	
  	
  	
  $0x10,%rsp	
  
movq	
  	
  	
  $0x0,-­‐0x8(%rbp)	
  
mov	
  	
  	
  	
  -­‐0x8(%rbp),%rax	
  
add	
  	
  	
  	
  $0x1c,%rax	
  
mov	
  	
  	
  	
  %rax,0x200ae9(%rip)	
  
mov	
  	
  	
  	
  $0x0,%eax	
  
callq	
  	
  0x40052d	
  <baz>	
  
leaveq	
  
retq
push	
  	
  	
  %rbp	
  
mov	
  	
  	
  	
  %rsp,%rbp	
  
mov	
  	
  	
  	
  0x200b10(%rip),%rax	
  
movl	
  	
  	
  $0x2a,(%rax)	
  
pop	
  	
  	
  	
  %rbp	
  
retq
stateless(ish) instrumentation
https://software.intel.com/sites/landingpage/pintool/docs/67254/Pin/html/index.html#EXAMPLES
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
“which values are undefined (i.e.
uninitialised, or derived from
undefined values) and can thus
detect dangerous uses of
undefined values.”
“which values are tainted (i.e.
from an untrusted source,) and
can thus detect dangerous uses of
tainted values.”
“which word values are array
pointers, and from this can detect
bounds errors.”
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
One interesting group of
DBA tools are those that
use shadow values. These
tools shadow, purely in
software, every register and
memory value with another
value that says something
about it. We call these
shadow value tools.
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>0x08048000
0x08048001
0x08048002
0xc000000
.
.
.
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>
<value>0x08048000
0x08048001
0x08048002
0xc000000
.
.
.
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata>
<metadata> 0x08048000
0x08048001
0x08048002
0xc000000
.
.
.
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
One interesting group of
DBA tools are those that
use shadow values. These
tools shadow, purely in
software, every register and
memory value with another
value that says something
about it. We call these
shadow value tools.
0xc000000
memcheck/mc_main.c
0xc000000
memcheck/mc_main.c
set? set? set? set? set? set? set? set?
0xc000000
memcheck/mc_main.c
set? set? set? set? set? set? set? set?valid?
0xc000000
memcheck/mc_main.c
set? set? set? set? set? set? set? set?valid?
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
disassemble-and-
resynthesise: machine code is
converted to an IR in which each
instruction becomes one or more
IR operations. This IR is
instrumented and then converted
back to machine code.
copy-and-annotate: incoming
instructions are copied through
verbatim except for necessary
control flow changes. Tools use
the annotations to guide their
instrumentation.
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
“Pin provides no built-in support
for [shadow memory], so tools
must cope with the non-atomicity
of loads/stores and shadow
loads/stores themselves.”



“Valgrind’s thread serialisation
and asynchronous signal
treatment frees shadow value
tools from having to deal with this
issue.”
Luk et al. Pin: Building Customized Program
Analysis Tools w/ Dynamic Instrumentation PLDI ‘05
“in Figure 7(b), Pin
outperforms both
DynamoRIO and
Valgrind by a significant
margin: on average,
Valgrind slows the
application down by 8.3
times […] and Pin by 2.5
times.”
Pin: a “copy and annotate” system
Lower overhead than the alternatives
Close-to-the-metal instrumentation API
Best for tracking control flow, rather than memory
+
+
-
Valgrind: a “disassemble and resynthsize” system
Richer API and shadow memory allows for per-memory word
metadata tracking
Greater runtime overhead
+
-
State tracking
in practice
problem statement
“What values did a piece of memory
have over time?”
“How does a value propagate
through a running system?”
Chow et al. Understanding Data Lifetime via Whole
System Simulation USENIX Sec ‘04
TaintBochs tracks sensitive
data by “tainting” it at the
hardware level. Tainting
information is then
propagated across operating
system, language, and
application boundaries,
permitting analysis of
sensitive data handling at a
whole system level.
Chow et al. Understanding Data Lifetime via Whole
System Simulation USENIX Sec ‘04
We have used TaintBochs
to analyze sensitive data
handling in several large,
real world applications.
Among these were Mozilla,
Apache, and Perl, which
are used to process
millions of passwords,
credit card numbers, etc.
on a daily basis.
Chow et al. Understanding Data Lifetime via Whole
System Simulation USENIX Sec ‘04
“We must decide how
operations in the system
should affect shadow state.
If two registers A and B are
added, and one of them is
tainted, is the register where
the result are stored also
tainted? We refer to the
collective set of policies that
decide this as the
propagation policy.”
Chow et al. Understanding Data Lifetime via Whole
System Simulation USENIX Sec ‘04
“ Our basic propagation
policy is simply that if
any byte of any input
value is tainted, then all
bytes of the output are
tainted. This policy
is clearly conservative
and errs on the side of
tainting too much.”
Chow et al. Understanding Data Lifetime via Whole
System Simulation USENIX Sec ‘04
“ Sometimes tainted values are
used by instructions as indexes
into non-tainted memory (i.e. as
an index into a lookup table).”
For example, Linux routinely
remaps keyboard device data
through a lookup table before
sending keystrokes to user
programs. Thus, user programs
never directly see the data read in
from the keyboard device, only the
non tainted values they index in
the kernel’s key remapping
table.”
methodology
shadow memory to track
information flow
time-traveling debugging to
uncover relationship between
tainted memory
experiment: mozilla
Slowinska & Bos: Pointless Tainting? Evaluating the
Practicality of Pointer Tainting Eurosys ‘09
Slowinska & Bos: Pointless Tainting? Evaluating the
Practicality of Pointer Tainting Eurosys ‘09
“…in-depth analysis of the
problems of pointer tainting
on real systems which shows
that it does not work against
malware spying on users’
behaviour”
“an analysis and evaluation
of all known fixes to the
problems that shows that
they all have serious
shortcomings.”
Slowinska & Bos: Pointless Tainting? Evaluating the
Practicality of Pointer Tainting Eurosys ‘09
Analyzing
Concurrent
Systems
King et al. Debugging Operating Systems
with Time-Traveling Virtual Machines
Usenix ‘05
“Replay causes the virtual
machine to transition through
the same states as it went
through during the original run”
“A virtual machine can be
replayed by starting from a
checkpoint, then replaying all
sources of nondeterminism […]
the network, keyboard, clock,
and timing of interrupts”
Sequential
problem statement
“how to build a dynamic analysis tool
that correctly runs in a concurrent
environment?”
“What challenges does concurrent
software have that dynamic analysis
could help with?”
concurrent record & replay
use locking operations as sequencing
points
use virtual memory page protection
(come up with ideas for custom
hardware)
Nethercote et al. Valgrind: A Framework for
Heavyweight Dynamic Binary Instrumentation PLDI ‘07
“Valgrind serialises thread
execution with a thread locking
mechanism. Only the thread
holding the lock can run,”
“The kernel still chooses which
thread is to run next, but Valgrind
dictates when thread-switches
occur and prevents more than one
thread from running at a time.”
“How to best overcome this
problem remains an open
research question.”
Savage et al: Eraser: A Dynamic Data Race
Detector for Multithreaded Programs
SOSP ‘97
Savage et al: Eraser: A Dynamic Data Race
Detector for Multithreaded Programs
SOSP ‘97
“Eraser instruments
each call to acquire or
release a lock”
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
“if two memory instructions on
different processors access the
same page, and one of them is a
write, there will be a CREW
event between the instructions
on each processor.”
• concurrent-read: All cpus
have read permission, but none
have write permission.
• exclusive-write: One cpu
(called the owner) has both read
and write permission; all virtual
cpus have no permission.
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
“we use hardware page
protections, enforced
by the memory
management unit
(MMU), which will
check each read and
write as the instruction
executes, and cause a
fault to the hypervisor
on any violation.”
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
“if two memory instructions on
different processors access the
same page, and one of them is a
write, there will be a CREW
event between the instructions
on each processor.”
• concurrent-read: All cpus
have read permission, but none
have write permission.
• exclusive-write: One cpu
(called the owner) has both read
and write permission; all virtual
cpus have no permission.
CREW limitations
virtual memory hardware only
operates on 4k blocks
DMA not implemented in the paper
10x slowdown in the worst case!
Race detection
race detection techiques
Lockset algorithm
Happens-before relation
Hybrid techniques
examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces
int	
  var;	
  
void	
  Thread1()	
  {	
  	
  //	
  Runs	
  in	
  one	
  thread.	
  
	
  	
  var++;	
  
}	
  
void	
  Thread2()	
  {	
  	
  //	
  Runs	
  in	
  another	
  thread.	
  
	
  	
  var++;	
  
}	
  
examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces
//	
  Ref()	
  and	
  Unref()	
  may	
  be	
  called	
  from	
  several	
  threads.	
  
//	
  Last	
  Unref()	
  destroys	
  the	
  object.	
  
class	
  RefCountedObject	
  {	
  
	
  ...	
  
	
  public:	
  
	
  	
  void	
  Ref()	
  {	
  
	
  	
  	
  	
  ref_++;	
  	
  //	
  Bug!	
  
	
  	
  }	
  
	
  	
  void	
  Unref()	
  {	
  
	
  	
  	
  	
  if	
  (-­‐-­‐ref_	
  ==	
  0)	
  	
  //	
  Bug!	
  Need	
  to	
  use	
  atomic	
  decrement!	
  
	
  	
  	
  	
  	
  	
  delete	
  this;	
  
	
  	
  }	
  
	
  private:	
  
	
  	
  int	
  ref_;	
  
};
examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces
bool	
  done	
  =	
  false;	
  
void	
  Thread1()	
  {	
  
	
  	
  while	
  (!done)	
  {	
  
	
  	
  	
  	
  do_something_useful_in_a_loop_1();	
  
	
  	
  }	
  	
  
	
  	
  do_thread1_cleanup();	
  
}	
  
void	
  Thread2()	
  {	
  
	
  	
  do_something_useful_2();	
  
	
  	
  done	
  =	
  true;	
  
	
  	
  do_thread2_cleanup();	
  
}
examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces
bool	
  done	
  =	
  false;	
  
void	
  Thread1()	
  {	
  
	
  	
  while	
  (!done)	
  {	
  
	
  	
  	
  	
  do_something_useful_in_a_loop_1();	
  
	
  	
  }	
  	
  
	
  	
  do_thread1_cleanup();	
  
}	
  
void	
  Thread2()	
  {	
  
	
  	
  do_something_useful_2();	
  
	
  	
  done	
  =	
  true;	
  
	
  	
  do_thread2_cleanup();	
  
}
examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces
bool	
  done	
  =	
  false;	
  
void	
  Thread1()	
  {	
  
	
  	
  while	
  (!done)	
  {	
  
	
  	
  	
  	
  do_something_useful_in_a_loop_1();	
  
	
  	
  }	
  	
  
	
  	
  do_thread1_cleanup();	
  
}	
  
void	
  Thread2()	
  {	
  
	
  	
  done	
  =	
  true;	
  
	
  	
  do_something_useful_2();	
  
	
  	
  do_thread2_cleanup();	
  
}
“Eraser instruments
each call to acquire
or release a lock”
“In order to reconstruct the
state of shared memory,
each processor must view
writes to shared memory
by other processors as
asynchronous events. We
therefore need to preserve
the order of execution
between the processors.”
Savage et al: Eraser: A Dynamic Data Race
Detector for Multithreaded Programs
SOSP ‘97
Savage et al: Eraser: A Dynamic Data Race
Detector for Multithreaded Programs
SOSP ‘97
Lamport et al: Time, Locks and the Ordering
of Events in a Distributed System
CACM ‘78
Lamport et al: Time, Locks and the Ordering
of Events in a Distributed System
CACM ‘78
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
Dunlap et al: Execution Replay for
Multiprocessor Virtual Machines
VEE ‘08
“In order to reconstruct the state
of shared memory, each
processor must view writes to
shared memory by other
processors as asynchronous
events. We therefore need to
preserve the order of execution
between the processors.”
“Only reads and writes to shared
memory need to be ordered with
respect to each other"
Savage et al: Eraser: A Dynamic Data Race
Detector for Multithreaded Programs
SOSP ‘97
O’Callahan & Choi: Hybrid Dynamic Data
Race Detection
PPoPP ‘03
“Unfortunately violations of
the lockset hypothesis are not
always programming errors.
One common example is
programs which use
channels to pass objects
between threads in the style of
CSP [15].
In such programs thread
synchronization and mutual
exclusion are accomplished by
explicit signaling between
threads.”
Lockset - ensure >1 lock always protects shared me
Doesn’t need to observe a bug happening to find a race
False positives if different synchronization techniques used
+
-
Happens-Before - shared accesses must be separated by a sync
Causality def’n doesn’t require locks: fewer false positives
Observing races depends on execution order
Slower to run in practice than Lockset
+
-
-
Serebryany & Iskhodzhanov: ThreadSanitizer:
data race detection in practice WBIA ‘12
a hybrid approach
Full happens-before tracking for
synchronize operations
Lockset approach to determine
whether causally-related locksets are
non-empty
Serebryany & Iskhodzhanov: ThreadSanitizer:
data race detection in practice WBIA ‘12
Serebryany & Iskhodzhanov: ThreadSanitizer:
data race detection in practice WBIA ‘12
what have we seen
Time-Traveling Debugging for
reconstructing previous program state
JIT instrumentation for efficient control
flow modification
Shadow memory for efficient memory
introspection
the trace is out there
Novel and experimental hardware
Query languages and storage for large
trace data
Trace visualization techniques
Thanks
Slides, Citations,
and Acknowledgments:
https://github.com/dijkstracula/QConNYC2016
Nathan Taylor, Fastly
http://nathan.dijkstracula.net
@dijkstracula

Más contenido relacionado

La actualidad más candente

Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebeanFaren faren
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPAFaren faren
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Fastly
 
Tips for going fast in a slow world: Michael May at OSCON 2015
Tips for going fast in a slow world: Michael May at OSCON 2015Tips for going fast in a slow world: Michael May at OSCON 2015
Tips for going fast in a slow world: Michael May at OSCON 2015Fastly
 
Real Time Event Dispatcher
Real Time Event DispatcherReal Time Event Dispatcher
Real Time Event DispatcherPeter Dietrich
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015Fastly
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringFastly
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript FrameworkAll Things Open
 
Going crazy with Varnish and Symfony
Going crazy with Varnish and SymfonyGoing crazy with Varnish and Symfony
Going crazy with Varnish and SymfonyDavid de Boer
 
Reverse ajax in 2014
Reverse ajax in 2014Reverse ajax in 2014
Reverse ajax in 2014Nenad Pecanac
 
EWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationEWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationRob Tweed
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker PresentationKyle Dorman
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Androidsullis
 
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2Rob Tweed
 

La actualidad más candente (20)

Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebean
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPA
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
 
Tips for going fast in a slow world: Michael May at OSCON 2015
Tips for going fast in a slow world: Michael May at OSCON 2015Tips for going fast in a slow world: Michael May at OSCON 2015
Tips for going fast in a slow world: Michael May at OSCON 2015
 
Real Time Event Dispatcher
Real Time Event DispatcherReal Time Event Dispatcher
Real Time Event Dispatcher
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
Mitigating Security Threats with Fastly - Joe Williams at Fastly Altitude 2015
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and Clustering
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript Framework
 
Going crazy with Varnish and Symfony
Going crazy with Varnish and SymfonyGoing crazy with Varnish and Symfony
Going crazy with Varnish and Symfony
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Reverse ajax in 2014
Reverse ajax in 2014Reverse ajax in 2014
Reverse ajax in 2014
 
EWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5b: First Steps in Building a QEWD ApplicationEWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
EWD 3 Training Course Part 5b: First Steps in Building a QEWD Application
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker Presentation
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
 
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
EWD 3 Training Course Part 38: Building a React.js application with QEWD, Part 2
 

Destacado

Applying Varnish
Applying VarnishApplying Varnish
Applying VarnishFastly
 
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015Fastly
 
It Probably Works
It Probably WorksIt Probably Works
It Probably WorksFastly
 
Top 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live StreamingTop 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live StreamingFastly
 
What we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and PerformanceWhat we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and PerformanceFastly
 
Confident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF MeetupConfident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF MeetupFastly
 
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...Fastly
 
It Probably Works - QCon 2015
It Probably Works - QCon 2015It Probably Works - QCon 2015
It Probably Works - QCon 2015Fastly
 
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...Fastly
 
Developing a Globally Distributed Purging System
Developing a Globally Distributed Purging SystemDeveloping a Globally Distributed Purging System
Developing a Globally Distributed Purging SystemFastly
 
Fallacy of Fast
Fallacy of FastFallacy of Fast
Fallacy of FastFastly
 
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...Fastly
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeFastly
 
Building a better web
Building a better webBuilding a better web
Building a better webFastly
 
The future of the edge
The future of the edge The future of the edge
The future of the edge Fastly
 
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015Fastly
 
From Zero to Capacity Planning
From Zero to Capacity PlanningFrom Zero to Capacity Planning
From Zero to Capacity PlanningFastly
 
Making ops life easier
Making ops life easierMaking ops life easier
Making ops life easierFastly
 
Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015Fastly
 
Resource Allocation in Computer Networks
Resource Allocation in Computer NetworksResource Allocation in Computer Networks
Resource Allocation in Computer NetworksFastly
 

Destacado (20)

Applying Varnish
Applying VarnishApplying Varnish
Applying Varnish
 
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
 
It Probably Works
It Probably WorksIt Probably Works
It Probably Works
 
Top 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live StreamingTop 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live Streaming
 
What we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and PerformanceWhat we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and Performance
 
Confident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF MeetupConfident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF Meetup
 
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
 
It Probably Works - QCon 2015
It Probably Works - QCon 2015It Probably Works - QCon 2015
It Probably Works - QCon 2015
 
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...
Interative Traffic Engineering in Changing Internet Economics - Tom Daly at L...
 
Developing a Globally Distributed Purging System
Developing a Globally Distributed Purging SystemDeveloping a Globally Distributed Purging System
Developing a Globally Distributed Purging System
 
Fallacy of Fast
Fallacy of FastFallacy of Fast
Fallacy of Fast
 
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the Edge
 
Building a better web
Building a better webBuilding a better web
Building a better web
 
The future of the edge
The future of the edge The future of the edge
The future of the edge
 
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
 
From Zero to Capacity Planning
From Zero to Capacity PlanningFrom Zero to Capacity Planning
From Zero to Capacity Planning
 
Making ops life easier
Making ops life easierMaking ops life easier
Making ops life easier
 
Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015
 
Resource Allocation in Computer Networks
Resource Allocation in Computer NetworksResource Allocation in Computer Networks
Resource Allocation in Computer Networks
 

Similar a Beyond Breakpoints: A Tour of Dynamic Analysis

Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codeAndrey Karpov
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codePVS-Studio
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisC4Media
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DMithun Hunsur
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial javaTpoint s
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...Andrey Karpov
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentOOO "Program Verification Systems"
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudAndrea Righi
 
Virtual training Intro to Kapacitor
Virtual training  Intro to Kapacitor Virtual training  Intro to Kapacitor
Virtual training Intro to Kapacitor InfluxData
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321Teddy Hsiung
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Max Kleiner
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaXKernel TLV
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Igalia
 

Similar a Beyond Breakpoints: A Tour of Dynamic Analysis (20)

Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
PVS-Studio 5.00, a solution for developers of modern resource-intensive appl...
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
Exploiting vectorization with ISPC
Exploiting vectorization with ISPCExploiting vectorization with ISPC
Exploiting vectorization with ISPC
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
Virtual training Intro to Kapacitor
Virtual training  Intro to Kapacitor Virtual training  Intro to Kapacitor
Virtual training Intro to Kapacitor
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaX
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
 

Más de Fastly

Revisiting HTTP/2
Revisiting HTTP/2Revisiting HTTP/2
Revisiting HTTP/2Fastly
 
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleAltitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleFastly
 
Altitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the InternetAltitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the InternetFastly
 
Altitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup StreamAltitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup StreamFastly
 
Altitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our DestinyAltitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our DestinyFastly
 
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...Fastly
 
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless MigrationAltitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless MigrationFastly
 
Altitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub PagesAltitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub PagesFastly
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopFastly
 
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and WoeAltitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and WoeFastly
 
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...Fastly
 
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per dayAltitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per dayFastly
 
Altitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeAltitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeFastly
 
Altitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsAltitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsFastly
 
Altitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopAltitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopFastly
 
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORKAltitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORKFastly
 
Altitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF WorkshopAltitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF WorkshopFastly
 
Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge Fastly
 
Altitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop DocsAltitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop DocsFastly
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeFastly
 

Más de Fastly (20)

Revisiting HTTP/2
Revisiting HTTP/2Revisiting HTTP/2
Revisiting HTTP/2
 
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleAltitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
 
Altitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the InternetAltitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the Internet
 
Altitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup StreamAltitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup Stream
 
Altitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our DestinyAltitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our Destiny
 
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
 
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless MigrationAltitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
 
Altitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub PagesAltitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub Pages
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation Workshop
 
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and WoeAltitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
 
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
 
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per dayAltitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per day
 
Altitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeAltitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the Edge
 
Altitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsAltitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & Applications
 
Altitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopAltitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly Workshop
 
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORKAltitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
 
Altitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF WorkshopAltitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF Workshop
 
Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge
 
Altitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop DocsAltitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop Docs
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the Edge
 

Último

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 

Último (20)

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 

Beyond Breakpoints: A Tour of Dynamic Analysis

  • 1. beyond breakpointsA Tour of Dynamic Analysis Nathan Taylor, Fastly http://nathan.dijkstracula.net @dijkstracula
  • 2.
  • 3. T. Ball: The Concept of Dynamic Analysis ESEC ‘99 “Dynamic analysis is the analysis of the properties of a running program […] (usually through program instrumentation).”
  • 4. From Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation
  • 5. From ReVirt: Enabling Intrusion Analysis through Virtual-Machine Logging and Replay
  • 6. classic use-cases Debugging a program crash or race condition Input to understand a new codebase Analysis of obfuscated software or malware
  • 7. who cares Huge gulf between what tools practitioners use in industry, and academic dynamic analysis work Many techniques shared with other cool areas like OS virtualization and compiler theory Techniques have different performance tradeoffs; knowing the lay of the land will help you choose the right tool for your problem
  • 8. dynamic vs static analysis Static analysis is a conservative approximation of runtime behavior Programs are only partially known (dynamic linking; user input) Imprecise: consider a program that typechecks but still has a bug Language specifications often assume a single thread of execution (or, don’t specify at all): “valid” programs can still allow race conditions!
  • 9. can’t prove correctness but can demonstrate failure
  • 10. today’s topics Omniscient Debugging and State Tracking Analyzing Concurrent Systems Areas of Future Work
  • 11. for each topic… What open-source tooling exists? How does it work under the hood? What contributions has academia made?
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. J. Mickens: The Night Watch ;login Nov 2013 “Despair is when you’re debugging a kernel driver and you look at a memory dump and you see that a pointer has a value of 7. THERE IS NO HARDWARE ARCHITECTURE THAT IS ALIGNED ON 7. Furthermore, 7 IS TOO SMALL AND ONLY EVIL CODE WOULD TRY TO ACCESS SMALL NUMBER MEMORY. ”
  • 18.
  • 20.
  • 21. line 9 old i: N/A new i: 7 line 10 old i: 7 new i: 8 line 11 old j: N/A new j: 5 line 12 old i: 8 new j: 13
  • 23.
  • 24. Hofer et al. Design And Implementation of a Backward-In-Time Debugger NODe ‘06
  • 25.
  • 27. King et al. Debugging Operating Systems with Time-Traveling Virtual Machines Usenix ‘05 “…operating systems run for long periods of time, such as weeks, months, or even years.”
  • 28. King et al. Debugging Operating Systems with Time-Traveling Virtual Machines Usenix ‘05
  • 29. King et al. Debugging Operating Systems with Time-Traveling Virtual Machines Usenix ‘05 “Replay causes the virtual machine to transition through the same states as it went through during the original run” “A VM can be replayed by starting from a checkpoint, then replaying […] the network, keyboard, clock, and timing of interrupts”
  • 31. King et al. Debugging Operating Systems with Time-Traveling Virtual Machines Usenix ‘05 “Taking checkpoints every minute added less than 4% time overhead and 1-5 MB/sec space overhead.” “The logging added 3-12% in running time and 2-85 KB/sec in log space.” “Taking checkpoints every 10 second added 16-33% overhead and enabled reverse debugging commands to complete in about 12 seconds”
  • 32. GDB: linked list storage of every memory op Easy to build and reason about Both recording and replaying is very slow- + King (et al): Periodic state checkpointing Easy to jump between large period of time Can trade better fidelity for greater overhead Have to replay execution between checkpoints + + - King (et al): Only records external, non-deterministic events Reduces log size and improves performance synchronizing external events becomes complicated + -
  • 34. compilation-based tooling Rather than interrupt execution to return control-flow to a debugger, weave instrumentation into the existing codebase at runtime Allows for both better performance and more flexible analysis tools
  • 35. Luk et al. Pin: Building Customized Program Analysis Tools w/ Dynamic Instrumentation PLDI ‘05 “The goal is to provide an implementation platform for building program analysis tools” “Its API allows a tool to insert calls to instrumentation at arbitrary locations in the executable” “Pin provides efficient instrumentation by using a just- in-time compiler to insert and optimize code”
  • 36. …
 4 byte write to 0x7fff572b3b1c 4 byte write to 0x7fff572b3b1c
 1 byte write to 0x7f86c0c04b00 1 byte write to 0x7f86c0c04b04 4 byte write to 0x7fff572b3b20 …
  • 37. Luk et al. Pin: Building Customized Program Analysis Tools w/ Dynamic Instrumentation PLDI ‘05 recordMemWrite(%rip,  &i); recordMemWrite(%rip,  &i); recordMemWrite(%rip,  &j); recordMemWrite(%rip,  &i);
  • 38. movl        $0x7,  -­‐0x8(%rbp)INS_AddInstrumentFunction() push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt> TRACE_AddInstrumentFunction() push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq RTN_AddInstrumentFunction() push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq IMG_AddInstrumentFunction()
  • 39. thread-sanitizer/blob/master/gcc/tree-tsan.c static  void   instrument_gimple  (gimple_stmt_iterator  gsi)   {      unsigned  i;      gimple  stmt;      enum  gimple_code  gcode;      tree  rhs,  lhs;      stmt  =  gsi_stmt  (gsi);      gcode  =  gimple_code  (stmt);      if  (gcode  ==  GIMPLE_ASSIGN)  {              /*  Handle  assignment  lhs  as  store.    */              lhs  =  gimple_assign_lhs  (stmt);              instrument_expr  (gsi,  lhs,  1);              /*  Handle  operands  as  loads.    */              for  (i  =  1;  i  <  gimple_num_ops  (stmt);  i++)  {                      rhs  =  gimple_op  (stmt,  i);                      instrument_expr  (gsi,  rhs,  0);                  }          }   } static  void   instrument_expr  (gimple_stmt_iterator  gsi,  tree  expr,  int  is_write)   {      enum  tree_code  tcode;      unsigned  fld_off,  fld_size;      tree  base,  rhs;      gimple  stmt;      gimple_seq  gs;      location_t  loc;      base  =  get_base_address  (expr);      if  (base  ==  NULL_TREE  ||  TREE_CODE  (base)  ==  SSA_NAME              ||  TREE_CODE  (base)  ==  STRING_CST)          return;      tcode  =  TREE_CODE  (expr);      /*  Below  are  things  we  do  not  instrument            (no  possibility  of  races  or  not  implemented  yet).    */      if  (/*  Compiler-­‐emitted  artificial  variables.    */              (DECL_P  (expr)  &&  DECL_ARTIFICIAL  (expr))              /*  The  var  does  not  live  in  memory  -­‐>  no  possibility  of  races.    */              ||  (tcode  ==  VAR_DECL                      &&  TREE_ADDRESSABLE  (expr)  ==  0                      &&  TREE_STATIC  (expr)  ==  0)              /*  Not  implemented.    */              ||  TREE_CODE  (TREE_TYPE  (expr))  ==  RECORD_TYPE              ||  tcode  ==  CONSTRUCTOR              ||  tcode  ==  PARM_DECL              /*  Load  of  a  const  variable/parameter/field.    */              ||  is_load_of_const  (expr,  is_write))          return;   static  gimple_seq   instr_memory_access  (tree  expr,  int  is_write)   {      tree  addr_expr,  expr_type,  call_expr,  fdecl;      gimple_seq  gs;      unsigned  size;      gcc_assert  (is_gimple_addressable  (expr));      addr_expr  =  build_addr  (unshare_expr  (expr),  current_function_decl);      expr_type  =  TREE_TYPE  (expr);      while  (TREE_CODE  (expr_type)  ==  ARRAY_TYPE)          expr_type  =  TREE_TYPE  (expr_type);      size  =  (TREE_INT_CST_LOW  (TYPE_SIZE  (expr_type)))  /  BITS_PER_UNIT;      fdecl  =  get_memory_access_decl  (is_write,  size);      call_expr  =  build_call_expr  (fdecl,  1,  addr_expr);      gs  =  NULL;      force_gimple_operand  (call_expr,  &gs,  true,  0);      return  gs;   static  tree   get_memory_access_decl  (int  is_write,  unsigned  size)   {      tree  typ,  *decl;      char  fname  [64];      static  tree  cache  [2][17];      is_write  =  !!is_write;      if  (size  <=  1)          size  =  1;      else  if  (size  <=  3)          size  =  2;      else  if  (size  <=  7)          size  =  4;      else  if  (size  <=  15)          size  =  8;      else          size  =  16;      decl  =  &cache[is_write][size];      if  (*decl  ==  NULL)  {              snprintf(fname,  sizeof  fname,  "__tsan_%s%d",                                is_write  ?  "write"  :  "read",  size);              typ  =  build_function_type_list  (void_type_node,                                            ptr_type_node,  NULL_TREE);              *decl  =  build_func_decl  (typ,  fname);          }      return  *decl;   }    if  (tcode  ==  COMPONENT_REF)  {              tree  field  =  TREE_OPERAND  (expr,  1);              if  (TREE_CODE  (field)  ==  FIELD_DECL)  {                      fld_off  =  TREE_INT_CST_LOW  (DECL_FIELD_BIT_OFFSET  (field));                      fld_size  =  TREE_INT_CST_LOW  (DECL_SIZE  (field));                      if  (((fld_off  %  BITS_PER_UNIT)  !=  0)                              ||  ((fld_size  %  BITS_PER_UNIT)  !=  0))  {                              /*  As  of  now  it  crashes  compilation.                                    TODO:  handle  bit-­‐fields  as  if  touching  the  whole  field.    */                              return;                          }                  }          }      /*  TODO:  handle  other  cases            (FIELD_DECL,  MEM_REF,  ARRAY_RANGE_REF,  TARGET_MEM_REF,  ADDR_EXPR).    */      if  (tcode  !=  ARRAY_REF              &&  tcode  !=  VAR_DECL  &&  tcode  !=  COMPONENT_REF              &&  tcode  !=  INDIRECT_REF  &&  tcode  !=  MEM_REF)          return;      func_mops++;      stmt  =  gsi_stmt  (gsi);      loc  =  gimple_location  (stmt);      rhs  =  is_vptr_store  (stmt,  expr,  is_write);      if  (rhs  ==  NULL)          gs  =  instr_memory_access  (expr,  is_write);      else          gs  =  instr_vptr_update  (expr,  rhs);      set_location  (gs,  loc);      /*  Instrumentation  for  assignment  of  a  function  result            must  be  inserted  after  the  call.    Instrumentation  for            reads  of  function  arguments  must  be  inserted  before  the  call.            That's  because  the  call  can  contain  synchronization.    */      if  (is_gimple_call  (stmt)  &&  is_write)          gsi_insert_seq_after  (&gsi,  gs,  GSI_NEW_STMT);      else          gsi_insert_seq_before  (&gsi,  gs,  GSI_SAME_STMT);   }
  • 40. Luk et al. Pin: Building Customized Program Analysis Tools w/ Dynamic Instrumentation PLDI ‘05 “Pin compiles from one ISA directly into the same ISA without going through an intermediate format and stored in a software-based code cache” “only code residing in the code cache is executed - the original code is never executed.”
  • 41. Luk et al. Pin: Building Customized Program Analysis Tools w/ Dynamic Instrumentation PLDI ‘05 “Pin compiles from one ISA directly into the same ISA without going through an intermediate format” movl        $0x7,  -­‐0x8(%rbp) addl        $0x1,  -­‐0x8(%rbp) mov          -­‐0x8(%rbp),  %eax sub          $0x3,  %eax mov          %eax,  -­‐0x4(%rbp) mov          $0x4(%rbp),  %eax add          %eax,  -­‐0x8(%rbp) recordMemWrite(%rip,  -­‐0x8(%rbp)) recordMemWrite(%rip,  -­‐0x8(%rbp)) recordMemWrite(%rip,  -­‐0x4(%rbp)) recordMemWrite(%rip,  -­‐0x8(%rbp)) movl        $0x7,  -­‐0x8(%rbp) addl        $0x1,  -­‐0x8(%rbp) mov          -­‐0x8(%rbp),  %eax sub          $0x3,  %eax mov          %eax,  -­‐0x4(%rbp) mov          $0x4(%rbp),  %eax add          %eax,  -­‐0x8(%rbp)
  • 42. code rewriting push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq
  • 43. jump rewriting push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%wax   callq    0xdeadbeef   pop        %rbp   retq callq    0x400540  <bar>callq    0xdeadbeef
  • 44. jump rewriting push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0xdeadbeef   leaveq   retq
  • 45. jump rewriting push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   mov        $0x100,%edi   callq    0x400430  <malloc@plt>   mov        %rax,0x200ac8(%rip)   mov        $0x0,%eax   callq    0x400540  <bar>   pop        %rbp   retq push      %rbp   mov        %rsp,%rbp   sub        $0x10,%rsp   movq      $0x0,-­‐0x8(%rbp)   mov        -­‐0x8(%rbp),%rax   add        $0x1c,%rax   mov        %rax,0x200ae9(%rip)   mov        $0x0,%eax   callq    0x40052d  <baz>   leaveq   retq push      %rbp   mov        %rsp,%rbp   mov        0x200b10(%rip),%rax   movl      $0x2a,(%rax)   pop        %rbp   retq
  • 47. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 “which values are undefined (i.e. uninitialised, or derived from undefined values) and can thus detect dangerous uses of undefined values.” “which values are tainted (i.e. from an untrusted source,) and can thus detect dangerous uses of tainted values.” “which word values are array pointers, and from this can detect bounds errors.”
  • 48. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 One interesting group of DBA tools are those that use shadow values. These tools shadow, purely in software, every register and memory value with another value that says something about it. We call these shadow value tools.
  • 51. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 One interesting group of DBA tools are those that use shadow values. These tools shadow, purely in software, every register and memory value with another value that says something about it. We call these shadow value tools.
  • 54. 0xc000000 memcheck/mc_main.c set? set? set? set? set? set? set? set?valid?
  • 55. 0xc000000 memcheck/mc_main.c set? set? set? set? set? set? set? set?valid?
  • 56. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07
  • 57. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 disassemble-and- resynthesise: machine code is converted to an IR in which each instruction becomes one or more IR operations. This IR is instrumented and then converted back to machine code. copy-and-annotate: incoming instructions are copied through verbatim except for necessary control flow changes. Tools use the annotations to guide their instrumentation.
  • 58. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 “Pin provides no built-in support for [shadow memory], so tools must cope with the non-atomicity of loads/stores and shadow loads/stores themselves.”
 
 “Valgrind’s thread serialisation and asynchronous signal treatment frees shadow value tools from having to deal with this issue.”
  • 59. Luk et al. Pin: Building Customized Program Analysis Tools w/ Dynamic Instrumentation PLDI ‘05 “in Figure 7(b), Pin outperforms both DynamoRIO and Valgrind by a significant margin: on average, Valgrind slows the application down by 8.3 times […] and Pin by 2.5 times.”
  • 60. Pin: a “copy and annotate” system Lower overhead than the alternatives Close-to-the-metal instrumentation API Best for tracking control flow, rather than memory + + - Valgrind: a “disassemble and resynthsize” system Richer API and shadow memory allows for per-memory word metadata tracking Greater runtime overhead + -
  • 62. problem statement “What values did a piece of memory have over time?” “How does a value propagate through a running system?”
  • 63. Chow et al. Understanding Data Lifetime via Whole System Simulation USENIX Sec ‘04 TaintBochs tracks sensitive data by “tainting” it at the hardware level. Tainting information is then propagated across operating system, language, and application boundaries, permitting analysis of sensitive data handling at a whole system level.
  • 64. Chow et al. Understanding Data Lifetime via Whole System Simulation USENIX Sec ‘04 We have used TaintBochs to analyze sensitive data handling in several large, real world applications. Among these were Mozilla, Apache, and Perl, which are used to process millions of passwords, credit card numbers, etc. on a daily basis.
  • 65. Chow et al. Understanding Data Lifetime via Whole System Simulation USENIX Sec ‘04 “We must decide how operations in the system should affect shadow state. If two registers A and B are added, and one of them is tainted, is the register where the result are stored also tainted? We refer to the collective set of policies that decide this as the propagation policy.”
  • 66. Chow et al. Understanding Data Lifetime via Whole System Simulation USENIX Sec ‘04 “ Our basic propagation policy is simply that if any byte of any input value is tainted, then all bytes of the output are tainted. This policy is clearly conservative and errs on the side of tainting too much.”
  • 67. Chow et al. Understanding Data Lifetime via Whole System Simulation USENIX Sec ‘04 “ Sometimes tainted values are used by instructions as indexes into non-tainted memory (i.e. as an index into a lookup table).” For example, Linux routinely remaps keyboard device data through a lookup table before sending keystrokes to user programs. Thus, user programs never directly see the data read in from the keyboard device, only the non tainted values they index in the kernel’s key remapping table.”
  • 68. methodology shadow memory to track information flow time-traveling debugging to uncover relationship between tainted memory
  • 70. Slowinska & Bos: Pointless Tainting? Evaluating the Practicality of Pointer Tainting Eurosys ‘09
  • 71. Slowinska & Bos: Pointless Tainting? Evaluating the Practicality of Pointer Tainting Eurosys ‘09 “…in-depth analysis of the problems of pointer tainting on real systems which shows that it does not work against malware spying on users’ behaviour” “an analysis and evaluation of all known fixes to the problems that shows that they all have serious shortcomings.”
  • 72. Slowinska & Bos: Pointless Tainting? Evaluating the Practicality of Pointer Tainting Eurosys ‘09
  • 74. King et al. Debugging Operating Systems with Time-Traveling Virtual Machines Usenix ‘05 “Replay causes the virtual machine to transition through the same states as it went through during the original run” “A virtual machine can be replayed by starting from a checkpoint, then replaying all sources of nondeterminism […] the network, keyboard, clock, and timing of interrupts” Sequential
  • 75. problem statement “how to build a dynamic analysis tool that correctly runs in a concurrent environment?” “What challenges does concurrent software have that dynamic analysis could help with?”
  • 76. concurrent record & replay use locking operations as sequencing points use virtual memory page protection (come up with ideas for custom hardware)
  • 77. Nethercote et al. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation PLDI ‘07 “Valgrind serialises thread execution with a thread locking mechanism. Only the thread holding the lock can run,” “The kernel still chooses which thread is to run next, but Valgrind dictates when thread-switches occur and prevents more than one thread from running at a time.” “How to best overcome this problem remains an open research question.”
  • 78. Savage et al: Eraser: A Dynamic Data Race Detector for Multithreaded Programs SOSP ‘97
  • 79. Savage et al: Eraser: A Dynamic Data Race Detector for Multithreaded Programs SOSP ‘97 “Eraser instruments each call to acquire or release a lock”
  • 80. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08
  • 81. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08 “if two memory instructions on different processors access the same page, and one of them is a write, there will be a CREW event between the instructions on each processor.” • concurrent-read: All cpus have read permission, but none have write permission. • exclusive-write: One cpu (called the owner) has both read and write permission; all virtual cpus have no permission.
  • 82. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08 “we use hardware page protections, enforced by the memory management unit (MMU), which will check each read and write as the instruction executes, and cause a fault to the hypervisor on any violation.”
  • 83. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08 “if two memory instructions on different processors access the same page, and one of them is a write, there will be a CREW event between the instructions on each processor.” • concurrent-read: All cpus have read permission, but none have write permission. • exclusive-write: One cpu (called the owner) has both read and write permission; all virtual cpus have no permission.
  • 84. CREW limitations virtual memory hardware only operates on 4k blocks DMA not implemented in the paper 10x slowdown in the worst case!
  • 85.
  • 87. race detection techiques Lockset algorithm Happens-before relation Hybrid techniques
  • 88. examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces int  var;   void  Thread1()  {    //  Runs  in  one  thread.      var++;   }   void  Thread2()  {    //  Runs  in  another  thread.      var++;   }  
  • 89. examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces //  Ref()  and  Unref()  may  be  called  from  several  threads.   //  Last  Unref()  destroys  the  object.   class  RefCountedObject  {    ...    public:      void  Ref()  {          ref_++;    //  Bug!      }      void  Unref()  {          if  (-­‐-­‐ref_  ==  0)    //  Bug!  Need  to  use  atomic  decrement!              delete  this;      }    private:      int  ref_;   };
  • 90. examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces bool  done  =  false;   void  Thread1()  {      while  (!done)  {          do_something_useful_in_a_loop_1();      }        do_thread1_cleanup();   }   void  Thread2()  {      do_something_useful_2();      done  =  true;      do_thread2_cleanup();   }
  • 91. examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces bool  done  =  false;   void  Thread1()  {      while  (!done)  {          do_something_useful_in_a_loop_1();      }        do_thread1_cleanup();   }   void  Thread2()  {      do_something_useful_2();      done  =  true;      do_thread2_cleanup();   }
  • 92. examples from https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces bool  done  =  false;   void  Thread1()  {      while  (!done)  {          do_something_useful_in_a_loop_1();      }        do_thread1_cleanup();   }   void  Thread2()  {      done  =  true;      do_something_useful_2();      do_thread2_cleanup();   }
  • 93. “Eraser instruments each call to acquire or release a lock” “In order to reconstruct the state of shared memory, each processor must view writes to shared memory by other processors as asynchronous events. We therefore need to preserve the order of execution between the processors.”
  • 94. Savage et al: Eraser: A Dynamic Data Race Detector for Multithreaded Programs SOSP ‘97
  • 95. Savage et al: Eraser: A Dynamic Data Race Detector for Multithreaded Programs SOSP ‘97
  • 96. Lamport et al: Time, Locks and the Ordering of Events in a Distributed System CACM ‘78
  • 97. Lamport et al: Time, Locks and the Ordering of Events in a Distributed System CACM ‘78
  • 98. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08
  • 99. Dunlap et al: Execution Replay for Multiprocessor Virtual Machines VEE ‘08 “In order to reconstruct the state of shared memory, each processor must view writes to shared memory by other processors as asynchronous events. We therefore need to preserve the order of execution between the processors.” “Only reads and writes to shared memory need to be ordered with respect to each other"
  • 100. Savage et al: Eraser: A Dynamic Data Race Detector for Multithreaded Programs SOSP ‘97
  • 101. O’Callahan & Choi: Hybrid Dynamic Data Race Detection PPoPP ‘03 “Unfortunately violations of the lockset hypothesis are not always programming errors. One common example is programs which use channels to pass objects between threads in the style of CSP [15]. In such programs thread synchronization and mutual exclusion are accomplished by explicit signaling between threads.”
  • 102. Lockset - ensure >1 lock always protects shared me Doesn’t need to observe a bug happening to find a race False positives if different synchronization techniques used + - Happens-Before - shared accesses must be separated by a sync Causality def’n doesn’t require locks: fewer false positives Observing races depends on execution order Slower to run in practice than Lockset + - -
  • 103. Serebryany & Iskhodzhanov: ThreadSanitizer: data race detection in practice WBIA ‘12
  • 104. a hybrid approach Full happens-before tracking for synchronize operations Lockset approach to determine whether causally-related locksets are non-empty
  • 105. Serebryany & Iskhodzhanov: ThreadSanitizer: data race detection in practice WBIA ‘12
  • 106. Serebryany & Iskhodzhanov: ThreadSanitizer: data race detection in practice WBIA ‘12
  • 107. what have we seen Time-Traveling Debugging for reconstructing previous program state JIT instrumentation for efficient control flow modification Shadow memory for efficient memory introspection
  • 108. the trace is out there Novel and experimental hardware Query languages and storage for large trace data Trace visualization techniques