Debug Labs


Divide-By-Zero Exception in Component Code  

This lab will demonstrate an Integer Divide-By-Zero exception in a component. In this scenarion, a DBZ Exception in the ISAPI extension "badExt.dll".

This scenarion is presented in 2 variations, the 1st variation shows the exception in the main thread running the HTTPExtensionProc, while the second variation shows the exception in a spawned thread other than the main thread.

1- Lab Setup
	

Note: This lab assumes that you have already installed the necessary lab files to run it.

1- Verify the site is running in medium protection

2- Verify that the process "dllhost.exe" mapped to the out of process pooled application is running and note down its PID

To find the PID of the desired dllhost, do the follwing:

- Open Component Services

- Expand "Component Services" Node

- Expand "Computers" Node

- Expand "My Computer" Node

- Select "COM+ Applications"

- Click "Status View" icon and notice the PID column on the right hand pane

 

3- Attach windbg to the dllhost process with the PID found in step 2

a) Using the GUI:

- Click "File"

- Click "Attach to Process"

- Select "dllhost.exe" with the PID found in step 2 and click "OK"

b) Using the command prompt:

- Switch to thr folder where the debugging tools for windows is installed

- Type in "windbg -p <PID>" and hit Enter

4- In windbg command line, type in "g" with no quotation marks and press Enter

 

 

2- Run Scenario

1- Click the "Invoke Extension" button to load the ISAPI Extension in the dllhost process memory space. You should see the ISAPI extension "badExt.dll"among the list of modules loaded in dllhost.exe
2- Click the "Cause DBZ Exception V:1" button the first time to cause a 1st chance Integer Divide-By-Zero Exception in dllhost.exe.
 Note that the debugger breaks and diplays 
	a- Comments about the exception
b- The value of the registers
c- The module where the AV happened
d- The assembly line that caused the AV
3- To study the second variation of this lab, click the "Cause DBZ Exception V:2" button.

                                                                           

                                                                                         

1) Integer Divide-By-Zero Exception in the main thread running HttpExtensionProc:  (Variation 1)

1- Debug Annotation

 

1) Without symbols

 

a) The faulting Stack

 

The stack backtrace of the thread that caused the Divide-ByZero Exception would look like:

0:001>kvn50

Reloading current modules ..*** ERROR: Symbol file could not be found. Defaulted to export symbols for c:\inetpub\wwwroot\Prod\badext.dll -

...............................................

# ChildEBP RetAddr Args to Child

WARNING: Stack unwind information not available. Following frames may be wrong.

00 0088f708 01151529 00da1e90 00000001 00da1f5c badext!HttpExtensionProc+0x5cf

*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINNT\System32\inetsrv\wam.dll -

01 0088f728 65d82b06 00da1e90 00da1f5c 00da1e90 badext!HttpExtensionProc+0x1fe

02 0088f770 65d823a2 004077b0 00da2006 00da1e90 wam!SE_TABLE::ReleaseExtension+0xbe8

*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINNT\system32\RPCRT4.DLL -

03 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!SE_TABLE::ReleaseExtension+0x484

04 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!NdrServerInitialize+0x288

05 0088fa54 77d949ac 0009cf10 0009e0b8 0009a1a8 RPCRT4!NdrStubCall2+0x570

*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINNT\system32\ole32.dll -

06 0088fab8 77b29e7f 0009cf10 0009a1a8 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0x9e

07 0088fafc 77b29d6e 0009a1a8 000ad01c 0009f100 ole32!HDC_UserMarshal+0x78a

08 0088fb44 77aa7ae7 0009a1a8 000acf30 0009cf10 ole32!HDC_UserMarshal+0x679

09 0088fba8 77aa7a33 0009e0b8 00000000 0009cf10 ole32!CoGetCallContext+0x401

0a 0088fbc4 77b29c89 0009a1a8 00000001 0009cf10 ole32!CoGetCallContext+0x34d

0b 0088fbf4 77b29a89 0009a160 0009e0b8 0009cf10 ole32!HDC_UserMarshal+0x594

