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

feat: add KMDF Sample Driver with pool leak to demonstrate Driver Verifier #27

Merged
merged 11 commits into from
Sep 27, 2024

Conversation

svasista-ms
Copy link
Contributor

The pool_leak sample KMDF driver contains an intentional error that demonstrates the capabilities and features of Driver Verifier and the Device Fundamental tests.

The driver uses WDM ExAllocatePool2 API to allocate memory to its Device Context buffer and intentionally does not free this memory anywhere in the driver. Such driver behavior can lead to vulnerabilities in the system if not caught. By enabling the Driver Verifier on this driver, the pool leak violation can be caught and with an active KDNET session, the bug can be examined and analyzed further.

This PR adds the sample driver to the workspace with instructions in the project's README to build, deploy and test the driver. The sample also demonstrates the use of WDTF, TAEF and the Device Fundamental Tests to test a driver.

tools/dv/samples/kmdf/pool_leak/README.md Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/README.md Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/README.md Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/driver.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/wdf_object_context.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/lib.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/lib.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/lib.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/lib.rs Outdated Show resolved Hide resolved
tools/dv/samples/kmdf/pool_leak/src/driver.rs Outdated Show resolved Hide resolved
@NateD-MSFT
Copy link
Contributor

@wmmc88 Can you take a look at the dependency review pipeline here?

@wmmc88
Copy link
Collaborator

wmmc88 commented Sep 24, 2024

@wmmc88 Can you take a look at the dependency review pipeline here?

Of the top of my head, the github dependency review action has several issues with AND and OR licenses, and evaluating them correctly. In the past, I've had to work around those issues. See comments in https://github.com/microsoft/windows-drivers-rs/blob/9d4ab1a1a8c14587e8354aaadfb83ea49beebc05/.github/workflows/github-dependency-review.yaml#L19 and https://github.com/microsoft/Windows-rust-driver-samples/blob/64c426eb7f21b9f46946084039e2b68be30f59bc/.github/workflows/github-dependency-review.yaml.

I do believe there was some recent upstream change in the action. I'll see if i have some time to look into this later this week.

@wmmc88
Copy link
Collaborator

wmmc88 commented Sep 24, 2024

@wmmc88 Can you take a look at the dependency review pipeline here?

Of the top of my head, the github dependency review action has several issues with AND and OR licenses, and evaluating them correctly. In the past, I've had to work around those issues. See comments in https://github.com/microsoft/windows-drivers-rs/blob/9d4ab1a1a8c14587e8354aaadfb83ea49beebc05/.github/workflows/github-dependency-review.yaml#L19 and https://github.com/microsoft/Windows-rust-driver-samples/blob/64c426eb7f21b9f46946084039e2b68be30f59bc/.github/workflows/github-dependency-review.yaml.

I do believe there was some recent upstream change in the action. I'll see if i have some time to look into this later this week.

@svasista-ms try cherry picking this commit onto your branch: wmmc88@871632d

It looks like the accepted format for "allow-licenses" was changed to be a single string that's comma delimited. the yaml >- syntax does that. I've made the same change in windows-drivers-rs repo already

@wmmc88 wmmc88 changed the title Add KMDF Sample Driver with pool leak to demonstrate Driver Verifier feat: Add KMDF Sample Driver with pool leak to demonstrate Driver Verifier Sep 27, 2024
@wmmc88 wmmc88 enabled auto-merge (squash) September 27, 2024 17:14
@wmmc88 wmmc88 merged commit 8b8847f into microsoft:main Sep 27, 2024
42 checks passed
@svasista-ms svasista-ms changed the title feat: Add KMDF Sample Driver with pool leak to demonstrate Driver Verifier feat: add KMDF Sample Driver with pool leak to demonstrate Driver Verifier Sep 30, 2024
@svasista-ms svasista-ms deleted the memory-leak-sample branch October 21, 2024 11:43
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.

4 participants