SlideShare uma empresa Scribd logo
1 de 38
Baixar para ler offline
Physical Memory Analysis
Dmitry Vostokov
Software Diagnostics ServicesFacebook LinkedIn Twitter
Prerequisites
Working knowledge of:
 WinDbg (installation, symbols)
 Basic user process dump analysis
 Basic kernel memory dump analysis
To Be Discussed Later
We use these boxes to
introduce useful vocabulary to
be discussed in later slides
© 2013 Software Diagnostics Services
Agenda (Summary)
 Basics
 Patterns
 Exercise
 Guide
© 2013 Software Diagnostics Services
Agenda (Basics)
 Dump generation
 Memory spaces
 Major challenges
 Common commands
© 2013 Software Diagnostics Services
Platform: Windows
Note: The pattern-oriented approach is
applicable to other OS through
different memory analysis pattern
implementations
© 2013 Software Diagnostics Services
Memory Analysis
© 2013 Software Diagnostics Services
Postmortem patterns
Live patterns
Dump Configuration
 Control Panel  System  Advanced system settings  Startup and Recovery
 Page file size should be greater than the amount of physical memory by a few MB
 For small system partitions or virtual disk systems: DedicatedDumpFile (KB969028)
 No complete memory dumps saved (+W7) WER services blog
 Page file preservation (+W8.1) Dev Center
To Be Discussed Later
Truncated Dump pattern
Manual Dump pattern
Troubleshooting note:
HKLM  SYSTEM  CurrentControlSet  Control  CrashControl
CrashDumpEnabled = 1 (DWORD)
© 2013 Software Diagnostics Services
Dump and Memory Acquisition
 Keyboard (KB972110, Step 6), NMI button
 Tools: NotMyFault (Step 5), SystemDump
 Killing a system process like csrss.exe (-W8.1)
 LiveKd (options for more consistency)
 Live debugging (.dump)
 Memory forensic tools
© 2013 Software Diagnostics Services
Physical Memory
© 2013 Software Diagnostics Services
a1
1
a2
2
3
a3
4
a4
b1
b2
b3
b4
5
6
7
8
GND
0
a1
1
a2
2
3
a3
4
a4
b1
b2
b3
b4
5
6
7
8
a1
1
a2
2
3
a3
4
a4
b1
b2
b3
b4
5
6
7
8
a1
1
a2
2
3
a3
4
a4
b1
b2
b3
b4
5
6
7
8
GND
0
Address 0
Address M
Virtual Process Memory
© 2013 Software Diagnostics Services
Address 0
Address M
Address 0
Address N
Virtual memory
Memory storage
Physical memory
Memory Spaces
 Complete memory == Physical memory
 We always see the current virtual process space
 Kernel space is the same
Context switch
To Be Discussed Later
WinDbg command to switch to
a different process context:
.process
© 2013 Software Diagnostics Services
Major Challenges
 Vast memory space to search
 Multiple processes (user spaces) to examine
 User space view needs to be correct when we examine another thread
 Huge file size (x64)
User Space
To Be Discussed Later
WinDbg extension command
to dump all stack traces:
!process 0 3f
© 2013 Software Diagnostics Services
The name borrowed from mathematics (topology)
Problem: mild freeze of a 128GB memory system
Solution: dump domain specific processes and generate a kernel memory dump
Fibre BundlesUser
Space
User
Space
User
Space
User
Space
User
Space
Kernel Space
To Be Discussed Later
Wait Chain patterns
© 2013 Software Diagnostics Services
Common Commands
 .logopen <file>
Opens a log file to save all subsequent output
 View commands
Dump everything or selected processes and threads (context changes automatically)
 Switch commands
Switch to a specific process or thread for a fine-grain analysis
© 2013 Software Diagnostics Services
View Commands
 !process 0 3f
Lists all processes (including times, environment, modules) and their thread stack traces
 !process 0 1f
The same as the previous command but without PEB information (more secure)
 !process <address> 3f or !process <address> 1f
The same as the previous commands but only for an individual process
 !thread <address> 1f
Shows thread information and stack trace
 !thread <address> 16
The same as the previous command but shows the first 3 parameters for every function
© 2013 Software Diagnostics Services
Switch Commands
 .process /r /p <address>