0c 0088fcb4 77b2a12c 000b1ba0 00000000 000ad000 ole32!HDC_UserMarshal+0x394

0d 0088fcf4 77d33721 0009a160 000ad000 00079af0 ole32!HDC_UserMarshal+0xa37

0e 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!I_RpcFree+0x1ff

0f 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!I_RpcFree+0x145

10 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!I_RpcFree+0x57

11 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RpcSsDestroyClientContext+0xa6

12 0088fe10 77d346c5 000a3958 00081df8 80030001 RPCRT4!NdrCorrelationFree+0x1120

13 0088fe28 77d422ff 000799f8 0088fe50 000a3958 RPCRT4!NdrCorrelationFree+0xc1f

14 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!NdrConformantArrayMemorySize+0x4c5

15 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!NdrConformantArrayMemorySize+0x29f

*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINNT\system32\KERNEL32.DLL -

16 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!NdrConformantArrayMemorySize+0x6a0

17 0088ffec 00000000 77d424c2 0007e7b8 00000000 KERNEL32!GetModuleFileNameA+0x1d1

 

In this stack backtrace, it is clear that the culprit is "badext.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help

from Microsoft, they should open an advisory case to troubleshoot the issue further.

 

b) The regiters values

 

0:001> r

eax=00000001 ebx=00000003 ecx=00000000 edx=00000000 esi=78002041 edi=00407848

eip=011518fa esp=0088f708 ebp=0088f708 iopl=0 nv up ei pl zr na po nc

cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00010246

badext!HttpExtensionProc+5cf:

011518fa f7f9 idiv ecx

 

 

c) The disassmbly code

 

0:001> u eip

badext!HttpExtensionProc+5cf:

011518fa f7f9 idiv ecx

011518fc eb1e jmp badext!HttpExtensionProc+0x5f1 (0115191c)

011518fe 837d0c02 cmp dword ptr [ebp+0xc],0x2

01151902 7515 jnz badext!HttpExtensionProc+0x5ee (01151919)

01151904 8d450c lea eax,[ebp+0xc] 01151907 50 push eax

01151908 33c0 xor eax,eax

0115190a 50 push eax

 

 

2) With symbols including public symbols of "badExt.dll"

 

 

First, we need to add the symbol path(company wide symbols) as well as public symbols of our dll

a) Using the GUI:

- Click "File"

- Click "Symbol File Path"

- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pub and hit Enter

b) Using the ".sympath+" command:

.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pub

 

 

Note: For more information on setting the symbol path for windbg, please refer to the debugger documentation for the .sympath command. This will describe

the "downstream store" feature that lets you download symbols to a symbol server of your own.

 

The stack backtrace of the thread that caused the DBZ exception would look like:

 

0:001> kvn50

# ChildEBP RetAddr Args to Child

00 0088f708 01151529 00da1e90 00000001 00da1f5c badext!doDZ1+0xf

01 0088f728 65d82b06 00da1e90 00da1f5c 00da1e90 badext!HttpExtensionProc+0x1fe

02 0088f73c 65d82a97 00da1e90 00da1f5c 00da1e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3])

03 0088f770 65d823a2 004077b0 00da2006 00da1e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo])

04 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo])

05 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30

06 0088fa54 77d949ac 0009cf10 0009e0b8 0009a1a8 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo])

07 0088fab8 77b29e7f 0009cf10 0009a1a8 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo])

08 0088fafc 77b29d6e 0009a1a8 000ad01c 0009f100 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo])

09 0088fb44 77aa7ae7 0009a1a8 000acf30 0009cf10 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo])

0a 0088fba8 77aa7a33 0009e0b8 00000000 0009cf10 ole32!CCtxComChnl::ContextInvoke+0xbd (FPO: [Non-Fpo])

0b 0088fbc4 77b29c89 0009a1a8 00000001 0009cf10 ole32!MTAInvoke+0x1a (FPO: [Non-Fpo])

0c 0088fbf4 77b29a89 0009a160 0009e0b8 0009cf10 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo])

0d 0088fcb4 77b2a12c 000b1ba0 00000000 000ad000 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo])

0e 0088fcf4 77d33721 0009a160 000ad000 00079af0 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo])

