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

RHEL-68725: netkvm: Several fixes to prevent problems under driver verifier #1206

Merged
merged 9 commits into from
Dec 11, 2024

Conversation

ybendito
Copy link
Collaborator

@ybendito ybendito commented Dec 1, 2024

No description provided.

https://issues.redhat.com/browse/RHEL-68725

The problem can be reproduced under driver verifier with
low resource simulation. If the miniport is registered
but the protocol fail to register we need to deregister
the miniport. Otherwise in future attempts to load the driver
the NDIS enters erroneous state and may issue BSOD. Example of
BSOD: BUGCODE_NDIS_DRIVER/NDIS_BUGCHECK_REFCOUNT_IMBALANCE.

Signed-off-by: Yuri Benditovich <[email protected]>
Global value of max RX buffers, shared among queues, is
bad idea. It is especially bad when memory allocation
during queue initialization may fail, for example in case
of driver running under driver verifier. Changing the
global field to per-queue field.

Signed-off-by: Yuri Benditovich <[email protected]>
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]>
Read-write lock is created with MiniportContext=NULL because
this happens in the constructor when this field in adapter
context is not populated yet. Pass miniport context as parameter
to the constructor of adapter object and propagate it to the
RSSParameters member.

Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-68725

Simplify failure flow, remove redundant things from it and
ensure the pContext is always deleted. It's destructor does
complete cleanup, including interrupt deregistration. This
fixes BSOD under driver verifier with low resource simulation
NDIS_BUGCHECK_INIT_FAILED_WITHOUT_INTERRUPT_DEREGISTER.

Signed-off-by: Yuri Benditovich <[email protected]>
Under driver verifier with low resources simulation the
attempt to access NIC configuration may fail, important
fields of the context are not initialized correctly
causing driver verifier BSOD on attempt to allocate
zero bytes from memory. Fail initialization if the NIC
configuration is not accessible.

Signed-off-by: Yuri Benditovich <[email protected]>
@YanVugenfirer YanVugenfirer changed the title netkvm: Several fixes to prevent problems under driver verifier RHEL-68725: netkvm: Several fixes to prevent problems under driver verifier Dec 1, 2024
Copy link
Collaborator

@YanVugenfirer YanVugenfirer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. But I suggest to change commit messages to comply with Jira automation.

@YanVugenfirer YanVugenfirer merged commit 82909ad into virtio-win:master Dec 11, 2024
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants