Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetKvm: 'm_VirtQueue' NULL pointer dereference #1197

Closed
wangyan0507 opened this issue Nov 20, 2024 · 14 comments
Closed

NetKvm: 'm_VirtQueue' NULL pointer dereference #1197

wangyan0507 opened this issue Nov 20, 2024 · 14 comments

Comments

@wangyan0507
Copy link

wangyan0507 commented Nov 20, 2024

Describe the bug
Open windows ‘verifier’ for Netkvm, I found a blue screen when starting the windows virtual machine.
The code as follows:

ParaNdis_PowerOn
    ->pContext->CXPath.Renew()
        ->CVirtQueue::Renew()
            ->status = virtio_find_queue()
                -> allocate memory failed, return error
            ->if (!NT_SUCCESS(status))
                ->m_VirtQueue = nullptr;  // Now, m_VirtQueue is NULL.
    ->ParaNdis_RestoreDeviceConfigurationAfterReset()
        ->ParaNdis_FinishInitialization()
            ->ParaNdis_ConfigureMSIXVectors()
                ->SetupMessageIndex()
                    ->m_pVirtQueue->SetMSIVector(vector)  // m_pVirtQueue NULL pointer dereference
@YanVugenfirer
Copy link
Collaborator

@wangyan0507 Can you describe the scenario that you are using to get the blue screen?

@wangyan0507
Copy link
Author

wangyan0507 commented Nov 21, 2024

@wangyan0507 Can you describe the scenario that you are using to get the blue screen?

I use qemu to start a windows virtual machine, open windows Driver Verifier for all drivers, and repeat boot and shutdown windows.
For Driver Verifier, I choose as follows:
'Create custom settings (for code developers)' and then select all form the full list.
I think the 'systematic low resources simulation' option may cause alloc memory failed, and caused this problem.
The full dump stack as follows:
image

It caused blue screen when booting the windows vm. We can find the NULL pointer dereference in the NetKvm code. It seems pretty obvious.

@wangyan0507
Copy link
Author

wangyan0507 commented Nov 21, 2024

@YanVugenfirer @ybendito I have updated the description, the NULL pointer dereference in this place:
image

@ybendito
Copy link
Collaborator

@wangyan0507 Do you have hibernation enabled? (powercfg /a)

@heywji
Copy link

heywji commented Nov 24, 2024

Hi @wangyan0507, Did you encounter the BSOD stop code as "KMODE EXCEPTION NOT HANDLED"?
image

@wangyan0507
Copy link
Author

Hi @wangyan0507, Did you encounter the BSOD stop code as "KMODE EXCEPTION NOT HANDLED"? image

Yes, it is "SYSTEM_THREAD_EXECPTION_NOT_HANDLED (7e)" in the full dump file.

@wangyan0507
Copy link
Author

@wangyan0507 Do you have hibernation enabled? (powercfg /a)

No, just enabled 'Fast Startup' .

@heywji
Copy link

heywji commented Nov 25, 2024

Open a downstream Jira to track this issue: https://issues.redhat.com/browse/RHEL-68725

@YanVugenfirer
Copy link
Collaborator

No, just enabled 'Fast Startup' .

Fast startup uses hibernate

@wangyan0507
Copy link
Author

No, just enabled 'Fast Startup' .

Fast startup uses hibernate

hibernation can cause this problem?

@YanVugenfirer
Copy link
Collaborator

Combination of driver verifier with low resource simulation and hibernation. On hibernation, the driver will reinitialize and re-allocate some of the internal data structures.

ybendito added a commit to ybendito/kvm-guest-drivers-windows that referenced this issue Dec 1, 2024
https://issues.redhat.com/browse/RHEL-68725
virtio-win#1197
In such case we do not have any other option than request to
unload the driver. This can happen in 2 flows: power up (during
fast startup) or reset, both with driver verifier that simulates
low resources.
In reset flow we need to request driver unload explicitly.
Power up flow works in SET_POWER, so it will do it automatically.

Signed-off-by: Yuri Benditovich <[email protected]>
@ybendito
Copy link
Collaborator

ybendito commented Dec 3, 2024

@wangyan0507 Driver from #1206
NetKVM-Win2019x64.zip
Please close the issue if the problem is solved

@wangyan0507
Copy link
Author

@wangyan0507 Driver from #1206 NetKVM-Win2019x64.zip Please close the issue if the problem is solved

I will test it.

@wangyan0507
Copy link
Author

The problem is solved

YanVugenfirer pushed a commit that referenced this issue Dec 11, 2024
https://issues.redhat.com/browse/RHEL-68725
#1197
In such case we do not have any other option than request to
unload the driver. This can happen in 2 flows: power up (during
fast startup) or reset, both with driver verifier that simulates
low resources.
In reset flow we need to request driver unload explicitly.
Power up flow works in SET_POWER, so it will do it automatically.

Signed-off-by: Yuri Benditovich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants