fix(process): preserve partial evidence and verify detached cleanup (#1011)
* test(ci): allow transport delivery in source identity regression * fix(process): preserve partial evidence and verify detached cleanup * fix(process): scope Linux token sweeps by stable process identity * fix(process): retain environment permission failure codes * fix(process): wait for signaled processes before verifying cleanup * fix(process): verify sampled detached groups during cleanup * fix(electron): preserve prelaunch identities through cleanup * fix(process): retry growing Darwin process table snapshots * fix(process): retain compatibility with saved v3 capture evidence * fix(process): migrate saved v3 captures during reconstruction verification * fix(process): preserve cancellation during Darwin helper compilation * fix(process): propagate cancellation through ownership baselines * perf(javascript): cache canonical export comparison sort keys * fix(process): cancel provider ownership preparation before spawn * fix(process): isolate native compiler waiter cancellation
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import Darwin
|
||||
import Foundation
|
||||
|
||||
@main
|
||||
struct ProcessRunTokenSnapshotProbe {
|
||||
static func main() throws {
|
||||
var sizeQueries = 0
|
||||
var readAttempts = 0
|
||||
let retried = readProcessSnapshot { _, output, size in
|
||||
guard output != nil else {
|
||||
sizeQueries += 1
|
||||
size = MemoryLayout<kinfo_proc>.stride
|
||||
return 0
|
||||
}
|
||||
readAttempts += 1
|
||||
if readAttempts == 1 {
|
||||
errno = ENOMEM
|
||||
return -1
|
||||
}
|
||||
size = 0
|
||||
return 0
|
||||
}
|
||||
|
||||
let otherError = readProcessSnapshot { _, output, size in
|
||||
if output == nil {
|
||||
size = MemoryLayout<kinfo_proc>.stride
|
||||
return 0
|
||||
}
|
||||
errno = EACCES
|
||||
return -1
|
||||
}
|
||||
|
||||
let output: [String: Any] = [
|
||||
"retriedAfterFreshSize": retried.failure == nil && sizeQueries == 2 && readAttempts == 2,
|
||||
"preservedOtherErrno": otherError.failure == "process_table_failed_\(EACCES)"
|
||||
]
|
||||
let data = try JSONSerialization.data(withJSONObject: output, options: [.sortedKeys])
|
||||
FileHandle.standardOutput.write(data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user