Skip to content

[CP] Add linker options for hotpatching on x64 kernel driver (#5437)#5770

Merged
guhetier merged 1 commit into
release/2.5from
agustint/2.5-kernel-hotpatch-support-x64
Feb 6, 2026
Merged

[CP] Add linker options for hotpatching on x64 kernel driver (#5437)#5770
guhetier merged 1 commit into
release/2.5from
agustint/2.5-kernel-hotpatch-support-x64

Conversation

@toribioa
Copy link
Copy Markdown
Member

@toribioa toribioa commented Feb 5, 2026

Cherry-pick Information

Related PR on main: #5437
Cherry-picked from main commit f2c318d

Description

Add hotpatch support for Windows x64 kernel driver

This PR enables runtime hotpatching capabilities for the MSQuic kernel driver (msquic.sys) in Release|x64 builds by adding the necessary linker flags to msquic.kernel.vcxproj.

Background
Currently, production releases of msquic.sys do not support runtime hotpatching due to missing linker options and function padding required for x64 hotpatch operations. This limitation prevents in-memory updates and affects compatibility with components such as SMBDirect that depend on hotpatch-enabled drivers.

Changes
This PR adds the following linker flags to the Release|x64 configuration:

  • /hotpatchcompatible /profile /incremental:no - Generates PDB records for Vulcan compatibility and enables hotpatch-compatible linking
  • /FUNCTIONPADMIN:6 - Adds 6-byte function padding required for x64 hotpatching trampolines used by hpiload during patch application

Impact

  • Production Deployments: Enables in-memory hotpatching for production MSQuic kernel driver updates
  • Component Compatibility: Ensures compatibility with SMBDirect and other components requiring hotpatch-enabled drivers
  • Operational Benefits: Reduces downtime by supporting runtime driver updates without system restarts

Technical Details

  • The 6-byte padding on x64 functions allows the hotpatch loader (hpiload) to insert trampolines that redirect execution from the baseline binary to the patch binary at runtime, enabling seamless driver updates.

Testing

Completed Verification
✅ Visual Studio Build: Confirmed that locally built msquic.sys for x64 Release configuration contains all required hotpatch prerequisites.
✅ Hotpatch Loading: Successfully loaded and applied a hotpatch to the driver in memory during testing.

✅ GitHub Actions Pipeline: Verify that CI/CD-generated msquic.sys artifact maintain hotpatch compatibility
✅ Release Artifact Testing: Confirm that market-ready msquic.sys binary produced by GitHub pipelines support hotpatch operations

Validation Plan

  1. Download Release-winkernel-windows-2022-x64-schannel artifact from GitHub Actions
    https://github.com/microsoft/msquic/actions/runs/17618956151/job/50059433726?pr=5437
  2. Verify binary contains required function padding and hotpatch metadata
    https://github.com/microsoft/msquic/actions/runs/17618956151/artifacts/3976994659
  3. Perform runtime hotpatch loading test with CI-generated binary
    ✅Successfully loaded and applied a hotpatch to the driver in memory during testing.

Documentation

No user-facing documentation changes required. This is an internal build configuration change that enables existing Windows hotpatch infrastructure. The functionality is transparent to end users and does not modify MSQuic APIs or behavior.

@toribioa toribioa requested a review from a team as a code owner February 5, 2026 04:06
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.75%. Comparing base (f25f432) to head (27ac2e6).
⚠️ Report is 2 commits behind head on release/2.5.

Additional details and impacted files
@@               Coverage Diff               @@
##           release/2.5    #5770      +/-   ##
===============================================
- Coverage        87.34%   86.75%   -0.59%     
===============================================
  Files               59       59              
  Lines            18209    18209              
===============================================
- Hits             15905    15798     -107     
- Misses            2304     2411     +107     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guhetier guhetier changed the title Add linker options for hotpatching on x64 kernel driver [CP] Add linker options for hotpatching on x64 kernel driver (#5437) Feb 5, 2026
@guhetier guhetier enabled auto-merge (squash) February 6, 2026 00:58
@guhetier guhetier merged commit 20d5202 into release/2.5 Feb 6, 2026
285 checks passed
@guhetier guhetier deleted the agustint/2.5-kernel-hotpatch-support-x64 branch February 6, 2026 00:58
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