Skip to content

ebpf_platform: Add missing SeReleaseSubjectContext calls#5288

Merged
Alan-Jowett merged 1 commit into
microsoft:mainfrom
Alan-Jowett:fix/subject-context-release
Jun 11, 2026
Merged

ebpf_platform: Add missing SeReleaseSubjectContext calls#5288
Alan-Jowett merged 1 commit into
microsoft:mainfrom
Alan-Jowett:fix/subject-context-release

Conversation

@Alan-Jowett

@Alan-Jowett Alan-Jowett commented May 19, 2026

Copy link
Copy Markdown
Member

Fixes #5295

Summary

\SeCaptureSubjectContext\ captures token references that must be released via \SeReleaseSubjectContext. Two functions were missing this call, leaking kernel token object references on every invocation:

  • *\�bpf_access_check* — called \SeUnlockSubjectContext\ but not \SeReleaseSubjectContext\
  • *\�bpf_platform_get_authentication_id* — no \SeReleaseSubjectContext\ on any return path

Changes

  • **\libs/runtime/kernel/ebpf_platform_kernel.c**: Added \SeReleaseSubjectContext\ after \SeUnlockSubjectContext\ in \�bpf_access_check, and on all three return paths in \�bpf_platform_get_authentication_id.

Testing

  • \�ccess_check\ test passes (12 assertions).
  • All 30 [platform]\ tests pass (5,492 assertions).

@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@Alan-Jowett Alan-Jowett marked this pull request as draft May 19, 2026 22:38
@Alan-Jowett Alan-Jowett force-pushed the fix/subject-context-release branch from c6e7526 to 586d3cd Compare May 19, 2026 22:54
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@Alan-Jowett Alan-Jowett requested a review from Copilot May 27, 2026 22:35
@Alan-Jowett Alan-Jowett marked this pull request as ready for review June 8, 2026 16:31
@Alan-Jowett Alan-Jowett force-pushed the fix/subject-context-release branch from 586d3cd to d9dafd0 Compare June 8, 2026 16:32
SeCaptureSubjectContext captures token references that must be
released via SeReleaseSubjectContext. Both ebpf_access_check and
ebpf_platform_get_authentication_id were missing this call, leaking
kernel token object references on every invocation.

Add SeReleaseSubjectContext on all return paths in both functions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Alan-Jowett Alan-Jowett force-pushed the fix/subject-context-release branch from d9dafd0 to b08b254 Compare June 10, 2026 16:51
@Alan-Jowett Alan-Jowett enabled auto-merge June 11, 2026 15:56
@Alan-Jowett Alan-Jowett added this pull request to the merge queue Jun 11, 2026
Merged via the queue into microsoft:main with commit 8385d0e Jun 11, 2026
113 checks passed
@Alan-Jowett Alan-Jowett deleted the fix/subject-context-release branch June 11, 2026 17:17
@github-project-automation github-project-automation Bot moved this from Todo to Done in eBPF for Windows Triage Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Code quality: Missing SeReleaseSubjectContext calls cause kernel token reference leaks

4 participants