Skip to content

fix(fs): drop cached pages when COW blocks are freed (#753) - #754

Merged
alexis900 merged 2 commits into
developfrom
fix/chunked-write-stress
Nov 17, 2026
Merged

alexis900 merged 2 commits into
developfrom
fix/chunked-write-stress

Conversation

@alexis900

Copy link
Copy Markdown
Collaborator

Continúa #751. Al reclamar un extent reemplazado, los bloques volvían a la free list pero sus páginas seguían en la caché. Una entrada sucia de un bloque liberado puede volcarse después —cuando la free list ya se lo ha dado a otro fichero— y sobrescribir sus datos; una limpia puede sembrar una escritura posterior con los bytes del fichero anterior. El contenido de un bloque liberado ya no importa, así que invalidar siempre es correcto.

Cambios

  • reclaim_cow_garbage invalida el rango de caché de cada extent liberado.
  • Tests nuevos: neofs_v2_reused_blocks_do_not_leak_old_data (escribir, borrar, recrear, leer) y neofs_v2_chunked_writes_many_files (8 ficheros, 1024+367 B cada uno).
  • neocurl imprime, al fallar TLS con --ca, cuántos bytes ha entregado a libtls y los 4 primeros en hex: distingue fichero truncado/desplazado de certificado equivocado.

Estado

neocurl: ca 1391 bytes [01000000]   (A)
neocurl: ca 1391 bytes [01000100]   (B)
neocurl: ca 1391 bytes [01000200]   (C)

El tamaño es correcto pero el contenido no es el DER (30 82 05 6b), y los bytes 2-3 se incrementan por fichero: parece que la lectura devuelve una estructura del propio filesystem (nodo/dirent) en lugar del bloque de datos, es decir que el extent del fichero apunta a un bloque de metadatos — un problema de free list (un bloque en uso entregado como libre) que no se reproduce aún en los tests.

Refs #748, #753

Reclaiming a replaced extent returned its blocks to the free list but left
their page-cache entries in place. A *dirty* entry for a freed block could then
be written back after the free list had handed that block to another file,
overwriting its data; a clean one could seed a later write with the previous
file's bytes. The content of a freed block no longer matters, so invalidating is
always correct.

The window explains a boot-to-boot flake in the guest: downloading a 1391-byte
DER and using it as `--ca` worked in one boot and failed with `malformed DER` in
the next, while the download sizes were always right (#753).

Tests: `neofs_v2_reused_blocks_do_not_leak_old_data` (write, delete, recreate,
flush, read) and `neofs_v2_chunked_writes_many_files` (8 files, 1024 + 367
bytes each).
When a `--ca` file cannot be parsed the client now prints how many bytes it
handed to `libtls` and the first four in hex, so a truncated or shifted file is
distinguishable from a wrong certificate at a glance:

```
neocurl: TLS failure
neocurl: certificate chain: malformed DER
neocurl: ca 1391 bytes [01000000]
```

Refs #748, #753
@alexis900
alexis900 merged commit 3749772 into develop Nov 17, 2026
4 checks passed
@alexis900
alexis900 deleted the fix/chunked-write-stress branch November 17, 2026 09:37
alexis900 added a commit that referenced this pull request Nov 17, 2026
* feat(tls): load the system trust store (D8)

HTTPS needed an explicit `--ca FILE`: the image carried no roots, so every real
connection was a fixture exercise.

- `libtls::der::split_certificates` splits a concatenated DER bundle using the
  X.690 lengths (no PEM/base64 parser on the target), with tests.
- `libnet::http_transport::system_roots()` reads
  `\NeoDOS\System\config\roots.der` through `ReadContent` and returns the
  anchors; a missing or unreadable bundle yields an empty list so TLS fails
  closed.
- `neocurl` uses the system store when `--ca` is absent (`--ca` still
  overrides), and refuses to start when there are no anchors at all.
- NeoDev (external, NeoDOS-Project/NeoDev#47) packs the bundle from the host's
  CA store; `NEODOS_TRUST_BUNDLE` overrides the source.

Docs: D8 marked resolved in `libtls-https-design.md` (§3.6) and the userland
guide; `CHANGELOG.md` gains an Unreleased section with this and the filesystem
fixes from #750/#751/#754.

* fix(usermode): raise the binary slot to 512 KiB and refuse oversized images

`MAX_BIN_SIZE` capped a user binary at 192 KiB and the loader *silently
truncated* anything larger, so the ELF parser failed far from the cause. When
`neocurl.nxe` (crypto + TLS + trust store) crossed 192 KiB the shell reported
"Comando o nombre de archivo incorrecto" and the binary simply never ran.

- `MAX_BIN_SIZE` is now 512 KiB (slot 576 KiB → 56 slots in the 32 MB user
  window, still ample).
- `create_process_from_ob_path` refuses a binary bigger than the cap with
  `NoMemory` and logs the size, instead of loading a truncated image.
- The design note for large NXEs records the new limit.

Refs #755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant