S340 · SOURCE-BOUND GATE EVIDENCE
S340 · Task-exit production writer guard integration
production acquire → S247 guard modülü → Operations-bound focused test Bu sayfa yalnız S340 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.
S340Production writer guardOperations id exactsource SHA exacttest target exact
operation: g8l-s340-task-exit-writer-guard-integration-partial
production · S247 guard · focused test · Operations · 4 exact excerpt
sequence-bound=true · implementation-bound=true
01 · Test edilen uygulama/model kodu
Kapının yürüttüğü gerçek kaynak
tam Rust öğesiL5798–L5881
kernel/src/task/scheduler.rs::task_exit
pub unsafe fn task_exit() -> ! {
#[cfg(feature = "board-rpi5")]
let s256_scheduler_read_access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s255_task_exit_identity_read_access_guard_expansion::acquire_s256_production_scheduler_read_access()
.unwrap_or_else(|error| {
panic!(
"S256 exiting-task identity scheduler read access failed closed: {:?}",
error
)
});
let exiting_task = (&*core::ptr::addr_of!(SCHEDULER))
.current_task
.as_ref()
.map(|task| task.id);
#[cfg(feature = "board-rpi5")]
drop(s256_scheduler_read_access);
if let Some(task_id) = exiting_task {
let teardown = match crate::ui::capability::teardown_task_ipc_lifecycle(task_id) {
Ok(teardown) => teardown,
Err(error) => fail_closed_on_ipc_lifecycle(task_id, error),
};
crate::kprintln!(
"[K2-LIFECYCLE] exiting task#{} revoked {} owned endpoint(s), cancelled {} responder reply(s), drained {} call(s), removed {} owned notification(s)/{} grant(s), cancelled {} notification waiter(s), woke {} peer(s)",
task_id,
teardown.owned_endpoints,
teardown.cancelled_responder_calls,
teardown.drained_calls,
teardown.owned_notifications,
teardown.revoked_notification_grants,
teardown.cancelled_notification_waiters,
teardown.woken_notification_waiters,
);
recover_bound_runtime_oom_supervisor_on_task_exit(task_id);
}
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
let s340_irq_guard = crate::arch::aarch64::IrqGuard::new();
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
let s340_writer_access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration::acquire_s340_production_scheduler_writer_access()
.unwrap_or_else(|error| {
panic!(
"S340 task-exit scheduler writer guard failed closed: {:?}",
error
)
});
{
let sched = &mut *core::ptr::addr_of_mut!(SCHEDULER);
if let Some(curr) = &mut sched.current_task {
let is_u = curr.is_user;
crate::kprintln!(
"[M4.3-DEBUG] task_exit() called → name='{}' id={} is_user={} state=Dead",
curr.name,
curr.id,
is_u
);
curr.finished.store(true, Ordering::Release);
curr.state = TaskState::Dead;
} else {
crate::kprintln!("[M4.3-DEBUG] task_exit() called but no current_task!");
}
}
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
drop(s340_writer_access);
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
drop(s340_irq_guard);
// KRİTİK fix: User task öldüğünde TTBR0 hâlâ onun root'una yüklüydü.
// yield_now / context_switch arasında kernel kodu bu root'ta kalır;
// root user-only mapping'lere sahip olduğu için (kernel .text dışı bölgeler)
// kernel'in kendi heap/data'sına ilk erişimde data abort olur. Çözüm:
// exit anında hemen kernel TTBR0'una geri dön. switch_to_kernel_address_space
// gerçek ROOT_PAGE_TABLE adresini get_kernel_root_table() ile alır
// (hardcoded KERNEL_ROOT yerine).
retire_current_asid_after_kernel_switch();
// Tek seferlik yield: task deferred-reaper yuvasına alınır ve context başka
// task'e geçer. Bu noktadan sonra buraya ASLA dönmeyiz (Dead task kuyruğa
// konmadı). No-ready fallback'i aşağıdaki WFI döngüsünde task'i tutar.
yield_now();
// Olmaz ama: hiç başka task yoksa scheduler boşa düşer → idle döngü.
loop {
core::arch::asm!("wfi", options(nomem, nostack));
}
}snippet sha256: c0b92a7d1a5c…file sha256: 838dd474448c…
02 · Ortak exclusion üyeliği
S247 production writer guard
tam Rust öğesiL160–L172
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration.rs::acquire_s340_production_scheduler_writer_access
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn acquire_s340_production_scheduler_writer_access(
) -> Result<G8lS340ProductionSchedulerWriterAccess, G8lS247WholeSchedulerAccessError> {
let caller_cpu =
crate::percpu::try_current_cpu_id().ok_or(G8lS247WholeSchedulerAccessError::InvalidCpu)?;
if caller_cpu != crate::g8l_runtime_contract::CPU0 {
return Err(G8lS247WholeSchedulerAccessError::InvalidCpu);
}
let access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s246_whole_scheduler_read_access_guard::S247_PRODUCTION_WHOLE_SCHEDULER_ACCESS_GATE
.try_acquire_exclusive_for_valid_cpu(caller_cpu)?;
Ok(G8lS340ProductionSchedulerWriterAccess { _access: access })
}snippet sha256: 08d1a0051aa9…file sha256: 6eb66c201830…
03 · Doğrulayan test kodu
Operations komutuna bağlı focused test
tam Rust öğesiL211–L228
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration.rs::target_function_contains_one_mutable_alias_and_one_s340_guard
#[test]
fn target_function_contains_one_mutable_alias_and_one_s340_guard() {
let target = task_exit_boundary();
assert_eq!(target.matches("addr_of_mut!(SCHEDULER)").count(), 1);
assert_eq!(
target
.matches("acquire_s340_production_scheduler_writer_access()")
.count(),
1
);
assert_eq!(
target
.matches("if let Some(curr) = &mut sched.current_task")
.count(),
1
);
}snippet sha256: 96f049f9c0b0…file sha256: e1b508672127…
04 · Kapı kimlik kaydı
Operations sıra, kimlik ve başlık bağı
tam Operations kaydıL13900–L13978
website/src/lib/operations.ts::g8l-s340-task-exit-writer-guard-integration-partial
{
id: "g8l-s340-task-exit-writer-guard-integration-partial",
date: "2026-08-27",
sequence: 340,
status: "passed",
umbrella_status: "partial",
title: "S340 · Task-exit production writer guard integration",
summary:
"S340, ordinary task_exit içindeki tek mutable SCHEDULER ölüm-durumu publication sınırını S339 ve 44 production reader'ın kullandığı aynı S247 state word'e bağlar. Tarihsel S256 exiting-task identity reader'ı task id'yi kopyalayıp IPC teardown'dan önce düşer; IPC lifecycle teardown ve bound runtime-OOM recovery tamamlandıktan sonra local IRQ guard ile CPU0-only S340 writer alınır. Writer yalnız exact task logu, finished=true Release store'u ve TaskState::Dead commit'ini kapsar; writer ve IRQ guard ayrı S341 ASID-retirement writer'ından, S334 yield_now writer'ından ve terminal WFI'dan önce bırakılır. Guarded writer 13/69, açık writer 56 ve provider authority 0'dır. Production kaynakta 16 direct task_exit callsite vardır, ancak supported-profile S340 runtime observation=0'dır; downstream retire_current_asid_after_kernel_switch writer'ı S341 için ayrı açık kalır.",
evidence: [
"Focused task-exit writer-integration kapısı 30/30 PASS verdi. Önceki S339 30/30, tarihsel S256 identity-read 11/11, S334 yield-now 26/26 ve runtime-OOM lifecycle recovery 7/7 regresyonları ayrıca geçti.",
"Aynı S247 state word üzerinde CPU0-only writer membership, non-CPU0 pre-commit rejection, reader→writer ve writer→reader exclusion, exact-once commit/error release ve S339→S340 token monotonluğu doğrulandı.",
"Production kaynak sırası S256 read/copy/drop → exact IPC lifecycle teardown → runtime-OOM recovery → IRQ guard → acquire_s340 writer → tek mutable alias/current-task seçimi → tarihsel task logu → finished Release store → Dead state → writer drop → IRQ restore olarak kilitlendi.",
"S340 membership teardown veya recovery'yi kapsamaz ve S341 retire_current_asid_after_kernel_switch, S334 yield_now ya da WFI sınırına taşınmaz. Missing-current-task exact tarihsel diagnostic korunur; S341 mutable aliası bu kapıda özellikle açık bırakılır.",
"main.rs içindeki 14, arch/aarch64/mod.rs içindeki 1 ve arch/aarch64/exceptions.rs içindeki 1 source callsite ile toplam 16 production task_exit çağrısı sayıldı. Bu source-wiring envanteridir; QEMU/RPi supported-profile invocation veya cihaz gözlemi değildir.",
"Fresh izole AArch64 profilleri 4/4 exit 0 verdi: board-qemu 111231 B / 3fcda797…d2f10 / 293 warning header; board-rpi4 149958 B / 39ea7a1c…d3b25 / 391; board-rpi5 526706 B / 6f643b74…08941 / 1168; board-rpi5+smp 526596 B / bef18ad6…0dd4 / 1168. Zero-warning iddiası yoktur.",
"S238–S340 dependency matrisi iki bağımsız seri koşuda 104 grup / 1605/1605 PASS verdi; 24471 B normalize özetler aynı d72290ac…4817 SHA-256 ile byte-eşittir.",
"Exact yedi tarihsel assertion adı dışlanıp --test-threads=1 kabulü kullanıldığında workspace 302 sonuç grubu / 3433 PASS / 0 fail / 7 filtered verdi; 66901 B log 6a80a117…d4b31'dır.",
"Filtresiz workspace exit 101 ile yalnız frozen S96 wiring_does_not_mutate_timer_gic_boot_or_expand_runtime_scope source-identity reddinde durdu; 62123 B log d4bc5b54…84981'dir ve global workspace GREEN iddia edilmez.",
"make verify-qemu ortak regresyonu 116447 B / 436c4df6…0731 ile strict ELF W^X 31/31, S130–S154, IPC 20/20, scheduler SEC5 ve kernel fault 0 PASS verdi. Bu S340 task_exit writer invocation kanıtı değildir.",
"Website 528/528 test ile PASS; lint, boş çıktılı TypeScript kontrolü ve 23/23 static route ayrıca geçti. İlk Cloudflare Pages production/main S340 içerik yayını 9cdb0709 ile tamamlandı; çıktı 193 statik dosyadır.",
"Cache-busted custom-domain /operations/ ve /timeline/ rotaları HTTP 200 döndü ve dağıtım sonrası yerel out ile byte-exact eşleşti. Operations 10457311 B / 7f65c6cc…db4, Timeline 2677241 B / ce56a447…f463'tür. Immutable https://9cdb0709.aselsan-microkernel.pages.dev erişimi bu doğrulama ortamından 10 saniyede curl exit 28 / HTTP 000 verdi; custom-domain PASS'i bu sonucu gizlemez.",
"Timeline'da 179 ayrı data-gate-policy kartı vardır; S340, S339, S338, S337, S325, S324 ve S323 tam birer kez bulunur. S340 policy 3364 karakter, S324–S340 minimum yoğunluğu 1055 karakterdir ve birleşik gate-policy kutusu yoktur.",
"S245 request ve S244 admission dokunulmadan kalır; production provider authority=0, whole-scheduler exclusion=false ve toplam 56 production writer açık kalır.",
"Fiziksel/device işlem yapılmadı: physical/device operations=0 ve RUNBOOK_EXECUTED_IN_S340=NO.",
],
commands: [
"cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration -- --nocapture",
"cargo build -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi5",
"cargo check -p aselsan_kernel --target aarch64-unknown-none --no-default-features --features board-rpi5,smp",
"cargo test --workspace --quiet -- --test-threads=1 [seven exact historical --skip filters]",
"make verify-qemu",
"npm run deploy",
],
terminalSessions: [
{
id: "g8l-s340-task-exit-writer-guard-integration",
title: "G8l S340 task-exit writer guard integration",
commandLines: [
"cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration -- --nocapture",
],
outputLines: [
"test result: ok; S340 focused 1 group / 30 passed; 0 failed",
"shared S247 gate: 44 guarded readers + 13/69 guarded writers; 56 writers open",
"S256 drop < teardown < recovery < IRQ < writer < finished Release < Dead < writer drop < IRQ restore < S341 < S334 < WFI",
"production source callsites=16; supported-profile runtime observations=0",
],
exitCode: 0,
outputMode: "complete",
},
{
id: "g8l-s340-operations-timeline-production-publication",
title: "S340 Operations/Timeline production publication",
commandLines: [
"npm run deploy",
"curl --cache-busted https://aselsan.kerege.net/{operations,timeline}/ and compare with local out",
],
outputLines: [
"website 528/528; lint PASS; TypeScript PASS; static routes 23/23; files=193",
"Cloudflare Pages production/main initial content deployment: 9cdb0709 · https://9cdb0709.aselsan-microkernel.pages.dev",
"custom-domain operations HTTP 200 · 10457311 B · SHA-256 7f65c6cc4ded47a90f097f53caac610bfd22be1d2d6cdc0dfb9d2a29efcecdb4 · byte-exact PASS",
"custom-domain timeline HTTP 200 · 2677241 B · SHA-256 ce56a44797b4c535e5d7994b40f034078983bb05aeb70fa7b537da20c431f463 · byte-exact PASS",
"timeline cards=179; S340/S339/S338/S337/S325/S324/S323 exact-once; S340 policy=3364 chars; S324-S340 minimum=1055 chars",
"immutable deployment URL probe: curl exit 28 after 10 s · HTTP 000; custom-domain evidence remains authoritative",
],
exitCode: 0,
outputMode: "complete",
},
],
terminalSessionsNote:
"S340 on üçüncü production writer'ın kaynak entegrasyonudur. On altı source callsite bulunur, fakat supported-profile runtime/cihaz gözlemi yoktur; global exclusion ya da provider authority oluşmadı.",
limitations: [
"56 production writer aynı shared gate dışında kaldığı için whole-scheduler exclusion ve provider authority açık kalır.",
"On altı production source callsite wiring kanıtıdır; supported-profile S340 invocation/observation kanıtı yoktur.",
"Downstream retire_current_asid_after_kernel_switch writer entegrasyonu S341 için açık bırakılmıştır.",
"Default-parallel PTY determinism S331'den açık taşınır; kayıtlı seri kabul matrisi kullanılır.",
"Transient-contention liveness/soak, Generic SMP ve fiziksel RPi kabulü açık kalır.",
],
},snippet sha256: da75fb5cc447…file sha256: 9726dbf00f84…
Focused test komutu
cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s340_task_exit_writer_guard_integration -- --test-threads=1proof: docs/M8.1-RPi5-G8l-S340-Task-Exit-Writer-Guard-Integration-Proof.md
Registry schema v5 · generator
website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06