Skip to content

Commit bc0b2fc

Browse files
ironsheepclaude
andcommitted
The write-path warning is recalibrated to what the evidence actually shows
Stephen: "i have no users id'ing this as a problem (file content not being correct)." He is right, and the absence is evidence rather than missing evidence -- a one-bit shift is not subtle. It makes text unreadable and binary structures obviously malformed, so anyone affected while writing ordinary files would have said so at once. Our own record says the same thing quantitatively. Each release was verified by 27 regression binaries, each carrying its own hub layout, running thousands of sector writes with independent byte-level content verification -- verifyBufferPattern regenerates the expected sequence rather than comparing a buffer to itself. Across 18 releases none landed on the failing side. The defect surfaced only when an unrelated commit shifted the layout mid-development. If the failing region were anything like the naive one-in-seven the phase arithmetic suggests, roughly four suites would have been red in every release for four months. So the previous wording was disproportionate. It told users their data may be wrong and to verify everything against a backup or rewrite it -- proportionate to a defect that hits often, not to one whose failing layout region is demonstrably small. Over- warning is not the safe side: it alarms people who were never affected, invites needless rewriting of good data, and spends credibility a future genuine warning will need. Both notes now lead with the likelihood, give the evidence for it, and keep the disclosure. The check is proportionate too -- open a file and look at it, which settles it for most data in a minute; a backup comparison only for data that is both opaque and irreplaceable. One outright error fixed while there. The old text was headed "Why you cannot have noticed", which is false -- the user very likely WOULD have noticed. That claim was about the DRIVER's two checks, not the reader's eyes, and it now says so. The honest caveat is kept and made explicit rather than implied: our binaries are harnesses, the user's is their application plus this driver, sampling a layout we never did. That is why the note exists at all instead of "it never affected anyone". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c14be8d commit bc0b2fc

2 files changed

Lines changed: 53 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ Sector writes no longer depend on where the linker put the driver, failures the
5454

5555
### Upgrade / recovery note
5656

57-
Data written by an earlier release may be wrong on the card. The write-path defect above stored shifted sectors while reporting success, and whether a build was affected depended on where the linker placed the driver's data — a property of the binary, not of the card or your code.
57+
The write-path defect above was structurally present in every release from v0.9.3 through v1.6.1, so data written by an earlier release *could* be wrong on the card. **The practical risk is low:** no user has reported it, and it never occurred across four months of certification — 27 regression binaries per release, each with its own hub layout, all doing byte-level content verification. A one-bit shift is also not subtle; it makes text unreadable and binary structures obviously malformed.
5858

59-
- **`SD_FAT32_audit` and `SD_FAT32_fsck` cannot find this.** The filesystem structures are intact and consistent; only the contents of data sectors are wrong, so there is no footprint to detect. This is the same shape as v1.6.0's mid-sector append defect.
60-
- Verify files you care about against a known-good copy, or rewrite them with a v1.7.0 build. A rewrite is sufficient no reformat is needed.
61-
- Reads were never affected, so a card written by another system and only read by this driver is not at risk.
59+
- `SD_FAT32_audit` and `SD_FAT32_fsck` cannot detect it, and a CLEAN result is not evidence either way — the filesystem structures stay intact and only sector *contents* would be wrong. Same shape as v1.6.0's mid-sector append defect.
60+
- Opening a file and looking at it settles the question for most data. Rewriting an affected file with a v1.7.0 build is sufficient; no reformat is needed.
61+
- Reads were never affected, so a card written by another system and only read by this driver was never at risk.
6262

63-
`DOCs/MIGRATION-GUIDE-v1.7.0.md` §0 covers this in full.
63+
`DOCs/MIGRATION-GUIDE-v1.7.0.md` §0 covers this in full, including why the driver's own two checks could not catch it.
6464

6565
### Breaking Changes
6666

DOCs/MIGRATION-GUIDE-v1.7.0.md

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,61 @@ For the full picture of how error reporting now works, see
1212

1313
---
1414

15-
## 0. Read this first: data written by an earlier release may be wrong on the card
15+
## 0. A write-path timing defect was fixed — what it means for data you already wrote
1616

17-
This needs no code change, but it may need you to look at your data.
17+
**Short version: the risk to your existing data is low, and there is very likely nothing
18+
for you to do.** This section exists because the defect was real and you are entitled to
19+
know it existed, not because we think your card is corrupt.
20+
21+
### What was wrong
1822

