ASELSANMicrokernel
S321 · SOURCE-BOUND GATE EVIDENCE

G8l: QEMU S140 replacement exact-ACK writer-authority audit

Operations --test hedefi → test hedefiyle aynı adlı uygulama/model modülü → kaynak kesiti Bu sayfa yalnız S321 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.

S321Focused kod testiOperations id exactsource SHA exacttest target exact

operation: g8l-s321-qemu-s140-replacement-exact-ack-writer-authority-audit-partial

uygulama/model · focused test · Operations · 3 exact excerpt

sequence-bound=true · implementation-bound=true
01 · Testin bağlı olduğu uygulama/model kodu

Kapının yürüttüğü gerçek kaynak

tam Rust öğesiL30–L103
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s321_qemu_s140_replacement_exact_ack_writer_authority_audit.rs::S321_MAIN_REMAINING_UNAUDITED_WRITER_SITES

pub const S321_WRITER_BOUNDARY_SITES: usize = 1;
pub const S321_WRITER_AUTHORITY_SITES: usize = 0;
pub const S321_MAIN_EXPLICIT_WRITER_SITES: usize = 17;
pub const S321_MAIN_PREVIOUSLY_AUDITED_WRITER_SITES: usize = 11;
pub const S321_MAIN_REMAINING_UNAUDITED_WRITER_SITES: usize = 5;
pub const S321_S140_EXPLICIT_WRITER_SITES: usize = 2;
pub const S321_S140_REMAINING_UNAUDITED_WRITER_SITES: usize = 1;
pub const S321_DIRECT_SCHEDULER_ACCESS_SITES: usize = S320_DIRECT_SCHEDULER_ACCESS_SITES;
pub const S321_IMMUTABLE_READ_SITES: usize = S320_IMMUTABLE_READ_SITES;
pub const S321_WHOLE_SCHEDULER_GUARDED_SITES: usize = S320_WHOLE_SCHEDULER_GUARDED_SITES;
pub const S321_WHOLE_SCHEDULER_UNROUTED_SITES: usize = S320_WHOLE_SCHEDULER_UNROUTED_SITES;
pub const S321_OPEN_WRITER_SITES: usize = S320_OPEN_WRITER_SITES;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS321SchedulerWriterAuthorityAuditOutcome {
    Idle,
    AwaitingWriterAuthority {
        request_id: u64,
        guarded_sites: usize,
        writer_sites: usize,
    },
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS321SchedulerWriterAuthorityAuditError {
    S320(G8lS320SchedulerWriterAuthorityAuditError),
    S245(G8lS245ExclusionAdmissionRequestError),
    PriorCoverageDrift {
        guarded_sites: usize,
        unrouted_sites: usize,
    },
}

/// Revalidate the prior fail-closed authority boundary without taking
/// admission or constructing a production exclusive wrapper.
pub fn preflight_s321_scheduler_writer_authority(
    caller_cpu: usize,
    request: Option<G8lS245WholeSchedulerExclusionAdmissionRequestView>,
) -> Result<G8lS321SchedulerWriterAuthorityAuditOutcome, G8lS321SchedulerWriterAuthorityAuditError>
{
    match preflight_s320_scheduler_writer_authority(caller_cpu, request)
        .map_err(G8lS321SchedulerWriterAuthorityAuditError::S320)?
    {
        G8lS320SchedulerWriterAuthorityAuditOutcome::Idle => {
            Ok(G8lS321SchedulerWriterAuthorityAuditOutcome::Idle)
        }
        G8lS320SchedulerWriterAuthorityAuditOutcome::AwaitingWriterAuthority {
            request_id,
            guarded_sites,
            writer_sites,
        } if guarded_sites == S321_WHOLE_SCHEDULER_GUARDED_SITES
            && writer_sites == S321_OPEN_WRITER_SITES =>
        {
            Ok(
                G8lS321SchedulerWriterAuthorityAuditOutcome::AwaitingWriterAuthority {
                    request_id,
                    guarded_sites,
                    writer_sites,
                },
            )
        }
        G8lS320SchedulerWriterAuthorityAuditOutcome::AwaitingWriterAuthority {
            guarded_sites,
            writer_sites: _,
            ..
        } => Err(
            G8lS321SchedulerWriterAuthorityAuditError::PriorCoverageDrift {
                guarded_sites,
                unrouted_sites: S321_DIRECT_SCHEDULER_ACCESS_SITES - guarded_sites,
            },
        ),
    }
}
snippet sha256: 5703e311c78bfile sha256: 0dcb62ab14d5
02 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam Rust öğesiL404–L485
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s321_qemu_s140_replacement_exact_ack_writer_authority_audit.rs::s321_continuation_precedes_broker_ack_session_close_reclaim_and_endpoint_cleanup

#[test]
fn s321_continuation_precedes_broker_ack_session_close_reclaim_and_endpoint_cleanup() {
    let scheduler = include_str!("../../kernel/src/task/scheduler.rs");
    let helper = kernel_call_and_wait_boundary(scheduler);
    for required in [
        "drop(blocked)",
        "drop(endpoints)",
        "drop(deadlines)",
        "drop(transaction)",
        "self.switch_after_ipc_park(caller_context)",
        ".filter(|task| task.id == caller_task && !task.is_user)",
        "caller.saved_user_gprs[0] != crate::ipc::IpcError::Ok.as_u64()",
        "caller.saved_user_gprs[7] != 0",
        "label: caller.saved_user_gprs[1]",
        "badge: caller.saved_user_gprs[2]",
        "caller.saved_user_gprs[3]",
        "caller.saved_user_gprs[6]",
    ] {
        assert!(
            helper.contains(required),
            "missing S321 continuation token: {required}"
        );
    }
    let drop_transaction = helper.find("drop(transaction)").unwrap();
    let switch = helper.find("self.switch_after_ipc_park").unwrap();
    let resumed = helper.find("let caller = self").unwrap();
    let reply = helper.find("Ok(crate::ui::capability::IpcMessage").unwrap();
    assert!(drop_transaction < switch && switch < resumed && resumed < reply);

    let main = include_str!("../../kernel/src/main.rs");
    let s140 = s140_supervisor_recovery_boundary(main);
    let writer = s140.rfind(".ipc_kernel_call_and_wait(").unwrap();
    let ack = s140
        .find("assert_eq!(exact_ack.data, retry_message.data)")
        .unwrap();
    let broker_ack = s140[writer..]
        .find("broker.acknowledge_exact(")
        .map(|position| writer + position)
        .unwrap();
    let session_close = s140[writer..]
        .find("close_supervisor_session(replacement_session)")
        .map(|position| writer + position)
        .unwrap();
    let reclaim = s140.find("let mut replacement_reclaimed").unwrap();
    let cleanup = s140
        .find("teardown_task_ipc_lifecycle(controller_task)")
        .unwrap();
    let final_snapshot = s140.find("let final_snapshot").unwrap();
    assert!(
        writer < ack
            && ack < broker_ack
            && broker_ack < session_close
            && session_close < reclaim
            && reclaim < cleanup
            && cleanup < final_snapshot
    );
    for required in [
        "Ok(event)",
        "assert_eq!(endpoint_cleanup.owned_endpoints, 1)",
        "assert_eq!(endpoint_cleanup.drained_calls, 0)",
        "assert_eq!(endpoint_cleanup.cancelled_responder_calls, 0)",
        "assert_eq!(final_snapshot.pmm.free_frames, baseline_free_frames)",
        "assert_eq!(final_broker.queued, 0)",
        "assert_eq!(final_broker.pending, 0)",
        "assert_eq!(final_broker.in_flight, 0)",
        "assert_eq!(final_broker.acknowledged, 1)",
        "assert_eq!(final_broker.supervisor_sessions_started, 2)",
        "assert_eq!(final_broker.supervisor_crashes, 1)",
        "assert_eq!(final_broker.recovered_inflight, 1)",
        "endpoint.id == exact_reply.id",
        "endpoint.id == cancelled_reply.id",
    ] {
        assert!(
            s140.contains(required),
            "missing S321 post-ACK token: {required}"
        );
    }
    let after_writer = &s140[writer..];
    assert_eq!(after_writer.matches("acknowledge_exact(").count(), 1);
    assert_eq!(after_writer.matches("close_supervisor_session(").count(), 1);
}
snippet sha256: 96c0b23c81c0file sha256: 06aab5d96de4
03 · Kapı kimlik kaydı

Operations sıra, kimlik ve başlık bağı

tam Operations kaydıL14996–L15058
website/src/lib/operations.ts::g8l-s321-qemu-s140-replacement-exact-ack-writer-authority-audit-partial
  {
    id: "g8l-s321-qemu-s140-replacement-exact-ack-writer-authority-audit-partial",
    date: "2026-08-27",
    sequence: 321,
    status: "passed",
    umbrella_status: "partial",
    title: "G8l: QEMU S140 replacement exact-ACK writer-authority audit",
    summary:
      "S321 focused 15/15 PASS ile main.rs kaynak sırasındaki bir sonraki explicit mutable scheduler sınırını doğrular: run_qemu_s140_supervisor_recovery içindeki iki ipc_kernel_call_and_wait writer'ından daha sonraki replacement-supervisor exact-ACK çağrısı. İlk controlled pre-ACK-exit supervisor CALL'i InvalidCapability döner, cancelled reply retired olur, crashed supervisor exact reclaim edilir, broker session açık recover çağrısıyla pending kuyruğa alınır ve old lease StaleLease olur. Fresh session/retry lease, strict EL0 replacement RECV grant, immutable retry message ve linked one-shot reply writer'dan önce doğrulanır. Helper aynı IRQ/IPC transaction altında non-user caller SEND authority'sini, normal endpoint'i, linked reply'ı, optional receiver authority/deadline'ını ve park kapasitesini yeniden doğrular; CALL publication/park ve optional delivery tek transaction içindedir. Continuation aynı caller'ı resume eder ve exact replacement ACK'i yeniden kurar; broker exact acknowledge/session close, replacement reclaim ve endpoint cleanup bundan sonra gelir. Writer authority yalnız model gate'inin exclusive lease'iyle mümkündür; reader lease'i writer'ı açmaz. main.rs 17 explicit writer / 11 previously audited / 5 remaining unaudited; S140 işlevi 2 / 1; production inventory 113 direct / 44 immutable guarded / 69 open writer olarak değişmez ve production exclusive wrapper, provider authority, whole-scheduler exclusion veya scheduler mutation üretilmez.",
    evidence: [
      "S321 focused kaynak/model kapısı iki bağımsız koşuda 15/15 PASS verdi: 130 B / SHA-256 0447f2fe9dc6fdf30815a6962cf23d978425e51bef2acde1efb27e5da13a78b3.",
      "main.rs içindeki 17 explicit addr_of_mut!(crate::task::scheduler::SCHEDULER) sitesinin positions[5], kaynakta alttan on ikinci sınırı audit edilir. run_qemu_s140_supervisor_recovery içindeki daha sonraki replacement exact-ACK CALL kapanır; S140 işlevinde 1, main.rs genelinde 5 unaudited alias kalır.",
      "İlk controlled pre-ACK-exit supervisor CALL'i InvalidCapability verir ve cancelled reply retired olur. Crashed supervisor exact reclaim ile RuntimePmm baseline'a döner; broker.recover_supervisor_session(crashed_session) exact bir lease'i pending kuyruğuna alır, recovered pending=1/in_flight=0/crashes=1/recovered_inflight=1 olur ve old lease StaleLease verir.",
      "Nonzero controller ve controller-owned normal Endpoint ENDPOINT_SEND authority korunur. Replacement session crashed session'dan, retry lease old lease'ten yenidir ve retry event old event ile exact eşittir. Fresh strict EL0 replacement'a ENDPOINT_RECV grant verilir; immutable retry IpcMessage ve controller-owned linked one-shot reply-cap writer'dan önce kurulur.",
      "ipc_kernel_call_and_wait exact endpoint id/generation, reply id ve immutable retry_message'i alır; yalnız exact ACK label, replacement-task badge ve retry_message.data eşleşmesi kabul edilir.",
      "Helper IrqGuard ve IPC_TRANSACTION_LOCK altında nonzero non-user caller, canlı SEND authority, normal endpoint, linked reply, optional receiver authority/deadline ve ready/blocked kapasiteyi yeniden doğrular. CALL publish/finish-park, caller BlockedOnIpc publication ve optional delivery/deadline retirement/Ready enqueue tek transaction içindedir.",
      "Transaction bırakıldıktan sonra aynı kernel caller resume edilir ve saved GPR'lerden exact reply yeniden kurulur. Broker acknowledge_exact ve replacement session close birer kez, ardından replacement reclaim ve controller endpoint cleanup çalışır. Final broker pending=0/in_flight=0/acknowledged=1/sessions=2/crashes=1/recovered_inflight=1 ve RuntimePmm baseline korunur.",
      "Model gate reader membership exclusive writer authority'yi ExclusiveBusy ile bloklar; reader bırakıldıktan sonra non-zero token'lı exclusive lease alınır. Wrong CPU InvalidCpu ile fail-closed kalır. Bu host/model evidence'tır.",
      "S320 authority preflight yeniden doğrulanır; pending S245 request korunur ve sonuç AwaitingWriterAuthority { guarded_sites: 44, writer_sites: 69 } olarak döner.",
      "Dört AArch64 profil derlemesi iki koşuda byte-equal exit 0 verdi: QEMU 110646 B / a992321d, RPi4 149371 B / bf4f2bc1, RPi5 475695 B / 5385dd65 ve RPi5+SMP 475637 B / 4c5b3039. Warning header'ları sırasıyla 291, 389, 1025 ve 1025'tir; zero-warning iddiası değildir.",
      "Birleşik board-rpi5,board-qemu özellikleri iki koşuda beklenen exit 101, 18607 B / 6955bab2, 17 error ve 22 warning header ile fail-closed kaldı.",
      "S238–S321 dependency matrisi iki koşuda 85 grup / 1199/1199 PASS; ham loglar 10972 B / 48c72875 ve 84d1837a, süre-normalize özetler byte-equal 11142 B / 507fa4bd01ecf0086c5c46ba925aa34b3727a3fe2c66030bcd8260c832d3066c. Bu production writer-authority invocation kanıtı değildir.",
      "Ortak make verify-qemu iki koşuda PASS verdi: 116222 B / b977449c ve 116139 B / d034bb61; guest logları 2165383 B / 8ef977d7 ve 2160072 B / 4d99d599. W^X 31/31, S271 GRAPH_ABSENT=YES, RuntimePmm baseline, EL0 x4096, IPC 20/20, koşu başına tek beklenen S142 fatal containment, SEC5 ve 13 KERNEL_FAULTS=0 marker'ı korunur. Bu ortak smoke S321 production writer-authority invocation kanıtı değildir.",
      "Exact yedi tarihsel G8h assertion adıyla dışlandığında workspace iki koşuda 283 sonuç grubu / 3010 PASS / 7 filtered verdi: ham loglar 64293 B / ce429204 ve 3bd85812, sonuç özetleri 26768 B / 0d7901cd ve ce04b8e0, süre-normalize 27332 B özet byte-equal / SHA-256 b25614321e87e68aac6aac113694030d08cbf2ad79c776939443fb9ca5892ea8. Filtresiz koşu exit 101, 59515 B / b97827bd ile frozen S96 exceptions.S identity kapısında RED kaldı; full-workspace GREEN iddia edilmez.",
      "S321 production exclusive wrapper, provider authority, whole-scheduler exclusion, QEMU fixture mutation veya scheduler mutation iddiası eklemez; physical/device operations=0 ve RUNBOOK_EXECUTED_IN_S321=NO.",
    ],
    commands: [
      "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s321_qemu_s140_replacement_exact_ack_writer_authority_audit -- --test-threads=1",
      "cargo check --quiet -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-qemu",
      "cargo check --quiet -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi4",
      "cargo check --quiet -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi5",
      "cargo check --quiet -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi5,smp",
      "cargo check --quiet -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi5,board-qemu",
      "make verify-qemu",
    ],
    terminalSessions: [
      {
        id: "g8l-s321-qemu-s140-replacement-exact-ack-writer-authority-audit",
        title:
          "G8l S321 QEMU S140 replacement exact-ACK writer-authority audit",
        commandLines: [
          "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s321_qemu_s140_replacement_exact_ack_writer_authority_audit -- --test-threads=1",
        ],
        outputLines: [
          "test result: ok; S321 focused 1 group / 15 passed; 0 failed",
          "repeat-stable quiet output: 130 B / 0447f2fe9dc6fdf30815a6962cf23d978425e51bef2acde1efb27e5da13a78b3",
          "QEMU S140 replacement exact-ACK writer authority remains model-only: exact forwarding precedes broker ACK/session close; S140 retains one earlier alias, main.rs retains 5 unaudited aliases and all 69 production writer sites remain open",
          "dependency: S238–S321 · 85 groups · 1199/1199 PASS; workspace: 283 groups · 3010 PASS · 7 historical filtered",
        ],
        exitCode: 0,
        outputMode: "selected",
      },
    ],
    terminalSessionsNote:
      "S321 kaynak/model fail-closed authority boundary'sidir; production writer guard/migration, QEMU fixture mutation ve fiziksel/device execution claim edilmez.",
    limitations: [
      "S321 run_qemu_s140_supervisor_recovery içindeki daha sonraki replacement exact-ACK ipc_kernel_call_and_wait mutable scheduler aliasını audit eder; S140 işlevindeki önceki cancelled CALL, main.rs genelinde 5 ve toplam 69 production writer site authority wrapper dışında açık kalır.",
      "Exclusive lease yalnız host/model gate'inde test edilir; production exclusive wrapper, provider authority ve whole-scheduler exclusion açık kalır.",
      "S238–S321 dependency matrisi exact 85 grup / 1199/1199 PASS'tir; bu production writer authority invocation kanıtı değildir.",
      "Filtresiz workspace frozen S96 identity kapısında RED'dir; workspace umbrella GREEN iddia edilmez.",
      "Supported-profile writer-authority runtime invocation, Generic SMP ve fiziksel RPi kabulü açık kalır; S321 physical/device operations=0 ve RUNBOOK_EXECUTED_IN_S321=NO.",
    ],
  },
snippet sha256: 41228f882153file sha256: 9726dbf00f84
Focused test komutu
cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s321_qemu_s140_replacement_exact_ack_writer_authority_audit -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S321-QEMU-S140-Replacement-Exact-Ack-Writer-Authority-Audit-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06