interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

gsp-cot-test fails under gcc 13: expect_refused() relies on unspecified argument evaluation order

Closed · #483 · open 2026-10-30 12:41 UTC · closed 2026-11-05 23:26 UTC (reason completed)

Imported from GitHub aien-dev/aienux#483, by drakestapleton

drakestapleton wrote on 2026-10-30 12:41 UTC

Summary

make -C native/kernel test stops at gsp-cot-test when the host tool is built with gcc 13. The self-test reports CK_GSP_COT_ENCODE_SELFTEST: FAIL (50 failures). Each refusal check sees the previous check's why string, so every failure is shifted by one.

This happens on main. The failure was seen while refreshing #426, and there native/kernel/tools/ck_gsp_cot_encode.c is byte-identical to main at b00c728c2443d8931e8e697a25d67f5e20e408ca (checked with git diff --quiet origin/main -- native/kernel/tools/ck_gsp_cot_encode.c). The #426 refresh did not cause it, and this issue does not propose a fix yet.

Likely cause

The refusal checks in the self-test are written like this:

expect_refused(cot_mctp_header(1, 1, 0, 4, &h, &why), why, "seq out of range", "mctp seq 4");

cot_mctp_header() writes the reason through &why, and the same call also passes why by value as an argument to expect_refused(). C leaves the evaluation order of function arguments unspecified. If the compiler reads why before it calls cot_mctp_header(), expect_refused() gets the stale string from the previous check. The other refusal checks (cot_nvdm_header, the payload and params mutations) follow the same pattern.

The gcc 13 output fits this. mctp seq 4 gets an empty why, and from then on each check gets the reason its predecessor expected:

  FAIL refused: mctp seq 4 (rc=-1 why= want=seq out of range)
  ...
  FAIL refused: decoded desc size 512 (rc=-1 why=bIsGspRmBoot not set want=descriptor size not 256)
  FAIL refused: params 87 bytes (rc=-1 why=descriptor size not 256 want=params length not 88)
CK_GSP_COT_ENCODE_SELFTEST: FAIL (50 failures)
make: *** [Makefile:2035: gsp-cot-test] Error 1

The return codes are right (rc=-1 every time), so the encoder itself seems to refuse correctly. Only the test harness's capture of the reason is wrong. That is still an inference from the output: nobody has checked it against an order-independent harness yet.

Reproducer (on main, gcc 13.x)

gcc -std=gnu11 -O2 -Wall -Wextra -Werror -I native/argus \
  -o /tmp/ck_gsp_cot_encode native/kernel/tools/ck_gsp_cot_encode.c native/argus/sha256.c
/tmp/ck_gsp_cot_encode selftest | grep -E 'FAIL|SELFTEST'
# or: make -C native/kernel HOSTCC=gcc gsp-cot-test

This was seen with gcc 13.3 on a Cursor cloud VM (Ubuntu). A quick clang 18 build of the same file was tried in the same session, but its output wasn't captured, so we don't know whether clang passes. Someone should re-run it before assuming the failure is gcc-only.

Does CI catch it?

No, PR CI currently misses it.

  • make -C native/kernel test runs only through the AIENOS-CK-HOST-TESTS gate (tests/gates/aienos-ck-host-tests.gate), which has requires: host.
  • The "AIEN Checks" job in .github/workflows/aien-verification.yml runs only the portable smoke set: gates whose requires list is just portable. On main, AIENOS-ZERO-DISK-SECRETS is the only such gate.
  • The gate file's header comment says it mirrors ck-kernel.yml, but no ck-kernel.yml exists in .github/workflows/ on main. The workflows there are aien-verification.yml, sbom.yml and copilot-setup-steps.yml.

The gate would run in a full whole-system run on the Spark. Whether it fails there depends on which host compiler the Spark uses, and that hasn't been checked (hardware-unverified). Until this is fixed, any host where HOSTCC is gcc 13 stops make -C native/kernel test at this target, and every test target listed after gsp-cot-test is skipped.

Done when

  • The gsp-cot-test self-test gives the same verdict whatever order the compiler evaluates arguments in (at least gcc 13 and clang).
  • make -C native/kernel HOSTCC=gcc test gets past gsp-cot-test.
  • A follow-up decision on whether PR CI should cover this (it is currently host-only) is either made or split into its own issue.

— Grokbot

drakestapleton wrote on 2026-10-30 12:44 UTC

Scope addition: the fix for this issue should also correct the docs.

The header comment in tests/gates/aienos-ck-host-tests.gate says the gate mirrors "hosted: ck-kernel.yml 'Host unit tests (plain and ASan + UBSan)'". No ck-kernel.yml exists in .github/workflows/ on main, so the comment points at a workflow that's gone. The fix should update or remove it, and whatever replaces it shouldn't say a hosted workflow runs these tests unless one does.

Nobody has checked yet whether the Spark's host compiler hits the gcc 13 failure. That check will run once the Spark is available again.

— Grokbot

Sign in to comment