1923
v1.7.0 fixes a write-path timing defect in which the outgoing data could be one bit out
2024
of phase with the clock that latched it, so the card **stored a shifted sector while
21-
reporting success.** Whether a given build was affected depended on where the linker
22-
placed the driver's data in hub RAM — so it was a property of the *binary*, not of the
23-
card, the card slot, or the code you wrote. Enabling `SD_INCLUDE_SPEED` was enough to
24-
move a build from one side of the boundary to the other. Reads were never affected.
25+
reporting success**. Whether a build was affected depended on where the linker placed
26+
the driver's data in hub RAM — a property of the *binary*, not of the card, the card
27+
slot, or the code you wrote. Reads were never affected. The structural flaw was present
28+
in every release from v0.9.3 through v1.6.1.
29+
30+
### Why we believe the practical risk is low
31+
32+
- **No user has reported it.** A one-bit shift does not corrupt data subtly — it makes
33+
text unreadable and binary structures obviously malformed. Anyone affected while
34+
writing ordinary files would have noticed at once.
35+
- **Our own certification never hit it in four months.** Each release was verified by 27
36+
regression binaries, each with its own hub layout, exercising thousands of sector
37+
writes with byte-level content verification. Across 18 releases, none landed on the
38+
failing side. The defect surfaced only when an unrelated commit shifted the layout
39+
during v1.7.0 development.
40+
- Together those say the failing layout region is small, not that it is impossible.
41+
42+
**The honest caveat:** our test binaries are harnesses. Yours is your application plus
43+
this driver, which samples a layout we never did. That is why this note exists at all,
44+
rather than "it never affected anyone."
45+
46+
### Why the driver did not catch it itself
2547

26-
**Why you cannot have noticed.** Two things that look like they should have caught it
27-
did not:
48+
Not because you could not have seen it — you very likely would have. Because the
49+
driver's *own* two checks were both incapable of it:
2850

2951
- The card's data-response token said "accepted." In SPI mode, write-CRC checking is off
30-
unless the host turns it on with CMD59, which this driver has never sent — so that
31-
token only ever confirmed the packet was well-formed, never that the payload bits were
32-
yours.
33-
- Reading the file back matched. The shifted bytes were genuinely what the card had
34-
stored, so a read returned them faithfully and any byte-compare agreed with itself.
35-
36-
**What to do.** If you have written data with any earlier release and its integrity
37-
matters:
38-
39-
- `SD_FAT32_audit` and `SD_FAT32_fsck` **will not find this.** The filesystem structures
40-
are intact and internally consistent; only the *contents* of data sectors are wrong.
41-
There is no filesystem footprint to detect, exactly as with the v1.6.0 mid-sector
42-
append defect.
43-
- Verify affected files against a known-good copy, or simply rewrite them with a v1.7.0
44-
build. A rewrite is sufficient — nothing about the card needs reformatting.
45-
- If your data is text or otherwise self-evident, a bit-shifted sector is usually
46-
obvious on inspection. If it is binary telemetry, it may not be, and comparison
47-
against a backup is the only reliable check.
48-
49-
If you have written nothing you still care about, there is nothing to do here.
52+
unless the host enables it with CMD59, which this driver has never sent — so that token
53+
only ever confirmed the packet was well-formed, never that the payload bits were yours.
54+
- A read-back comparison agreed with itself. The shifted bytes were genuinely what the
55+
card had stored, so the card returned them faithfully.
56+
57+
### If you want to check anyway
58+
59+
- `SD_FAT32_audit` and `SD_FAT32_fsck` **will not find this**, and their reporting the
60+
volume CLEAN is not evidence either way. The filesystem structures are intact and
61+
self-consistent; only the *contents* of data sectors would be wrong. Same shape as
62+
v1.6.0's mid-sector append defect.
63+
- **Open a file and look at it.** For text, logs, or anything with recognisable
64+
structure, a bit-shifted sector is immediately obvious. That check costs a minute and
65+
settles it for most people.
66+
- Only if you hold data that is *both* opaque — binary telemetry, say — *and*
67+
irreplaceable is a comparison against a known-good copy worth the effort. If you find
68+
a problem, rewriting the file with a v1.7.0 build is sufficient; nothing about the card
69+
needs reformatting.
5070

5171
---
5272

0 commit comments

Comments
 (0)