CK Core Motif
CK Core Motif

Hardening baseline and audit ledger

CK Core Motif is a legacy C toolkit that is being audited for null-pointer, memory, overflow and unhandled-edge-case defects and brought to C23. This page records the measured starting point, the current WP-42 defect-warning ratchet, and which parts have been audited, so each change can be checked against it. The opt-in build switches are described in Build and install.

Method

Configure with --enable-hardening, build at -O2 and keep the complete make log. The counting tool scripts/warning-baseline.py attributes each compiler warning to a component, counts it once however many translation units include its header, and compares a later log with a recorded baseline:

scripts/warning-baseline.py record make.log --depth 2 --strip "$srcdir" --strip "$builddir" --label motif-hard > baseline.json
scripts/warning-baseline.py compare make.log docs/hardening-baseline-validation.json --depth 2 --strip "$srcdir" --strip "$builddir"

compare fails when any component and class has more warnings than the baseline, so the baseline is a ratchet: counts may only fall. The list mode prints the individual warnings of chosen classes for triage. Once a defect-oriented warning class reaches zero across all components, it is promoted to -Werror=... under --enable-hardening in ck_hardening.m4 and locked at zero in hardening-baseline-validation.json.

Baseline 2026-11-27 (Phase 3 warning ratchet)

GCC 15.2 and Clang 21.1 on Ubuntu 26.04.1 LTS arm64, -std=c23 -O2 -g0, --enable-hardening, six jobs, with Xft, Unicode text, AT-SPI, SVG, XLibre DPI, and native Wayland enabled. The clean build of the libraries, WML, UIL, and mwm completed with zero warnings and zero errors under both GCC 15.2 and Clang 21.1. The machine-readable record is hardening-baseline-validation.json, and the ratchet is verified by tests/automated/check-hardening-defect-ratchet.py.

The initial 2026-11-04 baseline reported 1,938 unique warnings (242 in the 10 defect-oriented classes) and 329 cppcheck messages in product code (62 errors: uninitvar 52, memleak 5, legacyUninitvar 2, arrayIndexOutOfBounds 1, shiftNegative 1, memleakOnRealloc 1). Following WP-42, Phase 2 (2026-11-26), and Phase 3 of the warning ratchet (2026-11-27), all 10 original defect-oriented warning classes, all 62 product-code cppcheck errors, -Wmissing-field-initializers (671), -Wsign-compare (485), -Wformat-nonliteral (135), -Wtype-limits (125), -Wunused-variable (107), -Wempty-body (64), -Wunused-but-set-variable (52), -Wunused-function (16), -Wunused-label (2), and -Wunused-local-typedefs (1) across lib/Xm, lib/Mrm, clients/mwm, clients/uil, tools/wml, and config/util have been reduced to 0 unique warnings and promoted to -Werror=... under --enable-hardening (20 promoted -Werror=... classes total), while cppcheck reports 105 non-error messages in product code (0 errors, 93 warnings, 12 portability).

Warning class2026-11-04 baseline2026-11-15 (WP-42)2026-11-26 (Phase 2)2026-11-27 (Phase 3)Hardening status
-Wmissing-field-initializers67167100-Werror=missing-field-initializers
-Wsign-compare48548500-Werror=sign-compare
-Wformat-nonliteral1351351350-Werror=format-nonliteral
-Wtype-limits1201201250-Werror=type-limits
-Wunused-variable1071071070-Werror=unused-variable
-Wformat-security75000-Werror=format-security
-Wempty-body6464640-Werror=empty-body
-Wunused-but-set-variable5252520-Werror=unused-but-set-variable
-Wimplicit-fallthrough49000-Werror=implicit-fallthrough=3
-Wnull-dereference42000-Werror=null-dereference
-Wmisleading-indentation32000-Werror=misleading-indentation
-Wcast-function-type30000-Werror=cast-function-type
-Wunused-function1616160-Werror=unused-function
-Wpointer-to-int-cast7000-Werror=pointer-to-int-cast
-Wmaybe-uninitialized3000-Werror=maybe-uninitialized
-Waddress2000-Werror=address
-Wunused-label2220-Werror=unused-label
-Wuninitialized1000-Werror=uninitialized
-Wint-to-pointer-cast1000-Werror=int-to-pointer-cast
-Wunused-local-typedefs1110-Werror=unused-local-typedefs

Test and demo directories are excluded from the cppcheck product-code ledger, as are cppcheck's own analysis-depth notices, parse failures and va_list_usedBeforeStarted reports, which come from cppcheck not knowing the toolkit's Va_start macro.

Audit ledger

A component is audited when a topic commit records a review of its complete input path, not when a compiler is quiet. The commit activity below is a weaker signal: it shows which files have been touched at all since 2026-10-22. Fuzz targets exist for lib/Mrm (fuzz-mrm-uid and the reproducible damaged-UID test, UID files as untrusted input), for clients/uil (fuzz-uil-grammar, fuzz-uil-wmd), for clients/mwm (fuzz-mwm-parsers), and for lib/Xm (fuzz-editres-wire, fuzz-image-cache, fuzz-wayland-x11-server, fuzz-xm-converters, fuzz-xmstring-ct, fuzz-xmstring-stream, fuzz-xpm-image; see Known limits); the Editres handler and the D-Bus adapter also have compiled behavioural tests under the sanitizers (Editres protocol handler, Accessibility D-Bus reply building).

