Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spooky Scenarios in Debugging: Whom Do You Trust?

MD
October 16, 2019

Spooky Scenarios in Debugging: Whom Do You Trust?

Seattle Test in Production Meetup, hosted by LaunchDarkly. Presenter: Rick Zucker, SRE Manager

MD

October 16, 2019
Tweet

Other Decks in Technology

Transcript

  1. • C3I system ◦ POC for military using personal computers

    in the field • Communication link software ◦ Packet creation, processing, routing • System written in Pascal (UCSD P-System) Scenario #1 - Situation
  2. • System wasn't working right • No debugger - lots

    of print statements Scenario #1 - continued
  3. • System wasn't working right • No debugger - lots

    of print statements • Packets were getting corrupted Scenario #1 - continued
  4. • System wasn't working right • No debugger - lots

    of print statements • Packets were getting corrupted • Packet was corrupted despite no assignment statement to the variable between print statements Scenario #1 - continued
  5. • UCSD Pascal has 255 character variable names, but only

    first eight matter ◦ DataPktTx and DataPktRx are two distinct variables Scenario #1 - solution
  6. • UCSD Pascal has 255 character variable names, but only

    first eight matter ◦ DataPktTx and DataPktRx are two distinct variables • System had a two pass compiler ◦ Pascal compiler Scenario #1 - continued (2)
  7. • UCSD Pascal has 255 character variable names, but only

    first eight matter ◦ DataPktTx and DataPktRx are two distinct variables • System had a two pass compiler ◦ Pascal compiler ◦ Fortran linker Scenario #1 - continued (2)
  8. • UCSD Pascal has 255 character variable names, but only

    first eight matter ◦ DataPktTx and DataPktRx are two distinct variables • System had a two pass compiler ◦ Pascal compiler ◦ Fortran linker • Fortran only allows six character variable names Scenario #1 - continued (2)
  9. • UCSD Pascal has 255 character variable names, but only

    first eight matter ◦ DataPktTx and DataPktRx are two distinct variables • System had a two pass compiler ◦ Pascal compiler ◦ Fortran linker • Fortran only allows six character variable names ◦ Linker mapped the two variables on top of each other Scenario #1 - continued (2)
  10. • Be careful about what you take for granted ◦

    Eventually you may have to doubt the basics • Be careful when combining two pieces of software • Notice everything Scenario #1 - Lesson
  11. • QA of a CPU chip design • Focused on

    memory sub-system • Stressed memory in unnatural ways • Pre-silicon testing ◦ Run on software simulation ◦ ~10 Hz (very slow!) Scenario #2 - Situation
  12. • Write happening to wrong address ◦ Off by three

    bytes ◦ QA test had deliberately misaligned the data ▪ Not supposed to be on 32 bit boundary Scenario #2 - continued 32 bit words aligned on "normal" four byte boundaries in a 32 byte cache line
  13. • Write happening to wrong address ◦ Off by three

    bytes ◦ QA test had deliberately misaligned the data ▪ Not supposed to be on 32 bit boundary Scenario #2 - continued 32 bit words misaligned
  14. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  15. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  16. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  17. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  18. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  19. Simple CPU Pipeline Diagram Main Memory (simulated) Instruction Fetch Instruction

    Decode Address Generation Memory Cluster Bus Cluster
  20. • Check object file. Wrong address. ◦ Assembler generated wrong

    address. Assembler bug! Scenario #2 - continued
  21. • Be careful about what you take for granted •

    As always, consider corner cases, and behaviors not recommended, but permitted (QA credo!) • Notice everything Scenario #2 - Lesson
  22. • @securelyfitz designed device to securely wipe flash drives •

    Device has: ◦ USB interface ◦ Serial interface (for programming) ◦ Onboard micro-controller How paranoid should you be? An example
  23. What do you trust? Trust Don't Trust Serial Cable X

    Microcontroller X IDE/Compiler X Package was not signed and site used http, not https
  24. What do you trust? Trust Don't Trust Serial Cable X

    Microcontroller X IDE/Compiler X Didn't trust IDE/Compiler, so didn't produce device. Ultimate release block.
  25. • How much do you trust your supply chain? •

    If device is to be secure, where might bad actors take over? ◦ What can you control and trust? Lessons Learned
  26. • Some problems are in places that you would never

    suspect. Eventually you may have to go there. • Start normally, but eventually be as skeptical as a security expert • Tools are not perfect and are not totally trustworthy Conclusions