Switches to a specified process. Its context becomes current. Reloads symbol files for user space.
Now we can use commands like !cs
0: kd> .process /r /p fffffa80044d8b30
Implicit process is now fffffa80`044d8b30
Loading User Symbols
.................................
 .thread <address>
Switches to a specified thread. Assumes the current process context
Now we can use commands like k*
 .thread /r /p <address>
The same as the previous command but makes the thread process context current and reloads
symbol files for user space:
0: kd> .thread /r /p fffffa80051b7060
Implicit thread is now fffffa80`051b7060
Implicit process is now fffffa80`044d8b30
Loading User Symbols
.................................
To Be Discussed Later
x86 stack trace from WOW64
process:
.thread /w
© 2013 Software Diagnostics Services
Agenda (Patterns)
 Pattern-driven analysis
 Pattern classification
 Pattern examples
 Common mistakes
© 2013 Software Diagnostics Services
Pattern-driven Analysis
Information Collection
(Scripts)
Information Extraction
(Checklists)
Problem Identification
(Patterns)
Problem Resolution
Troubleshooting
Suggestions
Debugging Strategy
Note: we do not discuss BSOD crashes here as most of the time
kernel memory dumps are sufficient for analysis
Pattern: a common recurrent identifiable problem together with a set of
recommendations and possible solutions to apply in a specific context
© 2013 Software Diagnostics Services
Pattern Classes
 Blocked threads
 Wait chains
 Resource consumption
 Corruption signs
 Special processes
© 2013 Software Diagnostics Services
Pattern Classification
http://www.dumpanalysis.org/memory-dump-analysis-
pattern-classification
© 2013 Software Diagnostics Services
Example: Blocked Thread
THREAD fffffa80097f1660 Cid 154c.1570 Teb: 000007fffffd4000 Win32Thread: fffff900c06a83f0 WAIT: (WrUserRequest) UserMode Non-Alertable
fffffa800447e8f0 SynchronizationEvent
Not impersonating
DeviceMap fffff8a001ce6b90
Owning Process fffffa8004451060 Image: ApplicationA.exe
Attached Process N/A Image: N/A
Wait Start TickCount 22248 Ticks: 47 (0:00:00:00.733)
Context Switch Count 340 IdealProcessor: 1 LargeStack
UserTime 00:00:00.015
KernelTime 00:00:00.000
Win32 Start Address ApplicationA (0x000000013f2c1210)
Stack Init fffff8800ec25c70 Current fffff8800ec25730
Base fffff8800ec26000 Limit fffff8800ec1d000 Call 0
Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5
Child-SP RetAddr Call Site
fffff880`0ec25770 fffff800`02ee6f32 nt!KiSwapContext+0x7a
fffff880`0ec258b0 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2
fffff880`0ec25940 fffff960`0013bc97 nt!KeWaitForSingleObject+0x19f
fffff880`0ec259e0 fffff960`0013bd39 win32k!xxxRealSleepThread+0x257
fffff880`0ec25a80 fffff960`0014e7a6 win32k!xxxSleepThread+0x59
fffff880`0ec25ab0 fffff800`02ee0ed3 win32k!NtUserWaitMessage+0x46
fffff880`0ec25ae0 00000000`7709933a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0ec25ae0)
00000000`0275f308 00000000`770a4bc4 USER32!ZwUserWaitMessage+0xa
00000000`0275f310 00000000`770a4edd USER32!DialogBox2+0x274
00000000`0275f3a0 00000000`770f2920 USER32!InternalDialogBox+0x135
00000000`0275f400 00000000`770f1c15 USER32!SoftModalMessageBox+0x9b4
00000000`0275f530 00000000`770f146b USER32!MessageBoxWorker+0x31d
00000000`0275f6f0 00000000`770f1362 USER32!MessageBoxTimeoutW+0xb3
>>> 00000000`0275f7c0 00000001`3f2c1089 USER32!MessageBoxW+0x4e
00000000`0275f800 00000000`02135fd0 ApplicationA+0x1089
00000000`0275f808 00000000`00000000 0x2135fd0
To Be Discussed Later
Complete Dump Analysis
Exercise
© 2013 Software Diagnostics Services
Example: Wait Chain
THREAD fffffa8004514060 Cid 07f4.1470 Teb: 000007fffffae000 Win32Thread: 0000000000000000 WAIT: (UserRequest) UserMode Non-Alertable
>>> fffffa80044c53c0 Mutant - owning thread fffffa8004569750
Not impersonating
DeviceMap fffff8a001ce6b90
Owning Process fffffa8004546060 Image: ApplicationC.exe
Attached Process N/A Image: N/A
Wait Start TickCount 14474 Ticks: 7821 (0:00:02:02.008)
Context Switch Count 2 IdealProcessor: 1
UserTime 00:00:00.000
KernelTime 00:00:00.000
Win32 Start Address ApplicationC (0x000000013f6c12a0)
Stack Init fffff8800d196c70 Current fffff8800d1967c0
Base fffff8800d197000 Limit fffff8800d191000 Call 0
Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5
Child-SP RetAddr Call Site
fffff880`0d196800 fffff800`02ee6f32 nt!KiSwapContext+0x7a
fffff880`0d196940 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2
fffff880`0d1969d0 fffff800`031d844e nt!KeWaitForSingleObject+0x19f
fffff880`0d196a70 fffff800`02ee0ed3 nt!NtWaitForSingleObject+0xde
fffff880`0d196ae0 00000000`772f135a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0d196ae0)
00000000`0107f708 000007fe`fd9e10dc ntdll!NtWaitForSingleObject+0xa
00000000`0107f710 00000001`3f6c112e KERNELBASE!WaitForSingleObjectEx+0x79
00000000`0107f7b0 00000000`00586570 ApplicationC+0x112e
00000000`0107f7b8 00000000`00000000 0x586570
To Be Discussed Later
Complete Dump Analysis
Exercise
© 2013 Software Diagnostics Services
Example: Consumption
To Be Discussed Later
Complete Dump Analysis
Exercise
1: kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS fffffa80042d5400
SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 00187000 ObjectTable: fffff8a0000017e0 HandleCount: 785.
Image: System
PROCESS fffffa8006fa8750
SessionId: none Cid: 0144 Peb: 7fffffda000 ParentCid: 0004
DirBase: 107226000 ObjectTable: fffff8a0002dcf90 HandleCount: 32.
Image: smss.exe
PROCESS fffffa80083cdb30
SessionId: 0 Cid: 01ec Peb: 7fffffdc000 ParentCid: 01a8
DirBase: 918c1000 ObjectTable: fffff8a0013b98a0 HandleCount: 679.
Image: csrss.exe
[...]
PROCESS fffffa800442ab30
SessionId: 1 Cid: 1418 Peb: 7fffffde000 ParentCid: 0840
>>> DirBase: 11e2c5000 ObjectTable: fffff8a004cc3b50 HandleCount: 20014.
Image: ApplicationE.exe
[...]
© 2013 Software Diagnostics Services
Example: Corruption
THREAD fffffa80044e2720 Cid 06fc.15c0 Teb: 000007fffffae000 Win32Thread: 0000000000000000 WAIT: (UserRequest) UserMode Alertable
fffffa8009a5bb30 ProcessObject
Not impersonating
DeviceMap fffff8a001ce6b90
Owning Process fffffa8004364060 Image: ApplicationD.exe
[...]
Win32 Start Address ApplicationD (0x000000013f061318)
Stack Init fffff8800ec10c70 Current fffff8800ec107c0
Base fffff8800ec11000 Limit fffff8800ec0b000 Call 0
Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5
Child-SP RetAddr Call Site
fffff880`0ec10800 fffff800`02ee6f32 nt!KiSwapContext+0x7a
fffff880`0ec10940 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2
fffff880`0ec109d0 fffff800`031d844e nt!KeWaitForSingleObject+0x19f
fffff880`0ec10a70 fffff800`02ee0ed3 nt!NtWaitForSingleObject+0xde
fffff880`0ec10ae0 00000000`772f135a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0ec10ae0)
00000000`0071e7f8 00000000`77363062 ntdll!NtWaitForSingleObject+0xa
00000000`0071e800 00000000`773632a5 ntdll!RtlReportExceptionEx+0x1d2
00000000`0071e8f0 00000000`7736330a ntdll!RtlReportException+0xb5
00000000`0071e970 00000000`77364145 ntdll!RtlpTerminateFailureFilter+0x1a
00000000`0071e9a0 00000000`772b85a8 ntdll!RtlReportCriticalFailure+0x96
[...]
00000000`0071ea70 00000000`772b97a8 ntdll!RtlDispatchException+0x45a
00000000`0071f150 00000000`773640f2 ntdll!RtlRaiseException+0x22f
00000000`0071fb00 00000000`77364736 ntdll!RtlReportCriticalFailure+0x62
00000000`0071fbd0 00000000`77365942 ntdll!RtlpReportHeapFailure+0x26
00000000`0071fc00 00000000`773675f4 ntdll!RtlpHeapHandleError+0x12
00000000`0071fc30 00000000`7730dc8f ntdll!RtlpLogHeapFailure+0xa4
00000000`0071fc60 00000000`771a301a ntdll! ?? ::FNODOBFM::`string'+0x10c54
>>> 00000000`0071fce0 00000001`3f061274 kernel32!HeapFree+0xa
00000000`0071fd10 00000001`3f0610c3 ApplicationD+0x1274
[...]
To Be Discussed Later
Complete Dump Analysis
Exercise
© 2013 Software Diagnostics Services
Example: Special Process
1: kd> !vm
[...]
0458 svchost.exe 1922 ( 7688 Kb)
0bfc iexplore.exe 1891 ( 7564 Kb)
0bf4 msseces.exe 1863 ( 7452 Kb)
0fc8 NisSrv.exe 1845 ( 7380 Kb)
0584 StageRemoteSer 1776 ( 7104 Kb)
05dc spoolsv.exe 1729 ( 6916 Kb)
11e8 mscorsvw.exe 1620 ( 6480 Kb)
0c6c vmware-authd.e 1593 ( 6372 Kb)
02d8 services.exe 1560 ( 6240 Kb)
>>> 1134 WerFault.exe 1558 ( 6232 Kb)
0c1c StageRemote.ex 1518 ( 6072 Kb)
135c taskmgr.exe 1513 ( 6052 Kb)
0ea4 WmiPrvSE.exe 1411 ( 5644 Kb)
0350 svchost.exe 1283 ( 5132 Kb)
02e0 lsass.exe 1218 ( 4872 Kb)
03b8 svchost.exe 1214 ( 4856 Kb)
09b0 SftService.exe 1171 ( 4684 Kb)
13fc daemonu.exe 1117 ( 4468 Kb)
0b5c igfxpers.exe 1080 ( 4320 Kb)
080c DTLite.exe 1051 ( 4204 Kb)
1194 DTShellHlp.exe 1008 ( 4032 Kb)
04c8 taskhost.exe 975 ( 3900 Kb)
0b34 STService.exe 933 ( 3732 Kb)
0270 csrss.exe 855 ( 3420 Kb)
029c winlogon.exe 845 ( 3380 Kb)
[...]
To Be Discussed Later
Complete Dump Analysis
Exercise
© 2013 Software Diagnostics Services
Common Mistakes
 Not switching to the appropriate context
 Not looking at full stack traces
 Not looking at all stack traces
 Not using checklists
 Not looking past the first found evidence
 Not comparing to the reference debugger output
 Not doing explicit symbol qualification: module!symbol
Note: Listing both x86 and x64 stack traces (windbg.org)
.load wow64exts
!for_each_thread "!thread @#Thread 16;.thread /w @#Thread; .reload; kv 256; .effmach AMD64"
© 2013 Software Diagnostics Services
Agenda (Exercise)
 Run processes that model abnormal
behavior
 Generate a complete memory dump
 Analyze the memory dump
Note: Due to security concerns I’m not making a complete memory
dump downloadable. You can generate your own complete memory
dump after downloading and running model applications
© 2013 Software Diagnostics Services
Exercise: Run Processes
These processes model specific patterns:
ApplicationA , ApplicationB, ApplicationC, ApplicationD, ApplicationE
For demonstration I run x64 versions plus x86 version of ApplicationA
Note: Run applications in alphabetical order
Can be downloaded from this location:
http://www.patterndiagnostics.com/Training/Webinars/FCMDA-Examples.zip
There are x86 and x64 versions
© 2013 Software Diagnostics Services
Exercise: Force A Dump
The system is
x64 Windows 7
Note: Wait at least 10
seconds after running model
applications to have them
properly initialize their
dependencies
© 2013 Software Diagnostics Services
Exercise: Dump Analysis
Now I switch to a WinDbg session...
© 2013 Software Diagnostics Services
Agenda (Guide)
 Patterns related to complete memory
dumps
 Pattern cooperation case studies from
complete memory dumps
 Pattern Map
© 2013 Software Diagnostics Services
Pattern Examples
Some patterns that are relevant to complete memory dumps:
Incorrect Symbolic Information No System Dumps
Semantic Split Message Box
Paged Out Data Inconsistent Dump
Wait Chain (thread objects) Wait Chain (critical sections)
Wait Chain (LPC/ALPC) Wait Chain (process objects)
Last Error Collection Special Process
Suspended Thread Historical Information
Coupled Processes (strong) Stack Trace Collection
Truncated Dump Insufficient Memory (handle leak)
Spiking Thread Main Thread
Deadlock (critical sections) Suspended Thread
Problem Vocabulary Pleiades
Semantic Structures Dual Stack Trace
Virtualized System
© 2013 Software Diagnostics Services
Case Studies
17 pattern interaction case studies using complete
memory dumps:
http://www.dumpanalysis.org/blog/index.php/category/complete-memory-dump-analysis/
© 2013 Software Diagnostics Services
WinDbg Command Map
Pattern <-> WinDbg command
© 2013 Software Diagnostics Services
Reference Resources
 WinDbg.org
 DumpAnalysis.org
 Software Diagnostics Library
 Debugging TV
 Memory Dump Analysis Anthology (volumes 1 – 6)
Volume 7 is planned for January 2014
© 2013 Software Diagnostics Services
Training Resources
 Accelerated Windows Memory Dump Analysis, 3rd edition
 Advanced Windows Memory Dump Analysis with Data Structures,
2nd edition
 Accelerated Windows Malware Analysis with Memory Dumps
 Accelerated Windows Debugging3
© 2013 Software Diagnostics Services
Q&A
Please send your feedback using the contact
form on PatternDiagnostics.com
© 2013 Software Diagnostics Services
Thank you for attendance!
© 2013 Software Diagnostics Services
Facebook LinkedIn Twitter

Mais conteúdo relacionado

Mais procurados

Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)
Cdiscount
 
oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
mahdi ahmadi
 

Mais procurados (20)

Rac 12c optimization
Rac 12c optimizationRac 12c optimization
Rac 12c optimization
 
2013 london advanced-replication
2013 london advanced-replication2013 london advanced-replication
2013 london advanced-replication
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
pstack, truss etc to understand deeper issues in Oracle database
pstack, truss etc to understand deeper issues in Oracle databasepstack, truss etc to understand deeper issues in Oracle database
pstack, truss etc to understand deeper issues in Oracle database
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel Execution
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
Deep review of LMS process
Deep review of LMS processDeep review of LMS process
Deep review of LMS process
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)
 
Advanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkAdvanced RAC troubleshooting: Network
Advanced RAC troubleshooting: Network
 
WiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-TreeWiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-Tree
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015Character Encoding - MySQL DevRoom - FOSDEM 2015
Character Encoding - MySQL DevRoom - FOSDEM 2015
 
Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...Decompressed vmlinux: linux kernel initialization from page table configurati...
Decompressed vmlinux: linux kernel initialization from page table configurati...
 
oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
 
Tracing Parallel Execution (UKOUG 2006)
Tracing Parallel Execution (UKOUG 2006)Tracing Parallel Execution (UKOUG 2006)
Tracing Parallel Execution (UKOUG 2006)
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018 Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018
 
Managing data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBManaging data and operation distribution in MongoDB
Managing data and operation distribution in MongoDB
 

Semelhante a Fundamentals of Physical Memory Analysis

Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Jagadisha Maiya
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
Linaro
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Camilo Alvarez Rivera
 

Semelhante a Fundamentals of Physical Memory Analysis (20)

Accelerated Windows Memory Dump Analysis
Accelerated Windows Memory Dump AnalysisAccelerated Windows Memory Dump Analysis
Accelerated Windows Memory Dump Analysis
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
 
Accelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory DumpsAccelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory Dumps
 
Clear cache memory
Clear cache memoryClear cache memory
Clear cache memory
 
Analyzing OS X Systems Performance with the USE Method
Analyzing OS X Systems Performance with the USE MethodAnalyzing OS X Systems Performance with the USE Method
Analyzing OS X Systems Performance with the USE Method
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
 
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
Troubleshooting linux-kernel-modules-and-device-drivers-1233050713693744-1
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
Accelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesAccelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slides
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems Performance
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawn
 
embedded C.pptx
embedded C.pptxembedded C.pptx
embedded C.pptx
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
 
Data race
Data raceData race
Data race
 
Dask for Fast Distributed Batch Scoring of Computer Vision Workloads
Dask for Fast Distributed Batch Scoring of Computer Vision WorkloadsDask for Fast Distributed Batch Scoring of Computer Vision Workloads
Dask for Fast Distributed Batch Scoring of Computer Vision Workloads
 
01c. Starting A Router
01c.  Starting A  Router01c.  Starting A  Router
01c. Starting A Router
 
Interview questions
Interview questionsInterview questions
Interview questions
 

Mais de Dmitry Vostokov

Mais de Dmitry Vostokov (20)

Accelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slidesAccelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slides
 
Debugging TV Frame 0x1C
Debugging TV Frame 0x1CDebugging TV Frame 0x1C
Debugging TV Frame 0x1C
 
Debugging TV Frame 0x1A
Debugging TV Frame 0x1ADebugging TV Frame 0x1A
Debugging TV Frame 0x1A
 
Debugging TV Frame 0x34
Debugging TV Frame 0x34Debugging TV Frame 0x34
Debugging TV Frame 0x34
 
Debugging TV Frame 0x33
Debugging TV Frame 0x33Debugging TV Frame 0x33
Debugging TV Frame 0x33
 
Debugging TV Frame 0x31
Debugging TV Frame 0x31Debugging TV Frame 0x31
Debugging TV Frame 0x31
 
Debugging TV Frame 0x25
Debugging TV Frame 0x25Debugging TV Frame 0x25
Debugging TV Frame 0x25
 
Debugging TV Frame 0x24
Debugging TV Frame 0x24Debugging TV Frame 0x24
Debugging TV Frame 0x24
 
Debugging TV Frame 0x21
Debugging TV Frame 0x21Debugging TV Frame 0x21
Debugging TV Frame 0x21
 
Debugging TV Frame 0x20
Debugging TV Frame 0x20Debugging TV Frame 0x20
Debugging TV Frame 0x20
 
Debugging TV Frame 0x19
Debugging TV Frame 0x19Debugging TV Frame 0x19
Debugging TV Frame 0x19
 
Debugging TV Frame 0x18
Debugging TV Frame 0x18Debugging TV Frame 0x18
Debugging TV Frame 0x18
 
Debugging TV Frame 0x17
Debugging TV Frame 0x17Debugging TV Frame 0x17
Debugging TV Frame 0x17
 
Debugging TV Frame 0x16
Debugging TV Frame 0x16Debugging TV Frame 0x16
Debugging TV Frame 0x16
 
Debugging TV Frame 0x15
Debugging TV Frame 0x15Debugging TV Frame 0x15
Debugging TV Frame 0x15
 
Debugging TV Frame 0x14
Debugging TV Frame 0x14Debugging TV Frame 0x14
Debugging TV Frame 0x14
 
Debugging TV Frame 0x13
Debugging TV Frame 0x13Debugging TV Frame 0x13
Debugging TV Frame 0x13
 
Debugging TV Frame 0x12
Debugging TV Frame 0x12Debugging TV Frame 0x12
Debugging TV Frame 0x12
 
Debugging TV Frame 0x11
Debugging TV Frame 0x11Debugging TV Frame 0x11
Debugging TV Frame 0x11
 
Debugging TV Frame 0x10
Debugging TV Frame 0x10Debugging TV Frame 0x10
Debugging TV Frame 0x10
 

Último

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

Fundamentals of Physical Memory Analysis

  • 1. Physical Memory Analysis Dmitry Vostokov Software Diagnostics ServicesFacebook LinkedIn Twitter
  • 2. Prerequisites Working knowledge of:  WinDbg (installation, symbols)  Basic user process dump analysis  Basic kernel memory dump analysis To Be Discussed Later We use these boxes to introduce useful vocabulary to be discussed in later slides © 2013 Software Diagnostics Services
  • 3. Agenda (Summary)  Basics  Patterns  Exercise  Guide © 2013 Software Diagnostics Services
  • 4. Agenda (Basics)  Dump generation  Memory spaces  Major challenges  Common commands © 2013 Software Diagnostics Services
  • 5. Platform: Windows Note: The pattern-oriented approach is applicable to other OS through different memory analysis pattern implementations © 2013 Software Diagnostics Services
  • 6. Memory Analysis © 2013 Software Diagnostics Services Postmortem patterns Live patterns
  • 7. Dump Configuration  Control Panel System Advanced system settings Startup and Recovery  Page file size should be greater than the amount of physical memory by a few MB  For small system partitions or virtual disk systems: DedicatedDumpFile (KB969028)  No complete memory dumps saved (+W7) WER services blog  Page file preservation (+W8.1) Dev Center To Be Discussed Later Truncated Dump pattern Manual Dump pattern Troubleshooting note: HKLM SYSTEM CurrentControlSet Control CrashControl CrashDumpEnabled = 1 (DWORD) © 2013 Software Diagnostics Services
  • 8. Dump and Memory Acquisition  Keyboard (KB972110, Step 6), NMI button  Tools: NotMyFault (Step 5), SystemDump  Killing a system process like csrss.exe (-W8.1)  LiveKd (options for more consistency)  Live debugging (.dump)  Memory forensic tools © 2013 Software Diagnostics Services
  • 9. Physical Memory © 2013 Software Diagnostics Services a1 1 a2 2 3 a3 4 a4 b1 b2 b3 b4 5 6 7 8 GND 0 a1 1 a2 2 3 a3 4 a4 b1 b2 b3 b4 5 6 7 8 a1 1 a2 2 3 a3 4 a4 b1 b2 b3 b4 5 6 7 8 a1 1 a2 2 3 a3 4 a4 b1 b2 b3 b4 5 6 7 8 GND 0 Address 0 Address M
  • 10. Virtual Process Memory © 2013 Software Diagnostics Services Address 0 Address M Address 0 Address N Virtual memory Memory storage Physical memory
  • 11. Memory Spaces  Complete memory == Physical memory  We always see the current virtual process space  Kernel space is the same Context switch To Be Discussed Later WinDbg command to switch to a different process context: .process © 2013 Software Diagnostics Services
  • 12. Major Challenges  Vast memory space to search  Multiple processes (user spaces) to examine  User space view needs to be correct when we examine another thread  Huge file size (x64) User Space To Be Discussed Later WinDbg extension command to dump all stack traces: !process 0 3f © 2013 Software Diagnostics Services
  • 13. The name borrowed from mathematics (topology) Problem: mild freeze of a 128GB memory system Solution: dump domain specific processes and generate a kernel memory dump Fibre BundlesUser Space User Space User Space User Space User Space Kernel Space To Be Discussed Later Wait Chain patterns © 2013 Software Diagnostics Services
  • 14. Common Commands  .logopen <file> Opens a log file to save all subsequent output  View commands Dump everything or selected processes and threads (context changes automatically)  Switch commands Switch to a specific process or thread for a fine-grain analysis © 2013 Software Diagnostics Services
  • 15. View Commands  !process 0 3f Lists all processes (including times, environment, modules) and their thread stack traces  !process 0 1f The same as the previous command but without PEB information (more secure)  !process <address> 3f or !process <address> 1f The same as the previous commands but only for an individual process  !thread <address> 1f Shows thread information and stack trace  !thread <address> 16 The same as the previous command but shows the first 3 parameters for every function © 2013 Software Diagnostics Services
  • 16. Switch Commands  .process /r /p <address> Switches to a specified process. Its context becomes current. Reloads symbol files for user space. Now we can use commands like !cs 0: kd> .process /r /p fffffa80044d8b30 Implicit process is now fffffa80`044d8b30 Loading User Symbols .................................  .thread <address> Switches to a specified thread. Assumes the current process context Now we can use commands like k*  .thread /r /p <address> The same as the previous command but makes the thread process context current and reloads symbol files for user space: 0: kd> .thread /r /p fffffa80051b7060 Implicit thread is now fffffa80`051b7060 Implicit process is now fffffa80`044d8b30 Loading User Symbols ................................. To Be Discussed Later x86 stack trace from WOW64 process: .thread /w © 2013 Software Diagnostics Services
  • 17. Agenda (Patterns)  Pattern-driven analysis  Pattern classification  Pattern examples  Common mistakes © 2013 Software Diagnostics Services
  • 18. Pattern-driven Analysis Information Collection (Scripts) Information Extraction (Checklists) Problem Identification (Patterns) Problem Resolution Troubleshooting Suggestions Debugging Strategy Note: we do not discuss BSOD crashes here as most of the time kernel memory dumps are sufficient for analysis Pattern: a common recurrent identifiable problem together with a set of recommendations and possible solutions to apply in a specific context © 2013 Software Diagnostics Services
  • 19. Pattern Classes  Blocked threads  Wait chains  Resource consumption  Corruption signs  Special processes © 2013 Software Diagnostics Services
  • 21. Example: Blocked Thread THREAD fffffa80097f1660 Cid 154c.1570 Teb: 000007fffffd4000 Win32Thread: fffff900c06a83f0 WAIT: (WrUserRequest) UserMode Non-Alertable fffffa800447e8f0 SynchronizationEvent Not impersonating DeviceMap fffff8a001ce6b90 Owning Process fffffa8004451060 Image: ApplicationA.exe Attached Process N/A Image: N/A Wait Start TickCount 22248 Ticks: 47 (0:00:00:00.733) Context Switch Count 340 IdealProcessor: 1 LargeStack UserTime 00:00:00.015 KernelTime 00:00:00.000 Win32 Start Address ApplicationA (0x000000013f2c1210) Stack Init fffff8800ec25c70 Current fffff8800ec25730 Base fffff8800ec26000 Limit fffff8800ec1d000 Call 0 Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5 Child-SP RetAddr Call Site fffff880`0ec25770 fffff800`02ee6f32 nt!KiSwapContext+0x7a fffff880`0ec258b0 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2 fffff880`0ec25940 fffff960`0013bc97 nt!KeWaitForSingleObject+0x19f fffff880`0ec259e0 fffff960`0013bd39 win32k!xxxRealSleepThread+0x257 fffff880`0ec25a80 fffff960`0014e7a6 win32k!xxxSleepThread+0x59 fffff880`0ec25ab0 fffff800`02ee0ed3 win32k!NtUserWaitMessage+0x46 fffff880`0ec25ae0 00000000`7709933a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0ec25ae0) 00000000`0275f308 00000000`770a4bc4 USER32!ZwUserWaitMessage+0xa 00000000`0275f310 00000000`770a4edd USER32!DialogBox2+0x274 00000000`0275f3a0 00000000`770f2920 USER32!InternalDialogBox+0x135 00000000`0275f400 00000000`770f1c15 USER32!SoftModalMessageBox+0x9b4 00000000`0275f530 00000000`770f146b USER32!MessageBoxWorker+0x31d 00000000`0275f6f0 00000000`770f1362 USER32!MessageBoxTimeoutW+0xb3 >>> 00000000`0275f7c0 00000001`3f2c1089 USER32!MessageBoxW+0x4e 00000000`0275f800 00000000`02135fd0 ApplicationA+0x1089 00000000`0275f808 00000000`00000000 0x2135fd0 To Be Discussed Later Complete Dump Analysis Exercise © 2013 Software Diagnostics Services
  • 22. Example: Wait Chain THREAD fffffa8004514060 Cid 07f4.1470 Teb: 000007fffffae000 Win32Thread: 0000000000000000 WAIT: (UserRequest) UserMode Non-Alertable >>> fffffa80044c53c0 Mutant - owning thread fffffa8004569750 Not impersonating DeviceMap fffff8a001ce6b90 Owning Process fffffa8004546060 Image: ApplicationC.exe Attached Process N/A Image: N/A Wait Start TickCount 14474 Ticks: 7821 (0:00:02:02.008) Context Switch Count 2 IdealProcessor: 1 UserTime 00:00:00.000 KernelTime 00:00:00.000 Win32 Start Address ApplicationC (0x000000013f6c12a0) Stack Init fffff8800d196c70 Current fffff8800d1967c0 Base fffff8800d197000 Limit fffff8800d191000 Call 0 Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5 Child-SP RetAddr Call Site fffff880`0d196800 fffff800`02ee6f32 nt!KiSwapContext+0x7a fffff880`0d196940 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2 fffff880`0d1969d0 fffff800`031d844e nt!KeWaitForSingleObject+0x19f fffff880`0d196a70 fffff800`02ee0ed3 nt!NtWaitForSingleObject+0xde fffff880`0d196ae0 00000000`772f135a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0d196ae0) 00000000`0107f708 000007fe`fd9e10dc ntdll!NtWaitForSingleObject+0xa 00000000`0107f710 00000001`3f6c112e KERNELBASE!WaitForSingleObjectEx+0x79 00000000`0107f7b0 00000000`00586570 ApplicationC+0x112e 00000000`0107f7b8 00000000`00000000 0x586570 To Be Discussed Later Complete Dump Analysis Exercise © 2013 Software Diagnostics Services
  • 23. Example: Consumption To Be Discussed Later Complete Dump Analysis Exercise 1: kd> !process 0 0 **** NT ACTIVE PROCESS DUMP **** PROCESS fffffa80042d5400 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000 DirBase: 00187000 ObjectTable: fffff8a0000017e0 HandleCount: 785. Image: System PROCESS fffffa8006fa8750 SessionId: none Cid: 0144 Peb: 7fffffda000 ParentCid: 0004 DirBase: 107226000 ObjectTable: fffff8a0002dcf90 HandleCount: 32. Image: smss.exe PROCESS fffffa80083cdb30 SessionId: 0 Cid: 01ec Peb: 7fffffdc000 ParentCid: 01a8 DirBase: 918c1000 ObjectTable: fffff8a0013b98a0 HandleCount: 679. Image: csrss.exe [...] PROCESS fffffa800442ab30 SessionId: 1 Cid: 1418 Peb: 7fffffde000 ParentCid: 0840 >>> DirBase: 11e2c5000 ObjectTable: fffff8a004cc3b50 HandleCount: 20014. Image: ApplicationE.exe [...] © 2013 Software Diagnostics Services
  • 24. Example: Corruption THREAD fffffa80044e2720 Cid 06fc.15c0 Teb: 000007fffffae000 Win32Thread: 0000000000000000 WAIT: (UserRequest) UserMode Alertable fffffa8009a5bb30 ProcessObject Not impersonating DeviceMap fffff8a001ce6b90 Owning Process fffffa8004364060 Image: ApplicationD.exe [...] Win32 Start Address ApplicationD (0x000000013f061318) Stack Init fffff8800ec10c70 Current fffff8800ec107c0 Base fffff8800ec11000 Limit fffff8800ec0b000 Call 0 Priority 11 BasePriority 8 UnusualBoost 0 ForegroundBoost 2 IoPriority 2 PagePriority 5 Child-SP RetAddr Call Site fffff880`0ec10800 fffff800`02ee6f32 nt!KiSwapContext+0x7a fffff880`0ec10940 fffff800`02ee974f nt!KiCommitThreadWait+0x1d2 fffff880`0ec109d0 fffff800`031d844e nt!KeWaitForSingleObject+0x19f fffff880`0ec10a70 fffff800`02ee0ed3 nt!NtWaitForSingleObject+0xde fffff880`0ec10ae0 00000000`772f135a nt!KiSystemServiceCopyEnd+0x13 (TrapFrame @ fffff880`0ec10ae0) 00000000`0071e7f8 00000000`77363062 ntdll!NtWaitForSingleObject+0xa 00000000`0071e800 00000000`773632a5 ntdll!RtlReportExceptionEx+0x1d2 00000000`0071e8f0 00000000`7736330a ntdll!RtlReportException+0xb5 00000000`0071e970 00000000`77364145 ntdll!RtlpTerminateFailureFilter+0x1a 00000000`0071e9a0 00000000`772b85a8 ntdll!RtlReportCriticalFailure+0x96 [...] 00000000`0071ea70 00000000`772b97a8 ntdll!RtlDispatchException+0x45a 00000000`0071f150 00000000`773640f2 ntdll!RtlRaiseException+0x22f 00000000`0071fb00 00000000`77364736 ntdll!RtlReportCriticalFailure+0x62 00000000`0071fbd0 00000000`77365942 ntdll!RtlpReportHeapFailure+0x26 00000000`0071fc00 00000000`773675f4 ntdll!RtlpHeapHandleError+0x12 00000000`0071fc30 00000000`7730dc8f ntdll!RtlpLogHeapFailure+0xa4 00000000`0071fc60 00000000`771a301a ntdll! ?? ::FNODOBFM::`string'+0x10c54 >>> 00000000`0071fce0 00000001`3f061274 kernel32!HeapFree+0xa 00000000`0071fd10 00000001`3f0610c3 ApplicationD+0x1274 [...] To Be Discussed Later Complete Dump Analysis Exercise © 2013 Software Diagnostics Services
  • 25. Example: Special Process 1: kd> !vm [...] 0458 svchost.exe 1922 ( 7688 Kb) 0bfc iexplore.exe 1891 ( 7564 Kb) 0bf4 msseces.exe 1863 ( 7452 Kb) 0fc8 NisSrv.exe 1845 ( 7380 Kb) 0584 StageRemoteSer 1776 ( 7104 Kb) 05dc spoolsv.exe 1729 ( 6916 Kb) 11e8 mscorsvw.exe 1620 ( 6480 Kb) 0c6c vmware-authd.e 1593 ( 6372 Kb) 02d8 services.exe 1560 ( 6240 Kb) >>> 1134 WerFault.exe 1558 ( 6232 Kb) 0c1c StageRemote.ex 1518 ( 6072 Kb) 135c taskmgr.exe 1513 ( 6052 Kb) 0ea4 WmiPrvSE.exe 1411 ( 5644 Kb) 0350 svchost.exe 1283 ( 5132 Kb) 02e0 lsass.exe 1218 ( 4872 Kb) 03b8 svchost.exe 1214 ( 4856 Kb) 09b0 SftService.exe 1171 ( 4684 Kb) 13fc daemonu.exe 1117 ( 4468 Kb) 0b5c igfxpers.exe 1080 ( 4320 Kb) 080c DTLite.exe 1051 ( 4204 Kb) 1194 DTShellHlp.exe 1008 ( 4032 Kb) 04c8 taskhost.exe 975 ( 3900 Kb) 0b34 STService.exe 933 ( 3732 Kb) 0270 csrss.exe 855 ( 3420 Kb) 029c winlogon.exe 845 ( 3380 Kb) [...] To Be Discussed Later Complete Dump Analysis Exercise © 2013 Software Diagnostics Services
  • 26. Common Mistakes  Not switching to the appropriate context  Not looking at full stack traces  Not looking at all stack traces  Not using checklists  Not looking past the first found evidence  Not comparing to the reference debugger output  Not doing explicit symbol qualification: module!symbol Note: Listing both x86 and x64 stack traces (windbg.org) .load wow64exts !for_each_thread "!thread @#Thread 16;.thread /w @#Thread; .reload; kv 256; .effmach AMD64" © 2013 Software Diagnostics Services
  • 27. Agenda (Exercise)  Run processes that model abnormal behavior  Generate a complete memory dump  Analyze the memory dump Note: Due to security concerns I’m not making a complete memory dump downloadable. You can generate your own complete memory dump after downloading and running model applications © 2013 Software Diagnostics Services
  • 28. Exercise: Run Processes These processes model specific patterns: ApplicationA , ApplicationB, ApplicationC, ApplicationD, ApplicationE For demonstration I run x64 versions plus x86 version of ApplicationA Note: Run applications in alphabetical order Can be downloaded from this location: http://www.patterndiagnostics.com/Training/Webinars/FCMDA-Examples.zip There are x86 and x64 versions © 2013 Software Diagnostics Services
  • 29. Exercise: Force A Dump The system is x64 Windows 7 Note: Wait at least 10 seconds after running model applications to have them properly initialize their dependencies © 2013 Software Diagnostics Services
  • 30. Exercise: Dump Analysis Now I switch to a WinDbg session... © 2013 Software Diagnostics Services
  • 31. Agenda (Guide)  Patterns related to complete memory dumps  Pattern cooperation case studies from complete memory dumps  Pattern Map © 2013 Software Diagnostics Services
  • 32. Pattern Examples Some patterns that are relevant to complete memory dumps: Incorrect Symbolic Information No System Dumps Semantic Split Message Box Paged Out Data Inconsistent Dump Wait Chain (thread objects) Wait Chain (critical sections) Wait Chain (LPC/ALPC) Wait Chain (process objects) Last Error Collection Special Process Suspended Thread Historical Information Coupled Processes (strong) Stack Trace Collection Truncated Dump Insufficient Memory (handle leak) Spiking Thread Main Thread Deadlock (critical sections) Suspended Thread Problem Vocabulary Pleiades Semantic Structures Dual Stack Trace Virtualized System © 2013 Software Diagnostics Services
  • 33. Case Studies 17 pattern interaction case studies using complete memory dumps: http://www.dumpanalysis.org/blog/index.php/category/complete-memory-dump-analysis/ © 2013 Software Diagnostics Services
  • 34. WinDbg Command Map Pattern <-> WinDbg command © 2013 Software Diagnostics Services
  • 35. Reference Resources  WinDbg.org  DumpAnalysis.org  Software Diagnostics Library  Debugging TV  Memory Dump Analysis Anthology (volumes 1 – 6) Volume 7 is planned for January 2014 © 2013 Software Diagnostics Services
  • 36. Training Resources  Accelerated Windows Memory Dump Analysis, 3rd edition  Advanced Windows Memory Dump Analysis with Data Structures, 2nd edition  Accelerated Windows Malware Analysis with Memory Dumps  Accelerated Windows Debugging3 © 2013 Software Diagnostics Services
  • 37. Q&A Please send your feedback using the contact form on PatternDiagnostics.com © 2013 Software Diagnostics Services
  • 38. Thank you for attendance! © 2013 Software Diagnostics Services Facebook LinkedIn Twitter