ComponentExposurePrior hardeningUnique warningsDefect-classcppcheck errorsFuzz targets
lib/Xmtoolkit library; clipboard, selection, text, string and image paths; editres protocol; native Wayland X11/XRender serverhardening commits since 2026-10-22; WP-42 defect-warning & cppcheck ratchet, WP-43 legacy/modern subsystem audit (WP-43 audit), WP-44 XPM fuzzer & bounds fixes (2026-11-16), Wayland backend ASan/UBSan/TSan + wire fuzzer qualification, Phase 2 -Wsign-compare / -Wmissing-field-initializers ratchet (2026-11-26), ISO-2022 Compound Text / ImageCache fuzzing & multibyte bounds fixes, and Phase 3 zero-warning -Werror=type-limits ratchet (2026-11-27)000fuzz-editres-wire, fuzz-image-cache, fuzz-wayland-x11-server, fuzz-xm-converters, fuzz-xmstring-ct, fuzz-xmstring-stream, fuzz-xpm-image
clients/uilUIL compiler; parses source and .wmd filesWP-42 defect-warning & cppcheck ratchet; WP-43 WMD binary database and parser bounds audit (WP-43 audit); WP-44 .wmd fuzzer (2026-11-16); Phase 2 initializer & signedness ratchet (2026-11-26); callable Uil() grammar/UID fuzzer, lifetime/bounds fixes, and Phase 3 zero-warning ratchet (2026-11-27)000fuzz-uil-grammar, fuzz-uil-wmd, check-wmd.py
clients/mwmwindow manager; resource and property parserscontrol flow, initialization and keysym handling (2026-11-01); WP-42 ratchet, WP-43 interactive-placement bounds audit, WP-44 WSM wire & .mwmrc fuzzer (2026-11-16), Phase 2 signedness ratchet (2026-11-26), and Phase 3 zero-warning -Werror=type-limits ratchet (2026-11-27)000fuzz-mwm-parsers, wsm-wire-validation
lib/Mrmreads and writes binary UID fileshardening commits since 2026-10-22; UID index, literal, icon and compression-table checks (2026-11-10); WP-43 writer/OS audit, WP-44 -O1 sanitizer initialization fix (2026-11-16), Phase 2 signedness ratchet (2026-11-26), and Phase 3 __format_arg__, 64-bit snprintf, and zero-warning -Werror=type-limits ratchet (2026-11-27)000fuzz-mrm-uid, run-mrm-uid-mutations.py
tools/wmlwidget meta-language generator; build-time toolWP-42 format-security & cppcheck ratchet; WP-43 WMD emitter/grammar review; WP-44 sanitized wmldbcreate round-trip (2026-11-16); Phase 2 initializer ratchet (2026-11-26); Phase 3 zero-warning ratchet (2026-11-27)000check-wmd.py
config/utilbuild-time utilityWP-42 checktree directory-handle leak fix (2026-11-15); Phase 3 zero-warning ratchet (2026-11-27)000none

All 28 previously untouched first-party C/yacc files from the 2026-11-04 ledger have been audited in WP-43: executable modules (AtomMgr, CvtUnit, Dest, DialogSE, DrHiDash, DrPoly, FocusAct, GetRes, IconH, MenuProc, ObsoXme, ReadImage, ShellE, SlideC, TearOffB, TravAct, ValTime, Mrmlwrite, Mrmos, Mrmwwrite, WmCPlace) received explicit input/bounds/lifetime guards, and pure constant/table translation units (Messages, ObsoStr, TranslNew, Transltns, sharedlib, MrmMessages, version, UilData, Uil.y) were verified free of mutable untrusted-input paths.

The vendored libXpm sources (31 files in lib/Xm, 7 .c files unchanged) are reviewed but not mass-rewritten, as are the libXmu-derived parts of lib/Xm/EditresCom.c. The optional features added in October and November 2026 (appearance profiles, AT-SPI accessibility, text layout, PNG, SVG and JPEG loading, XLibre scaling) were audited in WP-43 for dimension/channel overflow, scanline buffer bounds, Xlib region/GC allocation checks, and reentrant teardown.

Known limits

  • The sanitized (--enable-sanitizers=address,undefined and --enable-sanitizers=thread) installed-prefix builds, run-wayland-backend.py, and all 11 libFuzzer replay targets (editres-wire, image-cache, mrm-uid, mwm-parsers, uil-grammar, uil-wmd, wayland-x11-server, xm-converters, xmstring-ct, xmstring-stream, xpm-image), check-wmd.py, check-xpm-input, wsm-wire-validation, and the 5 sanitized parser-bounds suites (run-xmstring-stream-bounds.py, run-resconvert-list-bounds.py, run-mrm-literal-bounds.py, run-mrm-icon-bounds.py, run-mrm-value-bounds.py) pass with zero toolkit-owned ASan/UBSan diagnostics. Leak-enabled process-exit allocations inside external system libraries (libX11, libXt, fontconfig) remain documented external ownership boundaries in docs/status.md.
  • cppcheck ran with --max-configs=1 for the baseline summary, though the product-code directories (lib/Xm, lib/Mrm, clients/mwm, clients/uil, tools/wml, config/util) were also verified at default multi-branch depth with zero cppcheck errors.
  • tests/automated holds thousands of source-text guards that assert exact source text. A mechanical rewrite must update the affected guards in the same change.