0f 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo])

10 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo])

11 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo])

12 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo])

13 0088fe10 77d346c5 000a3958 00081df8 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo])

14 0088fe28 77d422ff 000799f8 0088fe50 000a3958 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo])

15 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo])

16 0088ff78 77d42528 00081df8 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0])

17 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo])

18 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo])

19 0088ffec 00000000 77d424c2 0007e7b8 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo])

 

 

Now, with the public symbols lined up, we see that the last call that caused the Divide-By-Zero Exception was to the function "doDZ1" that was called from the ISAPI extension

entry point "HttpExtensionProc".

 

Again, In this call stack, it is clear that the culprit is "badext.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help

from Microsoft, they should open an advisory case to troubleshoot the issue further.

 

Advanced Technique

 

Notice also that the call to our extension was invoked by "wam.dll" (Web Application Manager). It is the component responsible for handing

over any request that needs to be processed by an ISAPI extension.

 

One way to see the http request passed to our extension is to dump the structure of "pWamExecInfo".

 

0:006> .frame 3

 

0:001> .frame3

03 0088f770 65d823a2 wam!WAM::InvokeExtension+0x35 [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

0:001> dv

this = 0

psExt = 004077b0

szISADllPath = 00da2006 "c:\inetpub\wwwroot\Prod\badext.dll"

pWamExecInfo = 00da1e90

ret = 0x406d40

0:001> dt pWamExecInfo -r

Local var @ 0x88f780 Type WAM_EXEC_INFO*

0x00da1e90

+0x000 ecb :

+0x000 cbSize : 0x90 +0x004 dwVersion : 0x40000

+0x008 ConnID : 0x00da1e90

+0x00c dwHttpStatusCode : 0xc8

+0x010 lpszLogData : [80] ""

+0x060 lpszMethod : 0x00da1ff0 "GET"

+0x064 lpszQueryString : 0x00da2029 "s=dz1_v1"

+0x068 lpszPathInfo : 0x00da1fdc ""

+0x06c lpszPathTranslated : 0x00da1fdd "c:\inetpub\wwwroot"

+0x070 cbTotalBytes : 0

+0x074 cbAvailable : 0

+0x078 lpbData : (null) +0x07c lpszContentType : 0x00da1ff4 ""

.....

.....

.....

 

To verify that the symbols are lined up properly for our extension, issue this command.

 

0:006> lmv mbadext

start end module name 06470000 06475000

badext (pdb symbols) C :\IISDebugLabs\symbols\Pub

Loaded symbol image file: C:\IISDebuglabs\www\App\badext.dll Image path: C:\IISDebuglabs\www\App\badext.dll

Timestamp: Wed Jan 29 18:07:14 2003 (3E385EA2)

Checksum: 0000EBCD

File version: 5.0.0.0

Product version: 5.0.0.0

File flags: 0 (Mask 3F)

File OS: 40004 NT Win32

File type: 2.0 Dll

File date: 00000000.00000000

CompanyName: Microsoft Corporation

ProductName: Internet Information Services

InternalName: badEXT.dll

OriginalFilename: badEXT.dll

ProductVersion: 5.00.0984

FileVersion: 5.00.0984

FileDescription: badEXT Test

LegalCopyright: Copyright (C) Microsoft Corp. 1981-1999

 

3) with Private Symbols "badExt.dll"

 

First, we need to add the symbol path(company wide symbols) as well as private symbols of our dll

a) Using the GUI:

- Click "File"

- Click "Symbol File Path"

- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pri and hit Enter

b) Using the ".sympath+" command:

.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pri

 

The stack backtrace of the thread that caused the DBZ would look like:

 

0:001> .reload;kvn50

.................................................

# ChildEBP RetAddr Args to Child

00 0088f708 01151529 00da1e90 00000001 00da1f5c badext!doDZ1+0xf (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 426]

01 0088f728 65d82b06 00da1e90 00da1f5c 00da1e90 badext!HttpExtensionProc+0x1fe (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 146]

