Skip to content

test(libkernel): audit flock operation flags and descriptor validation - #400

Open
Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/17439
Open

Thimo188 wants to merge 1 commit into
mainfrom
upstream-pr/17439

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#17439, originally opened by slopgobblercobbler.

Source commit: 545e27fe762bd98d8163d6794ff13c5d274795e0. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

Extend GuestFileLock.cpp to audit flock invalid file descriptor bounds and rejection (EBADF on -1 and 1000000 across LOCK_SH, LOCK_EX, LOCK_UN) without adding an extra executable. Registered as guest_file_lock_bounds under core/libs/prx/libkernel/CMakeLists.txt.

Tested

  • Verified 0 conventions violations via python tools/check_conventions.py --base upstream/main.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Summary by CodeRabbit

  • Tests
    • Added coverage for file-lock behavior with invalid descriptor values across supported modes.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Guest file-lock bounds

Layer / File(s) Summary
Add and register bounds checks
core/libs/tests/GuestFileLock.cpp, core/libs/prx/libkernel/CMakeLists.txt
Bounds() checks invalid descriptors in modes 1, 2, and 8. The dispatcher and Windows test matrix include the bounds case.

Suggested reviewers: ondra97, xxpbsxx, boykopovar

Change: Other

Merge Risk: Minimal · up to 545e2

This change adds test coverage for invalid file descriptors in the guest file-lock tests and leaves production behavior unchanged. It carries no identified merge risk.

Security architecture risk: Minimal · up to 545e2

The new test checks that libkernel rejects invalid file descriptors for shared locks, exclusive locks, and unlocks. It does not change how libkernel handles those operations in production.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 2
  • Waived: $0.50 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1d83b9d-1d74-44fe-833e-c354af1f8a0e
Commits

Reviewing files that changed from the base of the PR and between 4131f51 and 545e27f.

Files selected for processing: 2

  • core/libs/prx/libkernel/CMakeLists.txt
  • core/libs/tests/GuestFileLock.cpp

Limit details: You’ve used all 10 included reviews currently available.

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