<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Dhruv Setty: Blog</title>
<link>https://dhruv-setty.github.io/blog/</link>
<atom:link href="https://dhruv-setty.github.io/feed.xml" rel="self" type="application/rss+xml" />
<description>Notes on identity, access and assurance.</description>
<language>en-nz</language>
<lastBuildDate>Thu, 19 Nov 2026 00:00:00 GMT</lastBuildDate>
<item>
<title>Driver-State Detection on a Microcontroller: Heavy Fitting on the Host, an Int8 Classifier on the Device</title>
<link>https://dhruv-setty.github.io/blog/lifting-spde-gmrf-gpu-edge/</link>
<guid isPermaLink="true">https://dhruv-setty.github.io/blog/lifting-spde-gmrf-gpu-edge/</guid>
<pubDate>Thu, 19 Nov 2026 00:00:00 GMT</pubDate>
<description>A Cortex-M4F classifies driver state from lane position in 40 multiply-accumulates per sample and 1,802 bytes of flash. Reordering the host's sparse solve cuts stored values from 45,258 to 11,378. Simulated data; the CUDA path has not run on a GPU.</description>
<content:encoded><![CDATA[<h2>Overview</h2>
<p>The system watches lane position from a forward camera and classifies the driver as calm, alert, stressed or in panic, sample by sample, on an ARM <code>Cortex-M4F</code>. Lane position also depends on the road, so a host machine fits a model of how each stretch of the route shifts the car&#39;s position and sends the device one int16 correction per site. The device never sees the route model, only those corrections.</p>
<p>The work splits by cost. Fitting the route model means repeatedly solving a large sparse linear system, which belongs on a host or GPU and runs every few seconds to minutes. Classification is one small update per sample, sized for a microcontroller: 40 multiply-accumulates and 1,802 bytes of flash, in int8.</p>
<p>The question that decides whether the design holds is whether the int8 classifier makes the same calls as a full-precision one. On simulated drives it does: they agree on 99.66% of 5,000 samples, the gap stays under 0.04 points when sensor noise doubles, and the device catches 151 of 157 panic episodes. A live demo steps through a drive.</p>
<div class="link-cards"><a class="link-card" href="https://huggingface.co/spaces/itsdhruvsetty/split-spde-gmrf-lane-perception"><span class="link-card__thumb"><img src="/journal/covers/work-hf-demo.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">Driver-state detection: live demo</span><span class="link-card__desc">Steps through a simulated drive.</span><span class="link-card__domain">huggingface.co</span></span></a></div>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Component</th>
<th>Status</th>
</tr>
</thead>
<tbody><tr>
<td>Python reference: route model, sparse solve, per-site corrections, float and int8 classifiers</td>
<td>20 pytest tests pass</td>
</tr>
<tr>
<td>CUDA route-model fit with cuSPARSE and cuDSS</td>
<td>Compiles with nvcc 12.9 against cuDSS 0.7.1.6; not linked or run, as CI has no GPU</td>
</tr>
<tr>
<td>Int8 classifier on Cortex-M4F</td>
<td>Bit-exact with the Python reference under QEMU, portable C and CMSIS-NN v8.0.0; not run on hardware</td>
</tr>
<tr>
<td>GPU timings, on-device latency, accuracy on recorded drives</td>
<td>Not measured. An operation count is not a latency</td>
</tr>
</tbody></table></div>
<p>All data are simulated with fixed seeds. Figures 2 to 9 come from the captures workflow on an <code>ubuntu-24.04</code> runner.</p>
<h2>Design rationale</h2>
<h3>Partition</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/spde-pipeline.png" alt="Pipeline: FEM grid feeds GPU estimation, which feeds a lift to sensor locations, which feeds an on-device forward filter on ARM Cortex-M, with a dashed loop back for periodic re-estimation" width="1043" height="524" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 1 · Heavy path and light path</span> Case study figure, published by the repository as its Figure 1. <code class="ic">C</code> and <code class="ic">G</code> are assembled once; the GPU rebuilds and factorises <code class="ic">Q(θ)</code> and returns <code class="ic">θ̂</code> and <code class="ic">x̂</code> for lifting and quantisation. The figure names cuSOLVER for the factorisation; the repository uses cuDSS.</figcaption></figure>

<p>cuSPARSE holds <code>Q</code> in CSR and performs the sparse products; cuDSS performs the SPD Cholesky factorisation, with the analysis phase executed once and the refactorisation and solve phases executed per <code>θ</code>. The cuSOLVER sparse Cholesky module is deprecated by NVIDIA and is not used. <code>θ = (κ, τ)</code> has two components and is optimised on the host.</p>
<h3>Precision structure and ordering</h3>
<p>The SPDE precision for <code>α = 2</code> is <code>Q = τ² (κ⁴ C + 2κ² G + G C⁻¹ G)</code>; its per-row nonzero count is invariant in grid size, whereas Cholesky fill-in is ordering dependent. The factorisation shall use a fill-reducing ordering (reverse Cuthill-McKee, AMD or METIS nested dissection) before any port to the GPU. The symbolic phase shall be hoisted out of the likelihood loop.</p>
<h3>Lifting</h3>
<p>The projector <code>P</code> is sparse: each sensor row holds the three barycentric weights of its enclosing triangle, summing to one. <code>nnz(P)</code> is 600 for 200 sensors; <code>nnz(P_dev)</code> is 192 for 64 sites. The device receives one int16 offset per site and never the grid.</p>
<h3>Device recursion</h3>
<p>With K = 4, the step is <code>α_t(k) ∝ b_k(y_t) Σ_j a_jk α_(t-1)(j)</code>. <code>Aᵀ α_(t-1)</code> has fully connected layer shape and executes as <code>arm_fully_connected_s8</code> when <code>HMM_USE_CMSIS_NN</code> is defined, otherwise as a portable C99 kernel with identical integer semantics.</p>
<h2>Results</h2>
<h3>Reference test suite</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/terminal_pytest.png" alt="Terminal running pytest on the Python reference with 20 passed tests" width="1220" height="783" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 2 · pytest run</span> 20 tests in <code class="ic">python/tests/</code>, run with <code class="ic">CC=gcc</code> to enable the C kernel cross-check; 20 pass in 6.50 s. Printed lines: estimates of <code class="ic">κ</code> and <code class="ic">τ</code>, factor counts for seeds 0, 1 and 2, int8 against float agreement.</figcaption></figure>

<ul>
<li>Estimation: <code>κ̂ = 4.5744</code> against 4.7140 (relative error 3.0%), <code>τ̂ = 0.001452</code> against 0.001496 (2.9%); 177 numeric factorisations after 2 symbolic analyses, the same analyse-once, refactorise-per-<code>θ</code> pattern as the cuDSS path.</li>
<li>Fill-in: scrambled order 45,258, 44,510 and 43,640 factor nonzeros for seeds 0, 1 and 2; reverse Cuthill-McKee 11,378 in each case.</li>
<li>Filtering: int8 against float argmax agreement 0.9966 over 5,000 samples, 0 floor hits.</li>
</ul>
<p>The suite asserts the structural invariants: three projector weights per row summing to one, sparse and local posterior precision, a retained direct calm-to-panic transition, and bit-exactness of the C kernel with the Python mirror.</p>
<h3>Operation counts</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/terminal_mac_table.png" alt="Terminal output of mac_table.py listing MACs per stage on the host and on the device" width="834" height="375" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 3 · Operation counts</span> <code class="ic">python/tools/mac_table.py</code>, computed from each sparsity pattern: host stages per evaluation of <code class="ic">θ</code> on the 16 by 16 grid and the 20 by 20 lattice; device stages per sample.</figcaption></figure>

<div class="table-wrap"><table>
<thead>
<tr>
<th>Stage</th>
<th>Matrix</th>
<th>nnz</th>
<th>MACs</th>
<th>Per</th>
</tr>
</thead>
<tbody><tr>
<td>Cholesky of <code>Q</code>, RCM</td>
<td><code>L</code> of <code>Q</code>, 16 by 16 grid</td>
<td>5,896</td>
<td>72,538</td>
<td><code>θ</code></td>
</tr>
<tr>
<td>Cholesky, 20 by 20 lattice, RCM</td>
<td><code>L</code> of <code>Q</code></td>
<td>11,378</td>
<td>174,362</td>
<td><code>θ</code></td>
</tr>
<tr>
<td>Cholesky, 20 by 20 lattice, scrambled (seed 0)</td>
<td><code>L</code> of <code>Q</code></td>
<td>45,258</td>
<td>3,877,939</td>
<td><code>θ</code></td>
</tr>
<tr>
<td>Device, total per sample</td>
<td><code>Aᵀ</code> (4 by 4, int8), emission, update</td>
<td></td>
<td>40</td>
<td>sample</td>
</tr>
</tbody></table></div>
<p>Device cost is 40 MACs per sample independent of grid size; a test asserts this for 8 by 8 and 16 by 16 grides.</p>
<h3>Field estimate</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/plot_field_estimate.png" alt="Three panels: sensor observations over the grid, the simulated field, and the posterior mean with 64 route sites" width="2320" height="819" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 4 · Field, observations and posterior mean</span> <code class="ic">spdegmrf.export.run_pipeline</code> (seed 2026), 16 by 16 grid over 1.5 km, n = 256. Left: 200 sensor observations of the eighth replicate, <code class="ic">σ</code> = 15 mm. Centre: simulated field, <code class="ic">κ</code> = 4.714, <code class="ic">τ</code> = 0.00150. Right: posterior mean at <code class="ic">κ̂</code> = 4.574, <code class="ic">τ̂</code> = 0.00145, with 64 route sites coloured by <code class="ic">P_dev x̂</code>, from -88.6 to 9.6 mm.</figcaption></figure>

<h3>Marginal likelihood</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/plot_loglik_surface.png" alt="Contour plot of the marginal log-likelihood over kappa and tau with the estimate and the true value marked" width="929" height="732" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 5 · Marginal log-likelihood</span> <code class="ic">Estimator.loglik</code> on a 25 by 25 grid of <code class="ic">(κ, τ)</code>, relative to the grid maximum, contours at -2, -5, -10 and -20. Cross: Nelder-Mead estimate. Plus sign: simulation value.</figcaption></figure>

<p>Each evaluation rebuilds the values of <code>Q(θ)</code> on a fixed sparsity pattern, factorises, and reads <code>log|Q| = 2 Σ log L_ii</code> from the factor diagonal. 625 evaluations required 1,250 numeric factorisations and 2 symbolic analyses.</p>
<h3>Sparsity</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/plot_sparsity.png" alt="Three sparsity patterns: Q on a 10 by 10 lattice, the Cholesky factor in scrambled order and after reverse Cuthill-McKee" width="2030" height="708" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 6 · Sparsity of Q and of its factor</span> Left: <code class="ic">Q</code> on the 10 by 10 lattice, 1,104 nonzeros, at most 13 per row. Centre and right: Cholesky factor of <code class="ic">Q</code> on the 20 by 20 lattice after the seed 0 relabelling, 45,258 nonzeros, and after reverse Cuthill-McKee, 11,378 nonzeros.</figcaption></figure>

<h3>Fill-in distribution</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/plot_fill_in_seeds.png" alt="Histogram of scrambled-order factor nonzeros over 1,000 seeds with lines for this repository, the case study value and RCM" width="1085" height="642" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 7 · Scrambled-order fill-in</span> Factor nonzeros on the 20 by 20 lattice for 1,000 uniform random relabellings (seeds 0 to 999): minimum 34,195, median 42,308, maximum 48,532. Marked: case study count 37,615 (2.5th percentile), repository seed 0 at 45,258, and RCM at 11,378 or 11,370.</figcaption></figure>

<h3>Forward filters</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/plot_forward_filter.png" alt="Four stacked panels: two observation channels, simulated regime and int8 mode, float filter posterior, int8 filter belief" width="1803" height="1383" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 8 · Float and int8 forward filters</span> Data of <code class="ic">python/tests/test_forward_filter.py</code> (seed 7), first 600 of 5,000 samples. Panels: observation channels; simulated regime and int8 mode; float forward posterior; int8 belief of <code class="ic">quant.Int8Filter</code>, dequantised as <code class="ic">(α + 128) / 255</code> and normalised.</figcaption></figure>

<div class="table-wrap"><table>
<thead>
<tr>
<th>Metric</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td>Argmax agreement, 5,000 samples</td>
<td>99.66%</td>
</tr>
<tr>
<td>Mean absolute belief error</td>
<td>0.0020</td>
</tr>
<tr>
<td>Floor hits</td>
<td>0</td>
</tr>
<tr>
<td>Agreement, 600 committed firmware vectors</td>
<td>0.9933</td>
</tr>
<tr>
<td><code>qemu-arm -cpu cortex-m4</code>, portable and CMSIS-NN kernels</td>
<td>Bit-exact with the Python mirror</td>
</tr>
</tbody></table></div>
<h3>CUDA compilation</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/terminal_nvcc.png" alt="Terminal compiling spde_gpu.cu with nvcc against cuDSS 0.7.1.6 successfully and against cuDSS 1.0.0.35 with eight errors" width="1172" height="392" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 9 · CUDA compile against two cuDSS releases</span> nvcc 12.9.86 compiles <code class="ic">gpu/src/spde_gpu.cu</code> against the cuDSS 0.7.1.6 headers. Against cuDSS 1.0.0.35 it fails with eight errors at lines 179 and 181, where <code class="ic">cudssMatrixCreateCsr</code> takes an additional <code class="ic">offsetType</code> argument.</figcaption></figure>

<h3>Stress tests</h3>
<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/study_noise.png" alt="Two line charts: accuracy and share of panic episodes caught both fall as sensor noise rises, with the 8-bit chip version overlapping the full-precision version" width="1760" height="704" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 10 · Noisier sensors</span> Sensor noise scaled from 0.5 to 2 times the default; 5 seeds of 2,000 samples per level, 157 panic episodes. Accuracy falls from 99.5% to 79.7% for both filters; int8 stays within 0.04 points of float and agrees with it on at least 99.25% of samples. At default noise int8 catches 151 of 157 panic episodes, median delay 0 samples, false-panic rate 0.64%.</figcaption></figure>

<figure class="cs-figure"><img src="/journal/lifting-spde-gmrf-gpu-edge/study_recovery.png" alt="Scatter of 40 estimated range and strength settings as a percentage of their true values, clustered around 100 percent" width="960" height="848" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 11 · Route-model fit</span> 40 simulated routes (seeds 0 to 39), 200 sensors by 8 replicates, fitted on CPU. Median absolute error 6.1% for the correlation range (<code class="ic">κ</code>) and 3.8% for the variance scale (<code class="ic">τ</code>); every estimate within 20% of truth. The two errors are negatively correlated (r = -0.73). Data: Hugging Face dataset, linked below.</figcaption></figure>

<div class="link-cards"><a class="link-card" href="https://huggingface.co/datasets/itsdhruvsetty/spde-gmrf-lane-perception-vectors"><span class="link-card__thumb"><img src="/journal/covers/work-hf-dataset.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">spde-gmrf-lane-perception-vectors</span><span class="link-card__desc">Hugging Face dataset with the data for the route-model fit.</span><span class="link-card__domain">huggingface.co</span></span></a></div>
<h2>Observations</h2>
<ul>
<li>Ordering dominates host cost: RCM reduces the 20 by 20 lattice factorisation from 3,877,939 MACs to 174,362, and the scrambled factor carries roughly four times the RCM nonzeros.</li>
<li>The likelihood surface is the target GPU workload; the 1,250 to 2 ratio of numeric factorisations to symbolic analyses confirms that symbolic reuse is mandatory.</li>
<li>The case study scrambled count of 37,615 is a valid but atypical draw: 2.5% of the 1,000 relabellings yield that many nonzeros or fewer. This post uses the repository values, 45,258 scrambled and 11,378 after RCM.</li>
<li>int8 quantisation does not alter the MAP decision; the lower two panels of Figure 8 are indistinguishable at plot scale.</li>
<li>The CUDA source typechecks against cuDSS 0.7.1.6 and is broken by the cuDSS 1.0.0.35 API change. Figure 9 establishes nothing about GPU performance.</li>
</ul>
<h2>Limitations</h2>
<ul>
<li>The CUDA object is compiled only, not linked and never run on a GPU. Before any GPU result is reported, the GPU path shall be checked against <code>gpu/compare.py</code> on a GPU.</li>
<li>No latency claim shall be derived from MAC counts without a measurement on the target. QEMU provides no cycle counts.</li>
<li>RCM yields 11,378 or 11,370 nonzeros depending on input labelling: 500 and 500 of 1,000 seeds in this run, 502 and 498 in an earlier run. The cause of the inter-run variation has not been established. Seeds 0, 1 and 2, used by the tests, gave 11,378 in every run.</li>
<li>GPU estimation and on-device timing remain unmeasured; no result above substitutes for either.</li>
</ul>
<p>Source:</p>
<div class="link-cards"><a class="link-card" href="https://github.com/dhruv-setty/split-spde-gmrf-inference-for-lane-perception"><span class="link-card__thumb"><img src="/journal/covers/work-split-spde.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">Driver-state detection from lane keeping on a microcontroller</span><span class="link-card__desc">Classifies driver state from lane-position data on a Cortex-M4F, with route correction computed off-device.</span><span class="link-card__domain">github.com</span></span></a></div>
]]></content:encoded>
</item>
<item>
<title>From Intent to Evidence: Identity Controls That Leave Proof</title>
<link>https://dhruv-setty.github.io/blog/from-intent-to-evidence/</link>
<guid isPermaLink="true">https://dhruv-setty.github.io/blog/from-intent-to-evidence/</guid>
<pubDate>Tue, 10 Nov 2026 00:00:00 GMT</pubDate>
<description>CI captures for two components: a .NET 8 CLI rendering and validating SSSD idp-provider configuration for Entra ID sign-in on Debian, and a Java change planner and evidence library for IdentityIQ governance of POSIX ACL file shares.</description>
<content:encoded><![CDATA[<h2>Context</h2>
<p>Governing rule of the framework: an access claim shall count only when the system that holds the access demonstrates it. Two components are documented here, the Entra ID sign-in component (V2) and the legacy file share governance component (V3), exclusively through the figures their repositories publish.</p>
<p>Every figure was produced by a <code>captures.yml</code> workflow on an <code>ubuntu-24.04</code> GitHub runner. Each terminal figure is an <code>xterm</code> window on an Xvfb display running the commands shown, captured with ImageMagick; the printed output is retained beside it as a <code>.log</code> or <code>.txt</code> transcript. No figure is drawn by hand. A capture of an executed command is evidence in the same sense as a sign-in log; a diagram is not.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Component</th>
<th>Implementation</th>
<th>Outside CI coverage</th>
</tr>
</thead>
<tbody><tr>
<td>V2</td>
<td>A C# (.NET 8) CLI that configures Debian hosts to sign in Microsoft Entra ID users through the SSSD <code>idp</code> provider</td>
<td>A real tenant, the CLI&#39;s <code>install</code> command on a systemd host, its <code>verify</code> command, and the device code prompt at SSH login</td>
</tr>
<tr>
<td>V3</td>
<td>IdentityIQ Legacy Filesystem Governance: a Java change planner, evidence library and IdentityIQ configuration for POSIX and ACL file shares</td>
<td>IdentityIQ itself and JBoss EAP; the configuration has not been imported into a running IdentityIQ instance</td>
</tr>
</tbody></table></div>
<h2>Design rationale</h2>
<h3>Entra ID sign-in for Debian</h3>
<p>Intent: only members of one Entra group shall log in; every login shall be an Entra sign-in subject to MFA and Conditional Access; a disabled account shall lose access at its next login. The CLI implements none of this directly. It renders, validates and installs SSSD configuration; SSSD 2.11.0 or later performs the sign-in through the OAuth 2.0 Device Authorization Grant. The design obligation is configuration that cannot drift into a weaker state.</p>
<pre><code> intent                                     setting in Figure 4
 ------                                     -------------------
 every login is an Entra sign in        --&gt; id_provider = idp, auth_provider = idp
 only one group may log in              --&gt; access_provider = simple
                                            simple_allow_groups = linux-admins
 a disabled account loses access        --&gt; cache_credentials = false
 at its next login
 the same user has the same UID         --&gt; idmap_range_min / max / size
 on every host
 the secret is readable by root only    --&gt; -rw------- on the rendered file
</code></pre>
<ul>
<li><code>register-app</code> shall obtain its Graph token only from a Graph token environment variable or <code>az account get-access-token</code>, and shall fail before any Graph request when neither is present.</li>
<li>Files holding the client secret shall be created with mode 0600.</li>
<li>The validator shall not depend on the <code>sssctl</code> rule set, which can lag new back ends. A non-zero exit status shall prevent the <code>install</code> command from starting SSSD on an invalid file.</li>
<li><code>--host</code> adds three checks to the file check: installed SSSD version (2.11.0 or later), presence of <code>libsss_idp.so</code>, and file mode. Debian 12 ships SSSD 2.8.2 and Debian 13 ships 2.10.1, neither with the <code>idp</code> provider; the <code>install</code> command therefore pins only the SSSD packages from forky (2.13) on those releases. Without the pin, the check shall fail closed.</li>
</ul>
<h3>IdentityIQ governance of legacy file shares</h3>
<p>Legacy file servers hold regulated records behind owner, group and mode bits, POSIX.1e ACLs and NFS export options that drift through manual change. The component places that access under IdentityIQ with an ordered, idempotent change plan, a separation of duties policy between finance and audit write access, and evidence that a revocation took effect on disk. Core logic resides in <code>fsgov-core</code>, a Java library with no IdentityIQ dependency, which is the part the runner can execute.</p>
<ul>
<li>Plan ordering: revocations first (ACL entries, then memberships), then group creation, ACL grants, explicit mask steps and membership grants. A request already satisfied by the snapshot shall yield no step.</li>
<li>Command lines are a display form for reviewers only. The connector queues structured <code>#fsgov-plan v1</code> steps and the host executor applies them; no command text is executed anywhere in the component.</li>
<li><code>AccessDiffer</code> compares IdentityIQ assertions with on-disk state per account and path pair. Evidence bundles are written in a canonical tab separated form with a SHA-256 digest, so identical inputs reproduce identical evidence.</li>
<li><code>OrphanDetector</code> reports findings with no natural reviewer.</li>
<li>Revocation shall be proved by a fresh inventory, not inferred from the plan.</li>
</ul>
<h2>Results: Entra ID sign-in</h2>
<h3>Command line</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-01-cli-help.png" alt="Terminal showing the CLI's version and help output, and register-app failing without a Graph token" width="746" height="330" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 1 · Command line</span> The <code class="ic">version</code> command prints 2.0.1; <code class="ic">--help</code> lists six subcommands. <code class="ic">register-app</code> with no Graph token environment variable and no Azure CLI sign-in stops before any Graph request and exits with status 1.</figcaption></figure>

<h3>Release build</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-02-dotnet-build.png" alt="Terminal showing dotnet build -c Release succeeding with one warning and no errors" width="1628" height="348" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 2 · Release build</span> <code class="ic">dotnet build -c Release</code> restores and builds the CLI project and its test project for <code class="ic">net8.0</code> with SDK 11.0.100: 0 errors, 1 warning, xUnit analyzer rule <code class="ic">xUnit2029</code> at line 19 of <code class="ic">SssdConfigTests.cs</code>.</figcaption></figure>

<h3>Unit tests</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-03-dotnet-test.png" alt="Terminal listing ten passed xUnit tests" width="1388" height="430" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 3 · Unit tests</span> <code class="ic">dotnet test -c Release</code> with the normal console logger, each test listed by name. Total tests: 10; passed: 10.</figcaption></figure>

<div class="table-wrap"><table>
<thead>
<tr>
<th>Test</th>
<th>Control it protects</th>
</tr>
</thead>
<tbody><tr>
<td><code>DebianVersionsParse</code> (two cases)</td>
<td>The <code>--host</code> version gate parses Debian package versions, including an epoch and a release candidate</td>
</tr>
<tr>
<td><code>BadSettingsAreFound</code> (two cases)</td>
<td>A key SSSD rejects, and a duplicate key, are caught</td>
</tr>
<tr>
<td><code>NewlineInValueIsRejected</code></td>
<td>A multi line value cannot inject a setting</td>
</tr>
<tr>
<td><code>MissingValueIsRejected</code></td>
<td>Rendering stops when a value is missing</td>
</tr>
<tr>
<td><code>ClientIdMustBeGuid</code></td>
<td><code>idp_client_id</code> has the right shape</td>
</tr>
<tr>
<td><code>RenderedTemplatePassesCheck</code></td>
<td>The shipped template renders with no placeholders and no errors</td>
</tr>
<tr>
<td><code>SecretFileIsOwnerOnly</code></td>
<td>Output files are created with mode 0600</td>
</tr>
<tr>
<td><code>ApplicationRequestsExpectedPermissions</code></td>
<td>The Graph request asks for exactly the two application roles and allows public client flows</td>
</tr>
</tbody></table></div>
<h3>Rendered sssd.conf</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-04-render-sssd-conf.png" alt="Terminal showing the render command and the rendered sssd.conf with mode 0600" width="988" height="944" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 4 · Rendered sssd.conf</span> The <code class="ic">render</code> command fills the embedded template from a placeholder <code class="ic">entra-app.env</code> and the group <code class="ic">linux-admins</code>; the file is created with mode 0600. <code class="ic">[domain/entra]</code> sets <code class="ic">id_provider = idp</code>, <code class="ic">idp_type = entra_id</code>, the tenant token and device authorization endpoints, the idmap range and <code class="ic">cache_credentials = false</code>.</figcaption></figure>

<p>Identifiers in the figure are placeholders (<code>00000000-...</code> tenant, <code>11111111-...</code> client, <code>ci-placeholder</code> secret). No figure contacts a tenant.</p>
<h3>Configuration validation</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-05-check-config.png" alt="Terminal showing the check command passing a valid file and reporting five errors on a broken copy" width="1340" height="449" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 5 · Configuration check</span> The <code class="ic">check</code> command reports the rendered file as ok. A copy is mutated with <code class="ic">sed</code>: <code class="ic">config_file_version</code> added, <code class="ic">idp_client_id</code> replaced by a placeholder, two endpoints changed to http. <code class="ic">check</code> then reports 5 errors and exits with status 1.</figcaption></figure>

<p>Every mutation in the <code>diff</code> is detected: an unrendered placeholder, a key rejected by SSSD 2.13, two non-https endpoints, and a client ID that is not a GUID.</p>
<h3>Host check, Debian forky</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-06-host-check-forky.png" alt="Terminal showing the host check passing in a Debian forky container with SSSD 2.13.1-5" width="860" height="194" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 6 · Host check, Debian forky</span> <code class="ic">debian:forky</code> container with <code class="ic">sssd-common</code> and <code class="ic">sssd-idp</code> 2.13.1-5: <code class="ic">render</code> writes <code class="ic">/etc/sssd/sssd.conf</code> as root with mode 0600, and <code class="ic">check --host</code> reports it as ok.</figcaption></figure>

<p>The same command runs in <code>ci.yml</code> on every push; the passing state is continuously reproduced, not captured once.</p>
<h3>Host check, Debian 13</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v2-07-host-check-trixie.png" alt="Terminal showing the host check failing in a Debian trixie container with SSSD 2.10.1" width="868" height="313" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 7 · Host check, Debian 13</span> <code class="ic">debian:trixie</code> container, <code class="ic">sssd-common</code> 2.10.1-2+b1, no <code class="ic">sssd-idp</code>. <code class="ic">check --host</code> reports that SSSD 2.10.1 has no <code class="ic">idp</code> provider and that <code class="ic">libsss_idp.so</code> is missing, and exits with status 1, as specified.</figcaption></figure>

<h2>Results: file share governance</h2>
<h3>Build and tests</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-01-maven-build-tests.png" alt="Terminal showing Maven verify with Surefire counts per test class and BUILD SUCCESS" width="684" height="498" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 8 · Build and unit tests</span> <code class="ic">mvn -B -ntp verify</code>: 78 tests in 14 classes of <code class="ic">fsgov-core</code> and 37 tests in 3 classes of <code class="ic">fsgov-config-validation</code>, no failures, errors or skips, BUILD SUCCESS.</figcaption></figure>

<div class="table-wrap"><table>
<thead>
<tr>
<th>Module</th>
<th>Test classes</th>
<th>Tests</th>
<th>Failures</th>
<th>Errors</th>
<th>Skipped</th>
</tr>
</thead>
<tbody><tr>
<td><code>fsgov-core</code></td>
<td>14</td>
<td>78</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td><code>fsgov-config-validation</code></td>
<td>3</td>
<td>37</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>Total</td>
<td>17</td>
<td>115</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
</tbody></table></div>
<p>The 37 configuration tests assert that every artifact parses and declares the <code>sailpoint.dtd</code> DOCTYPE, that every object reference and rule name resolves, that every <code>%%TOKEN%%</code> has a value, and that the repository contains no script sources.</p>
<h3>Coverage</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-02-jacoco-coverage.png" alt="JaCoCo coverage report for fsgov-core" width="1145" height="222" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 9 · Coverage</span> JaCoCo report for <code class="ic">fsgov-core</code>: 97 percent instruction coverage and 88 percent branch coverage over 48 classes in four packages.</figcaption></figure>

<p>JaCoCo 0.8.12 reports 171 of 6,100 instructions and 72 of 648 branches missed. The build enforces a floor of 85 percent line coverage and 70 percent branch coverage; coverage is a gate, not a statistic.</p>
<h3>POSIX ACL fixture</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-03-posix-acl-fixture.png" alt="Terminal showing users, groups, setfacl commands and getfacl output for /srv/finance, /srv/audit and /srv/scratch" width="1092" height="770" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 10 · POSIX ACL fixture</span> Fixture on the runner's ext4 file system: users and governed groups, <code class="ic">/srv/finance</code>, <code class="ic">/srv/audit</code> and <code class="ic">/srv/scratch</code>, two drift entries (<code class="ic">user:carol:rwx</code> and <code class="ic">user:7777:r-x</code>), and the resulting <code class="ic">getfacl -p</code> output.</figcaption></figure>

<p>All subsequent figures execute against a real file system, not a mock. Drift entries: a direct <code>rwx</code> grant to carol on the finance share outside IdentityIQ, and an entry on the audit share for uid 7777, which maps to no account. The exports file is parsed but not loaded into the kernel.</p>
<h3>Inventory and effective access</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-04-inventory-parse-evaluate.png" alt="Terminal showing parsed getfacl blocks, parsed exports rules and effective access per account, locally and over NFSv3" width="820" height="1011" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 11 · Inventory and effective access</span> Collector inventory parsed by <code class="ic">GetfaclParser</code> and <code class="ic">ExportsParser</code>, and effective access from <code class="ic">AccessEvaluator</code>, locally and from NFSv3 client <code class="ic">backup01</code>, where the <code class="ic">ro</code> export removes write. The mode column is taken from <code class="ic">stat</code>.</figcaption></figure>

<p>carol holds <code>rwx</code> on <code>/srv/finance</code> locally through <code>user:carol:rwx masked by rwx</code>, and <code>r-x</code> from <code>backup01</code> under the read-only export. The mode reads 2770 rather than the 2750 that was set: with an ACL present, the group bits reflect the mask.</p>
<h3>Change plan</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-05-change-plan.png" alt="Terminal showing ten ordered change plan steps and the encoded plan" width="628" height="621" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 12 · Change plan</span> <code class="ic">ChangePlanner</code> output for three requests (grant <code class="ic">fs_fin_rw</code> to alice, grant <code class="ic">fs_audit_ro</code> to carol, remove carol's direct entry on <code class="ic">/srv/finance</code>): ten steps, revocation first, no warnings, and a <code class="ic">ChangePlanCodec</code> round trip of all ten steps.</figcaption></figure>

<h3>Evidence before remediation</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-06-certification-evidence-before.png" alt="Terminal showing the evidence bundle with MISSING, MATCH and EXCESS records and three hygiene findings" width="772" height="264" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 13 · Evidence before remediation</span> Two <code class="ic">MISSING</code> records, one <code class="ic">MATCH</code> and one <code class="ic">EXCESS</code> (carol's direct <code class="ic">rwx</code> on <code class="ic">/srv/finance</code>), with three hygiene findings: a dangling ACL entry for uid 7777, an empty governed group and a <code class="ic">no_root_squash</code> export.</figcaption></figure>

<p>The <code>EXCESS</code> record becomes a review item. The <code>OrphanDetector</code> findings are an entry for a uid with no account, a governed group with no effective members, and an export under which remote root acts as local root.</p>
<h3>Plan applied</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-07-plan-applied-getfacl.png" alt="Terminal showing the plan steps run with sudo, getent group and getfacl after the change" width="516" height="838" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 14 · Plan applied</span> The display form of the plan, run by the workflow on the disposable runner in place of a host executor, followed by <code class="ic">getent group</code> and <code class="ic">getfacl -p</code> showing the new group entries and default ACLs and no entry for carol on <code class="ic">/srv/finance</code>.</figcaption></figure>

<p>The figure is the read-back, not the request: <code>fs_fin_rw</code> contains alice, <code>fs_audit_ro</code> contains carol, and <code>/srv/finance</code> no longer lists <code>user:carol</code>.</p>
<h3>Evidence after remediation</h3>
<figure class="cs-figure"><img src="/journal/from-intent-to-evidence/v3-08-certification-evidence-after.png" alt="Terminal showing three MATCH records, two remaining findings and an empty replan" width="772" height="382" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 15 · Evidence after remediation</span> Evidence from a fresh inventory: three <code class="ic">MATCH</code> records and the two findings outside the requests. Replanning the same requests yields zero steps and reports seven already satisfied conditions.</figcaption></figure>

<h2>Observations</h2>
<ul>
<li><code>register-app</code> fails before transmission, so a missing credential cannot produce a partially created app registration.</li>
<li>The single build warning is an analyzer style rule in the test project (<code>Assert.DoesNotContain</code> in place of <code>Assert.Empty</code>), not a defect in the CLI, and is reported rather than suppressed.</li>
<li>No tenant exists on the runner; <code>ApplicationRequestsExpectedPermissions</code> therefore verifies the Graph request body in a unit test in place of a capture against Entra ID.</li>
<li>The Debian 13 failure (Figure 7) is the condition the forky pin exists to prevent; the check fails closed instead of starting a service that cannot enforce the intent.</li>
<li>The 37 configuration tests are well-formedness and consistency checks, not validation against <code>sailpoint.dtd</code>, which is not public.</li>
<li>Remediation closes the loop: the revocation is proved by a new inventory (Figure 15), not inferred from the plan (Figure 12). The remaining findings, the dangling uid 7777 entry and the <code>no_root_squash</code> export, were outside the requests and continue to be reported. The empty replan is the idempotency property on which the connector relies.</li>
<li>Every control is expressed as a check that can fail: the configuration check exits 1, and the replan is empty or it is not.</li>
</ul>
<h2>Limitations</h2>
<ul>
<li>Entra ID sign-in: the CLI&#39;s <code>register-app</code> command against a real tenant, <code>install</code> on a systemd host, <code>verify</code>, and the device code prompt that <code>pam_sss</code> prints at SSH login are not captured, because CI has neither a tenant nor a systemd host. CI does not cover Debian 12, Debian 13 or sid hosts.</li>
<li>The client secret is the only credential type the <code>idp</code> provider currently supports. A certificate credential is planned and not implemented.</li>
<li>File share governance: no figure shows IdentityIQ or JBoss EAP; both require a licensed or running server that the capture workflow lacks. The IdentityIQ artifacts have not been validated against <code>sailpoint.dtd</code> or imported into a running IdentityIQ instance, the adapter has not been compiled against <code>identityiq.jar</code> in CI, and the JBoss CLI scripts have not been run against a server.</li>
<li>The host executor is not part of the repository; the workflow substitutes for it on a runner that is discarded afterwards.</li>
<li>The IdentityIQ configuration is a reviewed starting point. It shall be imported and tested in a sandbox before promotion to any higher environment.</li>
</ul>
<p>Source:</p>
<div class="link-cards"><a class="link-card" href="https://github.com/dhruv-setty/entra-id-sign-in-for-debian-with-sssd"><span class="link-card__thumb"><img src="/journal/covers/work-entra-sssd.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">Entra ID sign in for Debian with SSSD</span><span class="link-card__desc">Configures Debian hosts to authenticate Microsoft Entra ID users through the SSSD idp provider.</span><span class="link-card__domain">github.com</span></span></a>
<a class="link-card" href="https://github.com/dhruv-setty/identity-governance-for-legacy-linux-file-shares"><span class="link-card__thumb"><img src="/journal/covers/work-legacy-fs.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">Identity governance for legacy Linux file shares</span><span class="link-card__desc">Brings POSIX permissions, ACLs and NFSv3 exports on legacy file servers under request, approval and certification.</span><span class="link-card__domain">github.com</span></span></a></div>
]]></content:encoded>
</item>
<item>
<title>Zero Trust Starts in the Silicon: Cobalt 200, Neoverse V3 and GDPR</title>
<link>https://dhruv-setty.github.io/blog/zero-trust-in-silicon-cobalt-200-neoverse-gdpr/</link>
<guid isPermaLink="true">https://dhruv-setty.github.io/blog/zero-trust-in-silicon-cobalt-200-neoverse-gdpr/</guid>
<pubDate>Tue, 09 Dec 2025 00:00:00 GMT</pubDate>
<description>Opinion. Cobalt 200 on Neoverse CSS V3: default memory encryption and ARM CCA realm isolation move the zero-trust boundary below the hypervisor; under GDPR Articles 25 and 32 they are evidence only when read from ID registers and attested.</description>
<content:encoded><![CDATA[<h2>Position</h2>
<p>This is an opinion on the engineering, prompted by Microsoft&#39;s announcement of Cobalt 200 on 2025-11-18. It is not a measurement and not legal advice.</p>
<p>The host, its hypervisor and its operators constitute an implicitly trusted layer beneath every workload. Where the host can read guest memory, the workload trusts the host irrespective of policy. Default memory encryption and ARM CCA realm isolation relocate the zero-trust boundary below that layer. The relocated boundary shall be treated as a hypothesis about a specific platform until it is read from that platform, enabled for the workload and attested.</p>
<pre><code> Conventional VM                 Cobalt 200 with ARM CCA
 ---------------                 -----------------------
 +---------------------------+   +---------------------------+
 | Guest VM (personal data)  |   | Realm VM (personal data)  |  trusted
 +---------------------------+   +===========================+  hardware boundary
 | Hypervisor / host OS      |   | Hypervisor / host OS      |  verified, not trusted
 | trusted                   |   |                           |
 +---------------------------+   +---------------------------+
 | Operator access           |   | Operator access           |  no view of realm memory
 | trusted                   |   |                           |
 +---------------------------+   +---------------------------+
 | DRAM (plaintext)          |   | DRAM (encrypted, default) |
 +---------------------------+   +---------------------------+
</code></pre>
<h2>Rationale</h2>
<h3>Platform</h3>
<p><a href="https://techcommunity.microsoft.com/blog/azureinfrastructureblog/announcing-cobalt-200-azure%E2%80%99s-next-cloud-native-cpu/4469807">Cobalt 200</a> is Microsoft&#39;s second ARM server CPU, built on ARM Neoverse Compute Subsystems V3 (CSS V3): 132 active cores, 3 MB of L2 per core, 192 MB of L3 system cache, TSMC 3 nm. First production servers operate in Microsoft datacentres; wider rollout and customer availability were announced for 2026.</p>
<h3>Realm isolation from the hypervisor</h3>
<p>Cobalt 200 implements ARM CCA, which isolates VM memory from the hypervisor and host OS in hardware. The isolation model is published and has been subjected to verification. Realms are enforced in a separate physical address space, the Realm world; untrusted system software retains dynamic allocation of memory to Realms but cannot access Realm memory contents, even when executing at a higher privilege level, and the firmware that manages Realms has been formally verified for security and correctness [1]. The Realm Management Monitor specification and implementation have been developed alongside a formal verification methodology, which exposed inconsistencies, errors and imprecision in both during design [2].</p>
<p>The host software stack therefore becomes an object of verification rather than of assumption: the principle of no implicit trust by network location, applied at the privilege level of the host.</p>
<h3>Memory encryption by default</h3>
<p>A custom memory controller enables memory encryption by default, with what Microsoft describes as negligible performance impact. A control that cannot be omitted does not drift and does not require drift audit. That property is stronger than any configuration baseline that relies on operator adherence.</p>
<p>Default encryption is necessary and not sufficient. Brief physical access to the SPD chip of a DIMM can induce physical address aliasing that circumvents CPU access control and breaks the memory integrity guarantee of AMD SEV-SNP; the same work challenges the trust assumptions underlying scaled-up memory encryption, the direction it identifies across AMD SEV-SNP, Intel TDX and ARM CCA [3]. The threat model of a memory encryption claim shall therefore state whether physical access to the memory subsystem is in scope.</p>
<h3>Cryptographic offload</h3>
<p>Microsoft&#39;s modelling found compression, decompression and encryption heavily used in over 30% of cloud workloads; Cobalt 200 includes dedicated accelerators for them. Where encryption is inexpensive in hardware, a design that leaves data unencrypted carries a weaker justification, and the expected baseline in design review rises accordingly.</p>
<p>Vendor overhead characterisations shall be confirmed per platform and per workload. On AMD SEV-SNP and Intel TDX, an empirical study measured up to a 92% increase in the initial memory allocation of confidential VMs and up to a 60% performance drop for heavy network processing under high CPU utilisation, attributed to bounce-buffered I/O stacks [4].</p>
<h3>Attestation</h3>
<p>Hardware isolation provides assurance only with attestation evidence of platform identity and boot state. The architecturally defined attestation mechanisms of ARM CCA and Intel TDX have been formally specified across provisioning, initialisation and the attestation protocol [5]. A controller relying on CCA shall consume Realm and platform evidence as specified, not a product-level assertion of support.</p>
<h3>GDPR mapping</h3>
<p>Article 32 requires measures &quot;appropriate to the risk&quot;, names encryption and the ongoing confidentiality and integrity of processing systems, and weighs &quot;the state of the art&quot; and &quot;the costs of implementation&quot;. Article 25 requires data protection by design and by default. The evidence column is normative: absent that evidence, the contribution shall not be claimed.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Article</th>
<th>Requirement</th>
<th>What Cobalt 200 contributes</th>
<th>Evidence I would want</th>
</tr>
</thead>
<tbody><tr>
<td>25</td>
<td>Protection by design and by default</td>
<td>Encryption enabled by default</td>
<td>SKU configuration record</td>
</tr>
<tr>
<td>28</td>
<td>Processor obligations</td>
<td>Hardware limits on what the processor&#39;s software can see</td>
<td>Contract plus attestation</td>
</tr>
<tr>
<td>32</td>
<td>Security of processing</td>
<td>Encryption and hardware isolation as technical measures</td>
<td>Attestation report per workload</td>
</tr>
<tr>
<td>34</td>
<td>Communication of a breach</td>
<td>Data unintelligible to unauthorised parties</td>
<td>Proof encryption was active</td>
</tr>
<tr>
<td>35</td>
<td>Impact assessment</td>
<td>Reduced host-access risk in the assessment</td>
<td>Documented assumptions and checks</td>
</tr>
</tbody></table></div>
<h2>Observations</h2>
<ul>
<li><strong>Architecture is not implementation.</strong> CCA is an ARM architectural feature, not a single-vendor mechanism, but a shared architecture does not imply a shared implementation. Cobalt 100 (Neoverse N2) and Cobalt 200 (Neoverse V3) are not interchangeable. Guest-visible features shall be read from the host ID registers, not inferred from a product name.</li>
<li><strong>Supported is not enabled.</strong> The announcement describes CCA support and default memory encryption. Exposure to a specific guest on a specific VM size shall be confirmed, recorded and periodically re-verified.</li>
<li><strong>Verified is not unconditional.</strong> Verification results [1], [2], [5] hold for the specified models and threat models. Physical attacks on the memory subsystem [3] lie outside the guarantees that memory encryption alone provides.</li>
<li><strong>Isolation is not compliance.</strong> It does not determine lawful basis, retention periods or international transfers. It changes the evidence that can exist: encryption by default and hardware isolation are technical measures, not policy statements.</li>
<li>A claim counts once it is read back from the system that enforces it. On Cobalt 200 and Neoverse V3, zero trust can extend from the hypervisor to the memory controller; per-workload demonstration that it did remains outstanding.</li>
</ul>
<p><em>This is an opinion on the engineering, not legal advice.</em></p>
<h2>References</h2>
<p>[1] X. Li, X. Li, C. Dall, R. Gu, J. Nieh, Y. Sait and G. Stockwell. Design and Verification of the Arm Confidential Compute Architecture. In <em>16th USENIX Symposium on Operating Systems Design and Implementation (OSDI 22)</em>, pp. 465-484, 2022. <a href="https://www.usenix.org/conference/osdi22/presentation/li">USENIX proceedings</a></p>
<p>[2] A. C. J. Fox, G. Stockwell, S. Xiong, H. Becker, D. P. Mulligan, G. Petri and N. Chong. A Verification Methodology for the Arm Confidential Computing Architecture: From a Secure Specification to Safe Implementations. <em>Proceedings of the ACM on Programming Languages</em> 7 (OOPSLA1), Article 88, 2023. <a href="https://doi.org/10.1145/3586040">DOI 10.1145/3586040</a></p>
<p>[3] J. De Meulemeester, L. Wilke, D. Oswald, T. Eisenbarth, I. Verbauwhede and J. Van Bulck. BadRAM: Practical Memory Aliasing Attacks on Trusted Execution Environments. In <em>2025 IEEE Symposium on Security and Privacy (S&amp;P)</em>, 2025. <a href="https://doi.org/10.1109/SP61157.2025.00104">DOI 10.1109/SP61157.2025.00104</a></p>
<p>[4] M. Misono, D. Stavrakakis, N. Santos and P. Bhatotia. Confidential VMs Explained: An Empirical Analysis of AMD SEV-SNP and Intel TDX. <em>Proceedings of the ACM on Measurement and Analysis of Computing Systems</em> 8 (3), Article 36, 2024. <a href="https://doi.org/10.1145/3700418">DOI 10.1145/3700418</a></p>
<p>[5] M. U. Sardar, T. Fossati, S. Frost and S. Xiong. Formal Specification and Verification of Architecturally-Defined Attestation Mechanisms in Arm CCA and Intel TDX. <em>IEEE Access</em> 12, pp. 361-381, 2024. <a href="https://doi.org/10.1109/ACCESS.2023.3346501">DOI 10.1109/ACCESS.2023.3346501</a></p>
]]></content:encoded>
</item>
<item>
<title>Hidden States: Modelling Driver Behaviour with Regimes, Drift and a Forward Filter</title>
<link>https://dhruv-setty.github.io/blog/hidden-states-behavioural-time-series/</link>
<guid isPermaLink="true">https://dhruv-setty.github.io/blog/hidden-states-behavioural-time-series/</guid>
<pubDate>Tue, 12 Dec 2023 00:00:00 GMT</pubDate>
<description>Switching HMM over four behavioural regimes coupled to a GMRF drift field with sparse precision Q(θ); simulated int8 forward filter, 99.66% argmax agreement with the float filter over 5,000 samples, 40 MACs per sample.</description>
<content:encoded><![CDATA[<h2>Context</h2>
<p>The observation model takes two channels from a dashboard-mounted lane detector: lateral lane offset and a Standard Deviation of Lane Position (SDLP) window, both in millimetres. The latent process is non-stationary in two senses: discrete switching between qualitative regimes, and slow drift within a regime. The estimator shall discriminate a regime change from within-regime drift; failure in either direction yields missed detections or alarm fatigue.</p>
<p>The model resides in the SPDE-GMRF repository. Figures 1 to 3 are model figures from the case study, retained in an earlier revision of the repository. Figure 4 is a CI capture from the current code. All data are simulated with fixed seeds; transition and emission parameters are illustrative and have not been fitted to recorded drives.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Layer</th>
<th>Representation</th>
</tr>
</thead>
<tbody><tr>
<td>Discrete</td>
<td>HMM over calm, alert, high stress and panic, K = 4</td>
</tr>
<tr>
<td>Continuous</td>
<td>Gaussian field with sparse precision <code>Q(θ)</code></td>
</tr>
<tr>
<td>Observations</td>
<td>Lateral lane offset and an SDLP window, both in millimetres</td>
</tr>
</tbody></table></div>
<h2>Design rationale</h2>
<h3>Two latent layers</h3>
<figure class="cs-figure"><img src="/journal/hidden-states-behavioural-time-series/hmm-graphical-model.png" alt="Graphical model with a chain of discrete regimes on top, observed signals in the middle and a chain of continuous field states below" width="1138" height="411" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 1 · Two latent layers, one observation</span> Regime chain <code class="ic">S_t</code> under transition matrix <code class="ic">A</code>; field <code class="ic">x_t</code> with precision <code class="ic">Q(θ)</code>. Observation <code class="ic">y_t = μ_S + H x_t + ε_t</code>, with <code class="ic">ε_t ~ N(0, Σ_S)</code> conditioned on the current regime.</figcaption></figure>

<p>A plain HMM assumes conditionally independent emissions given the regime. Fatigue accumulation and varying conditions violate that assumption; absorbing the drift into the discrete layer either inflates K beyond the semantically meaningful states or produces spurious regime switches. The continuous layer carries the drift so that K remains 4 and each regime remains interpretable. The field enters the lateral offset channel only, through the lifted offset of the current site.</p>
<h3>Direct calm-to-panic transition</h3>
<figure class="cs-figure"><img src="/journal/hidden-states-behavioural-time-series/hmm-regimes.png" alt="Four regime states, calm, alert, high-stress and panic, with self-transitions, neighbour transitions and a dashed direct path from calm to panic" width="1138" height="419" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 2 · Regimes and transitions</span> Per-regime emission <code class="ic">N(μ_k + H x_t, Σ_k)</code>. Mass concentrates on self-transitions and nearest neighbours; the dashed arc is the direct transition <code class="ic">a_14</code>.</figcaption></figure>

<p><code>a_14</code> exists because onset of the critical regime is not preceded by a gradual build-up. It is small by construction and is therefore the weight most exposed to int8 rounding to zero, which would render the transition unreachable for the filter. Requirement: the int8 model shall retain a nonzero <code>a_14</code> after quantisation. <code>test_transition_matrix_keeps_direct_calm_to_panic</code> checks the requirement.</p>
<h3>Inference decomposition</h3>
<figure class="cs-figure"><img src="/journal/hidden-states-behavioural-time-series/hmm-inference-loop.png" alt="Two boxes, forward filter and backward sample on the left and Gaussian field update on the right, exchanging the regime path and the field estimate, both feeding a hyperparameter box below" width="973" height="428" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 3 · The inference loop</span> Conditioned on the field, the regimes form an HMM filtered in <code class="ic">O(TK²)</code>, K = 4. Conditioned on the regimes, the field is Gaussian with sparse precision, solved by one sparse Cholesky factorisation. <code class="ic">θ = (A, μ_k, Σ_k, κ, τ)</code> is updated from the joint likelihood, with <code class="ic">log|Q| = 2 Σ log L_ii</code> taken from the same factor.</figcaption></figure>

<p>The decomposition places the sparse factorisation on the field side, where it executes periodically, and reduces the per-sample path to a 4 by 4 recursion. Implemented: field-side estimation of <code>κ</code> and <code>τ</code> with <code>log|Q|</code> read from the factor, and the forward filter.</p>
<h2>Results</h2>
<figure class="cs-figure"><img src="/journal/hidden-states-behavioural-time-series/plot_forward_filter.png" alt="Four stacked panels over 600 samples: lateral offset and SDLP observations, simulated regime against int8 mode, float filter posterior, int8 filter belief" width="1803" height="1383" loading="lazy" decoding="async" /><figcaption><span class="cs-figure__label">Figure 4 · Observations, regimes and filter beliefs</span> Data of <code class="ic">python/tests/test_forward_filter.py</code> (seed 7), first 600 of 5,000 samples. Panels: observation channels; simulated regime and int8 mode (offset for visibility); float forward posterior; int8 belief, dequantised as <code class="ic">(α + 128) / 255</code> and normalised.</figcaption></figure>

<div class="table-wrap"><table>
<thead>
<tr>
<th>Metric (5,000 samples)</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td>int8 against float argmax agreement</td>
<td>99.66%</td>
</tr>
<tr>
<td>Mean absolute belief error</td>
<td>0.0020</td>
</tr>
<tr>
<td>Maximum absolute belief error</td>
<td>0.1265</td>
</tr>
<tr>
<td>Accuracy against simulated regime, float filter</td>
<td>0.9234</td>
</tr>
<tr>
<td>Accuracy against simulated regime, int8 filter</td>
<td>0.9240</td>
</tr>
<tr>
<td>Floor hits</td>
<td>0</td>
</tr>
<tr>
<td>Cost per sample</td>
<td>40 MACs, independent of field size</td>
</tr>
</tbody></table></div>
<h2>Observations</h2>
<ul>
<li>Regime changes are not separable by inspection of the observation channels. Near sample 300 both channels widen sharply; elsewhere the excursions are comparable to the noise floor. A fixed threshold is therefore insufficient.</li>
<li>The int8 mode tracks the simulated regime, including the transitions to panic near samples 80 and 300, with transient disagreement confined to transition boundaries.</li>
<li>The float posterior and the int8 belief are indistinguishable at plot scale. int8 quantisation of the filter does not alter the MAP decision.</li>
<li>Zero floor hits: the fixed-point rescale prevented belief underflow over the full run.</li>
</ul>
<h2>Limitations</h2>
<ul>
<li>The int8 quantiser rounds transition weights without a floor. A nonzero <code>a_14</code> is guaranteed only under a floor-at-one rule, which the repository&#39;s Lean proof sketch proves sufficient and which is not yet implemented. Plain rounding maps every <code>a_14</code> below 1/254 to zero.</li>
<li>Backward sampling and the EM or Laplace update of <code>A</code>, <code>μ_k</code> and <code>Σ_k</code> are not implemented; regime parameters are fixed.</li>
<li>The closed loop (CARLA scene rendering, OpenCV lane detection producing lateral offset and SDLP, GPU R-CNN detection, and a microcontroller receiving features over UART, updating the regime belief and returning the estimate to the simulation) exists as a design only.</li>
<li>Implemented: the model, the filter, and firmware bit-exact with the Python reference under QEMU for Cortex-M4F. GPU timing, on-device timing and accuracy on recorded drives are not measured.</li>
</ul>
<p>Source:</p>
<div class="link-cards"><a class="link-card" href="https://github.com/dhruv-setty/split-spde-gmrf-inference-for-lane-perception"><span class="link-card__thumb"><img src="/journal/covers/work-split-spde.webp" alt="" loading="lazy" decoding="async" /></span><span class="link-card__body"><span class="link-card__title">Driver-state detection from lane keeping on a microcontroller</span><span class="link-card__desc">Classifies driver state from lane-position data on a Cortex-M4F, with route correction computed off-device.</span><span class="link-card__domain">github.com</span></span></a></div>
]]></content:encoded>
</item>
</channel>
</rss>
