Repository navigation
test(libkernel): audit flock operation flags and descriptor validation - #17439
slopgobblercobbler wants to merge 1 commit into
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 6cbb8984ae:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_kernel_flock_testsbuilt cleanly. - CTest (
guest_kernel_flock):1/1 Test #791: guest_kernel_flock ...............Subprocess aborted***Exception: 0.39 sec 0% tests passed, 1 tests failed out of 1The following tests FAILED: - Note: the AI-assisted checkbox can stay.
Requesting changes for the points above.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, Vulkan hidden for this CPU-only run. The Tests run (from the log): Fails in 3 of 3 runs: I've only quoted the output here and haven't traced the cause. AI-assisted: yes. |
|
This test aborts, which matches @PrivacyOnion's Linux report and the Windows failure (0xc0000409 on "LOCK_EX on shared locked fd did not fail with EWOULDBLOCK"). The cause is in the test: both conflict cases take LOCK_SH then LOCK_EX|LOCK_NB (and the reverse) on the same descriptor and expect EWOULDBLOCK. flock locks belong to the open file description, so a second call on the same fd converts the lock and succeeds. A conflict needs a second open() of the same file. Most of the valid lock-flag cases are also covered on main already: GuestFileLock.cpp checks SH, EX, NB and UN across separate opens, upgrades, blocking waits, dup and fcntl. What is new here is flock(-1, ...) and flock(1000000, ...) returning EBADF. Please drop the cases main already covers and add the two bad-descriptor checks to GuestFileLock.cpp, so it does not need a new executable. If you keep a conflict case, use a second descriptor for it. |
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
6cbb898 to
6465ad4
Compare
|
@PrivacyOnion @oneandonlydean Addressed all feedback on
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The added bounds case checks invalid descriptors for shared, exclusive, and unlock operations, and is registered with the existing Windows file-lock test executable.
What I ran
Reviewed head 6465ad45a6fedf85ddc04c083688267a92a8c2e1 using repo_read.py for the prepared diff and changed-file context. No tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff review | passed | Two changed files inspected |
| Tests | not run | No test command run |
Findings
Blocking
None.
Non-blocking
None.
Not verified
Runtime behavior and test execution were not verified. Read core/libs/prx/libkernel/CMakeLists.txt and core/libs/tests/GuestFileLock.cpp; neither changed file was excluded.
To get this to a good state
Nothing is required.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
6465ad4 to
545e27f
Compare
ligmaSec
left a comment
There was a problem hiding this comment.
Compiled the exact Windows GuestFileLock.cpp fixture to x86-64 COFF using WinLibs GCC 16.2.0 r3 under Wine. I checked that CTest registers bounds only for Windows and the fixture dispatches to it. This run verified compilation. The fixture was not linked or run against Windows libkernel.
AI-assisted: yes.
What
Extend
GuestFileLock.cppto auditflockinvalid file descriptor bounds and rejection (EBADFon -1 and 1000000 acrossLOCK_SH,LOCK_EX,LOCK_UN) without adding an extra executable. Registered asguest_file_lock_boundsundercore/libs/prx/libkernel/CMakeLists.txt.Tested
python tools/check_conventions.py --base upstream/main.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)