Skip to content

hyperfile/sysctl: reject unregisterable sysctl paths (fixes aarch64 boot panic)#829

Merged
lacraig2 merged 2 commits into
mainfrom
fix/sysctl-create-guard
Jun 9, 2026
Merged

hyperfile/sysctl: reject unregisterable sysctl paths (fixes aarch64 boot panic)#829
lacraig2 merged 2 commits into
mainfrom
fix/sysctl-create-guard

Conversation

@lacraig2

@lacraig2 lacraig2 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Auto-generated pseudofile models scrape binary strings and emit bogus /proc/sys/* entries that get registered as sysctls, e.g.:

/proc/sys/fs/binfmt_misc/WSLInteropos/signal
/proc/sys/kernel/hostname2006
/proc/sys/net/core/somaxconnabi
/proc/sys/none

Registering these is useless at best. At worst it is fatal: for filesystem-backed nodes such as /proc/sys/fs/binfmt_misc, the guest kernel can't create a ctl_table there, and on older kernels (e.g. 4.10) the failed register_sysctl() panics in its cleanup path (drop_sysctl_tablerb_erase), killing init. This reliably crashed aarch64 guests ~5s into boot.

Fix

Reject unregisterable sysctl paths at the registration chokepoint (Sysctl.register_sysctl), with a logged warning instead of queueing them:

  • empty paths,
  • paths containing an empty component (//),
  • the fs/binfmt_misc subtree — it's a mounted filesystem, not a sysctl, so modeling it as one is always wrong.
plugins.sysctl WARNING  Skipping sysctl registration for
  'fs/binfmt_misc/WSLInteropos/signal':
  /proc/sys/fs/binfmt_misc is a mounted filesystem, not a sysctl

Testing

Ran the GL.iNet Beryl AX (GL-MT3000, aarch64/4.10) firmware under Penguin:

  • Before: kernel panic at ~5s (Attempted to kill init!), 99-line console, no services.
  • After: the guard skips the bad entry (warning above), no panic, and the guest boots normally (≈300-line console). An equivalent run with the offending pseudofiles removed brings up the full service set (uhttpd, dnsmasq, samba, avahi), confirming the guest is healthy once the bad registration is avoided.

Companion

rehosting/igloo_driver#76 hardens the kernel module so a doomed registration can never panic the guest (it refuses to create a sysctl under a non-existent parent directory on old kernels). This PR is the upstream half: don't emit the bogus models in the first place. Defense in depth — either alone prevents the panic.

Note: the deeper aarch64 fidelity issue (Penguin ships a 4.10 kernel for aarch64 while the firmware's own modules target 5.4) is separate and tracked elsewhere; this PR only addresses the sysctl-registration crash.

lacraig2 added 2 commits June 9, 2026 00:21
Auto-generated pseudofile models scrape binary strings and emit bogus
/proc/sys/* entries (e.g. /proc/sys/fs/binfmt_misc/WSLInteropos/signal).
Registering them is useless, and for filesystem-backed nodes such as
/proc/sys/fs/binfmt_misc it is fatal on older guest kernels: the kernel
fails to create the ctl_table and then panics in register_sysctl's
cleanup path (drop_sysctl_table -> rb_erase), killing init. This took
down aarch64 guests (4.10 kernel) ~5s into boot.

Skip such paths at the registration chokepoint: empty paths, paths with
empty components ("//"), and the binfmt_misc subtree (a mounted
filesystem, not a sysctl). The igloo driver enforces the same invariant
as a kernel-side backstop (rehosting/igloo_driver companion PR).
0.0.78 includes the portal_sysctl create-guard (rehosting/igloo_driver#76),
the kernel-side backstop for the bogus-sysctl boot panic this PR also
guards against from the Python side.
@lacraig2 lacraig2 enabled auto-merge (rebase) June 9, 2026 12:25
@lacraig2 lacraig2 merged commit 79a8f89 into main Jun 9, 2026
14 checks passed
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.

1 participant