Repository navigation
iommu: apple-dart, drm/apple: build under KASAN with CONFIG_WERROR (frame size, unused fixture) - #2924
iommu: apple-dart, drm/apple: build under KASAN with CONFIG_WERROR (frame size, unused fixture)#2924RyanTheTide wants to merge 4 commits into
Conversation
apple_dart_dcp_import() takes struct dcp_adt_tables by value, and its callers copy the 552-byte table description into a local 'bounds' only to change start and end. With the import inlined, the external and internal frontend prepare paths each carry several copies: 2144 bytes of stack under KASAN, which fails a CONFIG_WERROR build at the default 2048-byte frame limit. Pass the firmware description by const pointer with the table range as two arguments, and store the adjusted copy only in the imported DCP. apple_dart_dispext_prepare() drops to 944 bytes and apple_dart_frontend_prepare() to 976 (arm64, KASAN inline). No change in behaviour. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…he stack dcp_swapped() completes a swap whose completion arrived early on external desktop 26.x firmware by building a zeroed dc_swap_complete_resp on the stack and passing it to dcpep_cb_swap_complete(), which only reads its swap_id. The record is 0x730 bytes on those firmware versions, enough to put dcp_swapped() at 2080 bytes under KASAN and fail a CONFIG_WERROR build. Split the swap-id handling out of dcpep_cb_swap_complete() into dcp_swap_complete_id() and call that directly. dcp_swapped() drops to 96 bytes. The receive path is unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
av_lifetime_report_after_stop() keeps a struct apple_epic_service, pending-command table included, on the stack. Under KASAN that is a 2240-byte frame and a CONFIG_WERROR build fails. Allocate it with kunit_kzalloc() like the rest of the fixture (416 bytes). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Commit c7e3f37 ("drm/apple: read the panel colour target from raw ADT") removed the only user of panel_test_adt, so a CONFIG_WERROR build of the parser tests fails on -Wunused-const-variable. Remove the array and keep panel_test_mode, which the tests still use. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 7663a8b. Read all four commits at 7663a8b. No new heap or static storage on any kernel path: the DART change only passes the 552-byte table description by const pointer, so there is no allocation or concurrency question. The only new allocation is kunit_kzalloc() in a test. Behaviour is the same with or without KASAN.
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial §1–§6 pre-PR checklist review at 7663a8b04ed2bd380fe887c8357d9ad208b8fc19 (COMMENT — 0 code/policy blockers; waiting on CI).
Checklist Summary
- §1 (No model gating): Pass — no chip, SoC, board, or firmware-version gates introduced.
- §2 (Production-ready, no hacks): Pass — pure stack-frame reductions and removal of dead test fixture (
panel_test_adt, unused sincec7e3f37e7cb9). - §3 (Safety / correctness): Pass — verified all 4 commits introduce zero functional change:
drivers/iommu/apple-dart-dcp.h:apple_dart_dcp_import()takesconst struct dcp_adt_tables *firmwareplus explicitstart/end, stores*firmwareintodcp->firmwareand overridesdcp->firmware.start/endbeforeapple_dart_dcp_excluded_regions(dcp). Every formerbounds.start/bounds.endreference insideapple_dart_dcp_import()is updated consistently, and all 5 call sites (apple_dart_dcp_prepareSID23,apple_dart_dispext_prepareSID16/SID0,apple_dart_frontend_prepareSID0/SID16) pass identical ranges.drivers/gpu/drm/apple/iomfb_template.c:dcp_swap_complete_id()extracts the swap-ID completion path cleanly out ofdcpep_cb_swap_complete(), eliminating the 0x730-bytedc_swap_complete_respstack allocation indcp_swapped(). Each versionediomfb_v*.cincludesiomfb_template.conce as its own translation unit, sostatic void dcp_swap_complete_id()has no linkage collision.drivers/gpu/drm/apple/av-lifetime-test.c: movesstruct apple_epic_servicetokunit_kzalloc()withKUNIT_ASSERT_NOT_NULL().drivers/gpu/drm/apple/dcp-panel-test.h: removes unusedpanel_test_adt[]while retainingpanel_test_mode.
- §4 (Clean-room & attribution): Pass — all 4 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:only (zero AI trailers in commits); PR body includesAssisted-by:. - §5 (Evidence): Waiting on CI — KASAN+UBSAN+PROVE_LOCKING+DEBUG_OBJECTS arm64 build (
CONFIG_WERROR=y,CONFIG_FRAME_WARN=2048) and QEMU KUnit run are well documented for this no-functional-change refactor, but GitHub CI is still queued (host-testsQUEUED, 0/1 completed). Cannot approve until required CI finishes green. - §6 (Naming): Pass.
Verdict
0 code or policy blockers. Ready to approve once CI completes green.
Assisted-by: LLM (Gemini 4 Neon)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Follow-up after host-tests CI run 45103041644 completed with FAILURE on 7663a8b04ed2:
dcpext26-present-testsfailed to compile (exit 1):tools/asahi/dcpext26-present-tests.pyextracts code fromdrivers/gpu/drm/apple/dcp.cand now fails witherror: call to undeclared function 'dcp_swap_complete_id'(-Wimplicit-function-declaration). The stack-frame helper split indcp.cneeds the host test extractor/stubs updated to match.apple-dcphost suite failed (exit 1):FAIL apple-dcp (167.3s): exit 1in the same run — please inspect and resolve the failing subtest alongsidedcpext26-present-tests.
Holding approval until host-tests passes green.
Assisted-by: LLM (Gemini 4 Neon)
Problem
A KASAN kernel with
CONFIG_WERROR=ydoes not build: four functions in our Apple code go over the default 2048-byte frame limit, and one parser-test fixture has been unused since c7e3f37. That blocks the full-debug (KASAN/UBSAN/lockdep) KUnit row unless WERROR is turned off.Change
apple_dart_dcp_import()took the 552-bytestruct dcp_adt_tablesby value, and its callers copied it again to adjust start/end. It now takes a const pointer plus the table range: dispext_prepare 2144 → 944 bytes, frontend_prepare 2144 → 976.dcp_swapped()built a zeroed 0x730-bytedc_swap_complete_respon the stack just to pass a swap id. The id handling is split out intodcp_swap_complete_id(): 2080 → 96 bytes. The receive path is unchanged.apple_epic_serviceis now allocated withkunit_kzalloc(): 2240 → 416 bytes.panel_test_adtarray is removed (panel_test_modestays).No functional change.
Testing
arm64, KASAN + UBSAN + PROVE_LOCKING + DEBUG_OBJECTS,
CONFIG_WERROR=y,CONFIG_FRAME_WARN=2048:make -kreports the 4 frame-size errors (negative control)make -kexits 0 with no warningscheckpatch --strict: one CHECK on the
DCP_FW_NAME()macro in an unchanged signature, and one commit-reference line over 75 chars.Still to run
Nothing on hardware: the DART and iomfb changes pass the same values through a pointer or an id instead of a copy. A display row on the next fleet kernel covers it like any other change.
Reviewer detail
apple_dart_dcp_import()still stores the adjusted copy indcp->firmware(*firmware, then start/end), soapple_dart_dcp_excluded_regions()and later users see exactly what they saw before.apple_dart_dcp_prepare()(SID23) passes its owntables.start/tables.end, as before.dcpep_cb_swap_complete()(the trampoline target) now callsdcp_swap_complete_id(dcp, resp->swap_id). Same trace point, same peer/v27 handling.KCFLAGS=-fstack-usage(arm64 gcc, KASAN inline). Logs are in the lab trace dirtraces/kernel/20261123-apple-kasan-frame-size/.Assisted-by: LLM (Claude:Opus 5.5)