Skip to content

feat(libkernel): report vm.overcommit through sysctlbyname - #5184

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/sysctl-vm-overcommit
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/sysctl-vm-overcommit

Conversation

@p3n1cillin

@p3n1cillin p3n1cillin commented Oct 13, 2026 •

Copy link
Copy Markdown

What

PS5MC (PPSA99420, Kodi 22, catalog release) stops right after its heap: 2048 MiB of direct memory line on Windows:

terminate called after throwing an instance of 'std::runtime_error'
  what():  sysctlbyname_nid_postfix: unsupported name vm.overcommit

All three of its sysctlbyname("vm.overcommit") call sites (guest 0x3A4C351, 0x3A4CFA9, 0x3A4E43E) are mimalloc's unix_detect_overcommit. Each reads the page size through sysconf(47), then vm.overcommit into a zeroed 4-byte int, and sets mimalloc's overcommit flag from (result | value) != 0; mimalloc's start-up messages "secure level: %d" and "mem tracking: %s" follow the first site.

sysctlbyname("vm.overcommit") now reports 0, the default FreeBSD gives its int vm.overcommit. It goes through the existing CopyOut: a null buffer gets the length 4, and a short buffer gets a partial copy and ENOMEM. A write, which FreeBSD takes as a new policy, throws. The console's value is unknown; this is recorded under Unknown function info in docs/dev/debt/libkernel.md.

Tested

Checklist

🤖 Generated with Claude Code

@p3n1cillin

Copy link
Copy Markdown
Author

Linux run: Ubuntu in WSL2, GCC 15.2.0, Ninja Release, BUILD_TESTING=ON, full build of a local test head 838d4fd85. That head is main 3faa9cb40 with this PR, my other open libkernel PRs (#5013, #5061, #5078, #5098, #5183–#5187, #5191) and the open PRs the catalog titles need (#4377, #4379, #4374, #4383, #3798, #4467, #4863, #4105). All 123 libkernel and 69 libc tests pass, including guest_system_configuration, guest_getrlimit, guest_kernel_fcntl, guest_freebsd_clocks, guest_kernel_sys and guest_filesystem. Not built alone on Linux; no title run on Linux.

@coltken95

Copy link
Copy Markdown

Tested on Linux x86-64 (Release build), with this PR alone (341fbb2) merged into main 9d0a41d:

  • With the PR: guest_system_configuration passes.
  • With main's sources and the PR's test: guest_system_configuration aborts.

AI-assisted: yes (Claude Code)

@babyhuey

Copy link
Copy Markdown
Contributor

A title that stops here on main: PS5MC / kodi-ps5 (PPSA99420, catalog release). Since #4379 (chflags) merged, main bf8dc61 stops it at sysctlbyname_nid_postfix: unsupported name vm.overcommit, just after it maps its heap and opens /dev/crypto (Linux, Ubuntu 24.04, GCC 13, Release, headless). With this PR (341fbb2, clean merge) guest_system_configuration passes. Kodi then starts properly: it loads its settings and initializes its services, and exits on its own at a later step, XBPython: Python initialization failed in _PyImport_InitExternal: external importer setup failed (a bare RuntimeError), then CServiceManager::InitStageTwo: Unable to initialize the python binding modules, XBMC_Run returned -1.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
The mimalloc in PS5MC (PPSA99420) reads vm.overcommit at start-up and
stopped on the unsupported name. It reports FreeBSD's default, 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Rebased onto main to resolve the conflict in docs/dev/debt/libkernel.md after #5098; no other change.

@oneandonlydean
oneandonlydean force-pushed the claude/sysctl-vm-overcommit branch from 341fbb2 to dad29ca Compare October 14, 2026 01:45
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@oneandonlydean
oneandonlydean merged commit 016db92 into boykopovar:main Oct 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants