[pso] [Tema 3][Windows] Bsod aleator la IoGetDeviceObjectPointer
Vladimir-Andrei Olteanu
kooliva at gmail.com
Sat May 8 18:08:28 EEST 2010
Am rezolvat problema. Uitam sa "inchid" data->Disk*FileObject.
On 5/8/2010 5:01 PM, Vladimir-Andrei Olteanu wrote:
> Problema inca persista. Am incercat sa fac niste atribuiri
> variabilelor "data->Disk1FileObject" si "data->Disk1DeviceObject"
> pentru a forta aparitia unui BSOD inainte de IoGetDeviceObjectPointer
> in cazul in care "data" nu e alocata, dar BSOD-ul tot apare la apelul
> functiei. Analiza unui crash dump arata astfel:
>
> EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx"
> referenced memory at "0x%08lx". The memory could not be "%s".
>
> FAULTING_IP:
> nt!IoGetAttachedDevice+c
> 8081bb42 8b4810 mov ecx,dword ptr [eax+10h]
>
> TRAP_FRAME: f78ea820 -- (.trap 0xfffffffff78ea820)
> ErrCode = 00000000
> eax=0108070a ebx=821d92f8 ecx=0108070a edx=00000000 esi=822ceb18
> edi=827a2020
> eip=8081bb42 esp=f78ea894 ebp=f78ea894 iopl=0 nv up ei pl nz
> na pe nc
> cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000
> efl=00010206
> nt!IoGetAttachedDevice+0xc:
> 8081bb42 8b4810 mov ecx,dword ptr [eax+10h]
> ds:0023:0108071a=????????
> Resetting default scope
>
> DEFAULT_BUCKET_ID: DRIVER_FAULT
>
> BUGCHECK_STR: 0x8E
>
> PROCESS_NAME: System
>
> CURRENT_IRQL: 0
>
> LAST_CONTROL_TRANSFER: from 8082bbf0 to 80826dc7
>
> STACK_TEXT:
> f78ea3ec 8082bbf0 0000008e c0000005 8081bb42 nt!KeBugCheckEx+0x1b
> f78ea7b0 808843ca f78ea7cc 00000000 f78ea820 nt!KiDispatchException+0x3a2
> f78ea818 8088437e f78ea894 8081bb42 badb0d00
> nt!CommonDispatchException+0x4a
> f78ea838 80957d60 e1b2f8cc 827cf1d8 00000002 nt!Kei386EoiHelper+0x182
> f78ea894 808f08e7 822b37a8 f78eaa40 826e2690 nt!RtlpInheritAcl2+0xe2
> f78ea980 8092f71c 826e26a8 00000000 822ceb18 nt!IopParseDevice+0x401
> f78eaa00 8092b85c 00000000 f78eaa40 00000240 nt!ObpLookupObjectName+0x5b0
> f78eaa54 808e2de7 00000000 00000000 00000000 nt!ObOpenObjectByName+0xea
> f78eaad0 808e4081 f78eac4c 001f01ff f78eac24 nt!IopCreateFile+0x447
> f78eab2c 808e7c11 f78eac4c 001f01ff f78eac24 nt!IoCreateFile+0xa3
> f78eab6c 80883908 f78eac4c 001f01ff f78eac24 nt!NtOpenFile+0x27
> f78eab6c 8082d049 f78eac4c 001f01ff f78eac24 nt!KiFastCallEntry+0xf8
> f78eabfc 808e2f94 f78eac4c 001f01ff f78eac24 nt!ZwOpenFile+0x11
> f78eac44 f7828373 f78eac5c 001f01ff 822fa844
> nt!IoGetDeviceObjectPointer+0x40
> f78eac88 808eed5d 824413c8 82462000 00000000 ssr!DriverEntry+0x113
> [c:\cygwin\home\administrator\share\so2\ssr_main.c @ 154]
> f78ead58 808eee73 8000089c 00000001 00000000 nt!IopLoadDriver+0x689
> f78ead80 8087adc1 8000089c 00000000 827a2020 nt!IopLoadUnloadDriver+0x45
> f78eadac 809418f4 f65dfcf4 00000000 00000000 nt!ExpWorkerThread+0xeb
> f78eaddc 80887f4a 8087acd6 00000001 00000000
> nt!PspSystemThreadStartup+0x2e
> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>
>
> STACK_COMMAND: kb
>
> FOLLOWUP_IP:
> ssr!DriverEntry+113 [c:\cygwin\home\administrator\share\so2\ssr_main.c
> @ 154]
> f7828373 8945e8 mov dword ptr [ebp-18h],eax
>
> FAULTING_SOURCE_CODE:
> 150: device->Flags |= DO_DIRECT_IO;
> 151: data = (struct SSR_DATA *)device->DeviceExtension;
> 152:
> 153: ret = IoGetDeviceObjectPointer(&disk1UnicodeName,
> FILE_ALL_ACCESS,
> > 154: &data->Disk1FileObject, &data->Disk1DeviceObject);
> 155: if (!NT_SUCCESS(ret))
> 156: {
> 157: DbgPrint("Eroare la IoGetDeviceObjectPointer 1");
> 158: goto error;
> 159: }
>
>
> SYMBOL_STACK_INDEX: e
>
> SYMBOL_NAME: ssr!DriverEntry+113
>
> FOLLOWUP_NAME: MachineOwner
>
> MODULE_NAME: ssr
>
> IMAGE_NAME: ssr.sys
>
> DEBUG_FLR_IMAGE_TIMESTAMP: 4be569b9
>
> FAILURE_BUCKET_ID: 0x8E_ssr!DriverEntry+113
>
> BUCKET_ID: 0x8E_ssr!DriverEntry+113
>
> Followup: MachineOwner
> ---------
>
>
> On 5/8/2010 12:46 AM, Vladimir-Andrei Olteanu wrote:
>> Salut!
>>
>> Modulul meu imi da Bsod uneori cand apelez IoGetDeviceObjectPointer
>> (ceea ce ma duce cu gandul la parametri neinitializati).
>> Programul arata astfel:
>>
>> struct SSR_DATA
>> {
>> [...]
>> PFILE_OBJECT Disk1FileObject;
>> PDEVICE_OBJECT Disk1DeviceObject;
>> PFILE_OBJECT Disk2FileObject;
>> PDEVICE_OBJECT Disk2DeviceObject;
>> };
>>
>> [...]
>>
>> ret = IoCreateDevice(driver, sizeof(struct SSR_DATA) ...)
>> [...]
>> data = (struct SSR_DATA *)device->DeviceExtension;
>> ret = IoGetDeviceObjectPointer(&disk1UnicodeName, FILE_ALL_ACCESS,
>> &data->Disk1FileObject, &data->Disk1DeviceObject);
>> [...]
>>
>> Primul parametru l-am initializat cu
>> RtlInitUnicodeString(&disk1UnicodeName, PHYSICAL_DISK1_DEVICE_NAME)
>> si m-am asigurat ca disk1UnicodeName.Buffer nu e NULL.
>> Am verificat codurile de eroare, si IoCreateDevice se termina cu
>> succes, deci variabila data este alocata.
>>
>> Bsod-ul poate aparea de la oricare dintre cele doua apeluri ale
>> functiei IoGetDeviceObjectPointer, sau, uneori, nu apare deloc.
>>
>> Imi scapa ceva?
>>
>> Vlad
>
More information about the pso
mailing list