-
-
Notifications
You must be signed in to change notification settings - Fork 68
Description
The cgutil code for initctl really is an ugly hack. It definitely needs a refactor to scale better on real systems. The original top/ps code is not really much more than a proof of concept.
@aanderse reports:
When I run
initctl psthe program crashes with an address boundary error. I dug into the source and found that insrc/cgutil.cthere is acgroup_tree()function which declares achar buf[512]-- this is a problem because 512 bytes is not enough (see below). More importantly, in the same file there is apid_cmdline()function which might not be properly checking memory boundaries ...On a desktop system commands with their arguments can get pretty long... for reference, the longest line on my desktop was over 1k characters:
│ ├─ 10994 electron --type=renderer --enable-crash-reporter=01a5337b-e326-4b5b-853b-d8e95b6555d5,no_channel --user-data-dir=/home/aaron/.config/Signal --standard-schemes=attachment --fetch-schemes=attachment --streaming-schemes=attachment --app-path=/nix/store/bm7zkia58733pbvk3mchp3rk0m86dadh-signal-desktop-7.52.0/share/signal-desktop/app.asar --no-sandbox --no-zygote --enable-blink-features=CSSPseudoDir,CSSLogical --disable-blink-features=Accelerated2dCanvas,AcceleratedSmallCanvases --ozone-platform=wayland --disable-gpu-compositing --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=4 --time-ticks-at-unix-epoch=-1747718933446341 --launch-time-ticks=16734918619 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,14399256173871194793,5537812698402872262,262144 --enable-features=PdfUseShowSaveFilePicker,WaylandWindowDecorations --disable-features=EnableOopPrintDrivers,HardwareMediaKeyHandling,SpareRendererForSitePerProcess --variations-seed-version
Oof!
Oof indeed!