Repository navigation
fix(fs): preserve file bytes when a write arrives in chunks (#748) - #751
Merged
Merged
Conversation
`file_write` merges the untouched prefix of the old file because every write allocates fresh COW blocks. It read that prefix with `file_read(entry, …)`, passing `entry.extent_lba` — which is in 4096-byte blocks — while `file_read` expects a **sector** LBA, as `neodos_v2::read_entry_bytes` does (`translate_lba(extent_lba * 8)`). The preserve read therefore started at an unrelated location, so any file written in more than one call kept garbage where it should have kept its old bytes, with the correct final size. That is `neocurl -o`: a 525-byte body fits in one `sys_write`, but 1391 bytes take two (the syscall caps at 4 KiB) and the result was a corrupt DER — the `--ca` failure tracked in #748. The registry hive, flushed in 4 KiB chunks, was exposed to the same bug. The preserve read now translates the extent like the rest of the module. Kernel test `neofs_v2_chunked_write_preserves_prefix` writes 1024 + 367 + 100 bytes in three calls and checks every byte. Closes #748
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué cambia
file_writeconserva el contenido no sobrescrito cuando el nuevo fichero esmayor que el rango escrito (necesario porque cada escritura COW usa bloques
nuevos). Para leer ese prefijo llamaba a
file_read(entry, …)pasandoentry.extent_lba, que está en bloques de 4096 B, mientras quefile_readespera el LBA de sectores (igual que
neodos_v2::read_entry_bytes, que lotraduce con
translate_lba(extent_lba * 8)).Consecuencia: cualquier escritura que no sea «todo el fichero desde el offset 0
en una sola llamada» guardaba basura en el prefijo, con el tamaño correcto.
Eso es exactamente lo que hacía
neocurl -o:sys_write) → correcto.sys_write, el syscall capa a 4 KiB) → DER corrupto, aunque eltamaño fuera el esperado. De ahí el
certificate chain: malformed DERal usarese fichero como
--ca(neocurl --ca: un DER de 1391 B se lee corrupto (el de 525 B funciona) #748).Arreglo
Traducir el extent a sectores antes de la lectura de preservación (misma
convención que el resto del módulo). También afecta positivamente al volcado del
hive del registro, que se escribe en trozos de 4 KiB.
Verificación
neofs_v2_chunked_write_preserves_prefix: escribe1024 B + 367 B + 100 B en tres llamadas y comprueba byte a byte que el prefijo
se conserva y que el fichero crece bien.
neocurl -o … 525 By1391 Bya producen DER válido;neocurl --ca C:\TLS\ISRG.DER https://valid-isrgrootx1.letsencrypt.org/verifica la cadena real (antes:
malformed DER), y la descarga de IANA siguedando
200 569858 bytes.Closes #748