refactor(uffd): add UFFD_EVENT_REMOVE constants and zero/wp/wake ioctls#2444
refactor(uffd): add UFFD_EVENT_REMOVE constants and zero/wp/wake ioctls#2444ValentaTomas wants to merge 1 commit intomainfrom
Conversation
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit e61c569. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
LGTM — purely additive cgo wiring with one cosmetic nit (see inline comment).
Extended reasoning...
Overview
Single-file change adding new constants, types, and methods to . All additions are mechanical mirrors of kernel macros from , following the exact same pattern as the existing implementation. No callers yet, no behaviour change.
Security Risks
None. This is low-level ioctl wiring with no auth, crypto, or permission logic. The new methods follow the same syscall pattern as the existing .
Level of Scrutiny
Low. The PR explicitly isolates kernel-header-mechanical work. The reviewer task is confirming constants/structs/ioctls match the kernel headers, which they do. All added code is dead code until a caller is wired up in a subsequent PR.
Other Factors
The one bug found (inline comment) is a cosmetic copy-paste artifact in an error string — "copied" instead of "zeroed" in . It has zero functional impact and no callers yet, so it does not warrant blocking the PR. Tests pass, linter clean.
Purely additive cgo wiring extracted from #1896, in preparation for the free-page-reporting feature work that will actually use these. New constants: - UFFD_EVENT_REMOVE - UFFDIO_WRITEPROTECT_MODE_WP - UFFDIO_ZEROPAGE_MODE_DONTWAKE - UFFDIO_ZEROPAGE / UFFDIO_WRITEPROTECT / UFFDIO_WAKE - UFFD_PAGEFAULT_FLAG_MINOR / UFFD_PAGEFAULT_FLAG_WP - UFFD_FEATURE_EVENT_REMOVE New types: - UffdRemove (mirrors struct uffd_remove for events) - UffdioZero (= C.struct_uffdio_zeropage) New helper constructors and Fd methods: - newUffdioZero, newUffdioWriteProtect - (Fd).zero - UFFDIO_ZEROPAGE ioctl - (Fd).writeProtect - UFFDIO_WRITEPROTECT ioctl - (Fd).wake - UFFDIO_WAKE ioctl No callers yet; this is intentionally a small, mechanically reviewable diff against kernel headers (linux/userfaultfd.h, sys/ioctl.h). Behaviour of existing code is unchanged.
44b998c to
e61c569
Compare
Purely additive cgo wiring extracted from #1896. No callers yet, no behaviour change — a reviewer only needs to confirm the new constants/structs/ioctls match
linux/userfaultfd.h.Adds:
UFFD_EVENT_REMOVE,UFFDIO_{ZEROPAGE,WRITEPROTECT,WAKE},UFFDIO_WRITEPROTECT_MODE_WP,UFFDIO_ZEROPAGE_MODE_DONTWAKE,UFFD_PAGEFAULT_FLAG_{MINOR,WP},UFFD_FEATURE_EVENT_REMOVE.UffdRemove(local mirror — kernel header doesn't expose the struct),UffdioZero.(Fd).zero,(Fd).writeProtect,(Fd).wake— same shape as the existing(Fd).copy.