myxce/.wolf/bugs/bug-1877.md
Rongsong Shen f5d4a62841
chore: sync bug-1873 (#316) and refresh #311-#315 to Gitea
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 06:54:26 +00:00

3.3 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related fix_commits gitea_issue gitea_synced_status gitea_synced_hash
bug-1877 fixed 2026-09-28 controller noise 2026-09-28T03:52:37Z 2026-09-28T03:58:49Z 1
src/controller/persist.c
controller
persistence
encryption
logging
44173f74
315 fixed e745a1d2a690

bug-1877: controller warns 'WAL/snapshot stored unencrypted' without checking the storage

Description

Observed:

[2026-09-28 11:52:37,938] [51034] [  WARN] [          persist_init] WAL/snapshot stored unencrypted in /tmp/xce-ha-deploy/controller/ctrl-3/data/wal — ensure filesystem is encrypted if job payloads contain sensitive data

Expected: the warning only when the WAL's storage is not encrypted. Impact: the advisory fired on encrypted storage too, so it carried no information. On pc13v (/tmp, not shown to be encrypted) it still correctly appears after the fix. Found by: user report from a pc13v HA deploy, 2026-09-28

Environment

  • OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
  • libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2)
  • Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
  • Build: asan (xce.build)
  • Code: scheduler-framework @ 8cadeeb2 (last commit without the fix)
  • Deployment: first seen on pc13v: 3-node HA (ctrl-1..3) + scheduler + apiserver + real root xcecd under systemd, deploy dir /tmp/xce-ha-deploy, 2026-09-28 11:52 +0800 (pc13v's OS, libc and exact commit were not recorded; the values above are from the reproduction on this dev host, same nix toolchain)

Reproduction

  1. Put a controller's workdir on a LUKS/dm-crypt or fscrypt filesystem at 8cadeeb2
  2. Start it: the warning is logged anyway (persist_init never checked)
  • Frequency: deterministic (every controller start)
  • Evidence: the xcecd/scheduler/controller/apiserver logs pasted in the user's report, 2026-09-28 (quoted above)

Root cause

persist_init() (controller/persist.c) logged the warning unconditionally.

Fix

persist_path_encrypted() checks the WAL directory for fscrypt (statx STATX_ATTR_ENCRYPTED) and its block device for a dm-crypt layer via sysfs (dm/uuid starting CRYPT-), following slaves so LVM on LUKS counts (persist_dev_is_dmcrypt()). Encrypted storage is logged at INFO; anything not shown to be encrypted keeps the WARN.

Verification

  • Test: test_luks_device_is_encrypted, test_lvm_on_luks_is_encrypted, test_plain_partition_and_plain_lvm_are_not and test_unknown_device_is_not_claimed_encrypted in src/controller/testsuite/test_persist_encryption.c, against a fake sysfs tree (new functions; there was no check before)
  • Suites: full ASAN build (xce-build all): 113/113 suites after the updated scheduler picker-registration test; controller 1250/0, harness 141/0, worker diskstats 4/0, scheduler picker wiring 11/0 + picker registration 4/0, apiserver TestRootWarning PASS
  • Live: pc13v retest at 4c134127 (debug build, 2026-09-28 14:47 +0800): ag -i error logs/ finds nothing; ag -i warn logs/ shows only the WAL-unencrypted advisory: the advisory remains for /tmp, which is not encrypted -- as expected

References

  • Related: none