jingfei195887 opened a new pull request, #22501:
URL: https://github.com/apache/nuttx/pull/22501

   ## Summary
   
   Validate TMPFS write offsets and end representability before updating the 
file. Return EINVAL for an invalid position and EFBIG when the end cannot fit 
the file offset or backing allocation size.
   
   ## Impact
   
   - Functionality: rejected writes preserve file position, size, content and 
modification/status timestamps. Ordinary writes, append, sparse zero filling 
and zero-length writes retain their behavior.
   - Compatibility: no public API, Kconfig, driver, hardware, documentation or 
build-system change. Existing allocation guard checks remain in place.
   - Size: identical selected options in small sim configurations retaining 
TMPFS give text/data/bss deltas of 128/0/0 bytes. The measured 0c45a2fc48b9 / 
apps c621be657e baseline is reused from the preceding TMPFS size comparison; 
newly added local test options are disabled in this comparison.
   
   ## Testing
   
   I confirm that changes are verified on local setup and work as intended:
   
   - Linux x86_64, GCC 13.1.0; sim:nsh with TMPFS and assertions; nuttx-apps 
c621be657e.
   - Public/internal scalar/vector writes, overwrite, append, sparse data and 
zero filling, zero-length writes, file position, readback and cleanup.
   
   Testing logs before change (0c45a2fc48b9), ordinary bounded operations only:
   ```text
   TMPFSWRITE NORMAL checks=194 failures=0
   TMPFSWRITE TOTAL checks=196 failures=0
   ```
   
   Testing logs after change (3c5bf174e06f), in both default and large-file/512 
KiB FS heap configurations:
   ```text
   TMPFSWRITE NORMAL checks=194 failures=0
   TMPFSWRITE REJECTIONS checks=120 failures=0
   TMPFSWRITE TOTAL checks=316 failures=0
   ```
   
   The rejection test code is compiled and run only on the fixed branch. The 
baseline never executes these cases. Rejection checks include returned errors, 
unchanged position, size, content, mtime/ctime, references and cleanup.
   
   Full-file/commit checkpatch, Make/CMake, OSTest and tested-HEAD gate pass. 
Large-file-enabled protected qemu-armv7r:pnsh and kernel qemu-armv8a:knsh 
builds pass, covering different allocation-size widths at compile time.
   
   No physical hardware, protected/kernel runtime, SMP stress, 
allocation-failure injection or synthetic oversized append state was tested.
   
   ## PR verification Self-Check
   
   - [x] This PR introduces only one functional change.
   - [x] I have updated all required description fields above.
   - [x] The commit has a component prefix, explanatory body, and my 
Signed-off-by; code style checks pass.
   - [ ] My PR is still work in progress (not ready for review).
   - [x] My PR is ready for review.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to