diff options
| author | user <user@clank> | 2026-09-22 17:12:25 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-22 17:12:25 +0200 |
| commit | a7a9cfdfa6b25101ae13a87abaddce0e736c7fd1 (patch) | |
| tree | b21102fac37210abfecc497bed8619892abc39e6 /src/programs.asm | |
| parent | usr: grep, more, cp, nc - and make pollcon pump the link (diff) | |
| download | gbos-a7a9cfdfa6b25101ae13a87abaddce0e736c7fd1.tar.gz gbos-a7a9cfdfa6b25101ae13a87abaddce0e736c7fd1.tar.xz gbos-a7a9cfdfa6b25101ae13a87abaddce0e736c7fd1.zip | |
fs: bounds-check direct blocks - a file over 2 KiB ate the next inode
sys_getb/sys_putb indexed inode.blocks[pos/256] with no limit at all, so a
file that grew past its pointers just kept walking: first through the 4
unused bytes at the tail of the 16-byte inode, then straight into the NEXT
inode, reading its type/nlink/size as block numbers.
It hides well. Reads and writes alias identically, so a big file can be
written and read back byte-for-byte and look fine - until something else
touches the neighbouring inode, after which the tail of the file is garbage
from whatever block those bytes now name. Found by serving a 7 KB file over
httpd: corruption began at exactly offset 3072, and only sometimes.
- NDIRECT 8 -> 12: bytes 4..15 are all block pointers now, which is what the
runaway indexing was already doing by accident. Files go to 3 KiB, no
on-disk layout change, no format bump.
- getb past the last direct block reports EOF; putb drops the byte like a
full disk. A capped file beats a corrupted neighbour.
count 250 > big (7142 bytes) now stops at 3072 and its neighbours survive.
Diffstat (limited to 'src/programs.asm')
0 files changed, 0 insertions, 0 deletions