02 0088f73c 65d82a97 00da1e90 00da1f5c 00da1e90 wam!HSE_APPDLL::ExecuteRequest+0x93 (FPO: [1,0,3]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\isplocal.cxx @ 450]

03 0088f770 65d823a2 004077b0 00da2006 00da1e90 wam!WAM::InvokeExtension+0x35 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 913]

04 0088f7b4 77d339c0 00406d40 00000000 000000e1 wam!WAM::ProcessRequest+0x240 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\wam\object\wamobj.cxx @ 643]

05 0088f7dc 77d93570 65d8223f 0088f7f8 00000005 RPCRT4!Invoke+0x30 [..\i386\stubless.asm @ 88]

06 0088fa54 77d949ac 0009cf10 0009e0b8 0009a1a8 RPCRT4!NdrStubCall2+0x63d (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\srvcall.c @ 1724]

07 0088fab8 77b29e7f 0009cf10 0009a1a8 0009e0b8 RPCRT4!CStdStubBuffer_Invoke+0xec (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\ndr20\stub.c @ 1571]

08 0088fafc 77b29d6e 0009a1a8 000ad01c 0009f100 ole32!SyncStubInvoke+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1136]

09 0088fb44 77aa7ae7 0009a1a8 000acf30 0009cf10 ole32!StubInvoke+0xa8 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1334]

0a 0088fba8 77aa7a33 0009e0b8 00000000 0009cf10 ole32!CCtxComChnl::ContextInvoke+0xbb (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\ctxchnl.cxx @ 1204]

0b 0088fbc4 77b29c89 0009a1a8 00000001 0009cf10 ole32!MTAInvoke+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\callctrl.cxx @ 1952]

0c 0088fbf4 77b29a89 0009a160 0009e0b8 0009cf10 ole32!AppInvoke+0xb5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1013]

0d 0088fcb4 77b2a12c 000b1ba0 00000000 000ad000 ole32!ComInvokeWithLockAndIPID+0x29e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 1578]

0e 0088fcf4 77d33721 0009a160 000ad000 00079af0 ole32!ThreadInvoke+0x1b7 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\channelb.cxx @ 3835]

0f 0088fd2c 77d33667 77b29f7b 00079af0 0088fe0c RPCRT4!DispatchToStubInC+0x84 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\dispatch.c @ 82]

10 0088fd84 77d33579 00000000 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x100 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 543]

11 0088fda4 77d48e81 00079af0 00000000 0088fe0c RPCRT4!RPC_INTERFACE::DispatchToStub+0x5e (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 407]

12 0088fdd4 77d34bc6 00079af0 00079ab4 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xa9 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 795]

13 0088fe10 77d346c5 000a3958 00081df8 80030001 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x1c6 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 2665]

14 0088fe28 77d422ff 000799f8 0088fe50 000a3958 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 867]

15 0088ff74 77d420d9 77d42528 00081df8 00070000 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x1eb (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 1175]

16 0088ff78 77d42528 00081df8 00070000 0006f740 RPCRT4!RecvLotsaCallsWrapper+0x9 (FPO: [1,0,0]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\lpcsvr.cxx @ 37]

17 0088ffa8 77d424da 00080f10 0088ffec 77e887dd RPCRT4!BaseCachedThreadRoutine+0x4f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\hndlsvr.cxx @ 3586]

18 0088ffb4 77e887dd 0007e7b8 00070000 0006f740 RPCRT4!ThreadStartRoutine+0x18 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\rpc\runtime\mtrt\threads.cxx @ 230]

19 0088ffec 00000000 77d424c2 0007e7b8 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\support.c @ 460]

 

 

 

Notice in frame OO and 01 the line of the code as well as the name and location of the source code. Going back to the source code in badext.cpp:

 

Line 146 looks like

 

DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *lpEcb)

{

.....

.....

if (!strncmp(szS, "av1", 3))

{

return doDZ1(lpEcb, Variation); //Line 146

}

.....

.....

}

 

Line 426 looks like

 

DWORD doDZ1(EXTENSION_CONTROL_BLOCK *lpEcb, int Variation)

{

dwThreadID;

HANDLE hThread;

 

if (Variation == 1)

{

int i = 0;

int j = 1;

j = j / i; //line 426

return j;

}

if (2 == Variation)

{

hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DBZ, NULL, 0, &dwThreadID);

}

return HSE_STATUS_SUCCESS;

}

 

 

1) Integer Divide-By-Zero Exception in a spawned thread: (Variation 2)

1- Debug Annotation

 

1) Without symbols

 

a) The faulting Stack

 

The stack backtrace of the thread that caused the Divide-ByZero Exception would look like:

 

0:031> kvn50

# ChildEBP RetAddr Args to Child

WARNING: Stack unwind information not available. Following frames may be wrong.

00 0222ffec 00000000 021e19b6 00000000 00000000 badext!HttpExtensionProc+0x691

 

 

In this stack backtrace, it is clear that the culprit is "badext.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help

from Microsoft, they should open an advisory case to troubleshoot the issue further.

 

b) The regiters values

 

 

0:031> r

eax=00000001 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=00000000

eip=021e19bc esp=0222ffb8 ebp=0222ffec iopl=0 nv up ei pl zr na po nc

cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246

badext!HttpExtensionProc+691:

021e19bc f7f9 idiv ecx

 

 

c) The disassmbly code

 

 

 

0:031> u eip

badext!HttpExtensionProc+691:

021e19bc f7f9 idiv ecx

021e19be c3 ret

021e19bf 56 push esi

021e19c0 6a00 push 0x0

021e19c2 6880000040 push 0x40000080

021e19c7 6a03 push 0x3

021e19c9 6a00 push 0x0

021e19cb 6a00 push 0x0

 

2) With symbols including public symbols of "badExt.dll"

 

First, we need to add the symbol path(company wide symbols) as well as symbols of our dll

 

0:001> .sympath+ \\symbols\symbols

Symbol search path is: \\symbols\symbols

0:001> .sympath+ c:\symbols\public (where public symbols of badExt.dll are located)

Symbol search path is: \\symbols\symbols;c:\symbols\public

The stack backtrace of the thread that caused the DBZ exception would look like:

 

 

0:031> kv

ChildEBP RetAddr Args to Child

0222ffec 00000000 021e19b6 00000000 00000000 badext!DBZ+0x6

 

 

Now, with the public symbols lined up, we see that the last call that caused the Divide-By-Zero Exception was to the function "DBZ()".

 

Again, In this call stack, it is clear that the culprit is "badext.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help

from Microsoft, they should open an advisory case to troubleshoot the issue further.

 

 

To verify that the symbols are lined up properly for our extension, issue this command.

 

0:006> lmv mbadext

start end module name 06470000 06475000

badext M (pdb symbols) c:\symbols\public\badext.pdb

Loaded symbol image file: C:\Inetpub\wwwroot\Dev\badext.dll Image path: C:\Inetpub\wwwroot\Dev\badext.dll

Timestamp: Wed Jan 29 18:07:14 2003 (3E385EA2)

Checksum: 0000EBCD

File version: 5.0.0.0

Product version: 5.0.0.0

File flags: 0 (Mask 3F)

File OS: 40004 NT Win32

File type: 2.0 Dll

File date: 00000000.00000000

CompanyName: Microsoft Corporation

ProductName: Internet Information Services

InternalName: badEXT.dll

OriginalFilename: badEXT.dll

ProductVersion: 5.00.0984

FileVersion: 5.00.0984

FileDescription: badEXT Test

LegalCopyright: Copyright (C) Microsoft Corp. 1981-1999

 

3) with Private Symbols "badExt.dll"

The stack backtrace of the thread that caused the DBZ would look like:

 

 

# ChildEBP RetAddr Args to Child

00 0222ffec 00000000 021e19b6 00000000 00000000 badext!DBZ+0x6 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\extDBG\badext.cpp @ 515]

 

 

Notice in frame OO and 01 the line of the code as well as the name and location of the source code. Going back to the source code in badext.cpp:

 

Line 515 looks like

 

 

DWORD DBZ()

{

int i = 0;

int j = 1;

j = j / i; //line 515

return j;

}


- Microsoft Confidential -