fs/pseudofile: fix buffer sizing and sparse growth - #19704
Conversation
|
There was a problem hiding this comment.
Thank you @YWHKKX :-)
Please:
- sign the commit with
git commit -s(see https://nuttx.apache.org/docs/latest/contributing/guide.html#commit-requirements). - Update according to @xiaoxiang781216 hints.
jerpelea
left a comment
There was a problem hiding this comment.
please sign the patch
git commit -s
dc39783 to
da33256
Compare
Grow the in-memory pseudofile buffer by doubling instead of 1<<LOG2_CEIL, which can under-allocate on 32-bit targets for large expand sizes. Also: * reject size_t wrap before expand on write (-EFBIG) * clear newly addressed bytes when the file grows * route truncate growth through the same expand path Impact: CONFIG_PSEUDOFS_FILE expand/write/truncate only; no API or build-system change. Testing: host arithmetic PoC blocked; WSL sim:pseudofile-poc (SIM_M32+KASAN) write returns -ENOMEM instead of SIGSEGV in memcpy. Signed-off-by: ywhkkx <2076064543@qq.com>
419043c to
c52c411
Compare
|
@YWHKKX please squash your change into one patch. |
|
@xiaoxiang781216 already squashed to c52c411 |
linguini1
left a comment
There was a problem hiding this comment.
Code review of the updated expand/write/truncate paths on current master.
Please provide some more testing detail. Did you perform any runtime tests?
cederom
left a comment
There was a problem hiding this comment.
Thank you @YWHKKX :-) Before and after runtime tests are welcome as @linguini1 noted :-)
|
Thanks @linguini1 @cederom :-) Yes — runtime tested on WSL2 with sim (32-bit) + KASAN, CONFIG_PSEUDOFS_FILE=y. Before: write after a large seek crashes (SIGSEGV, rc=139). |
|
Can you please give a concrete test setup or runtime logs? |
|
Thanks @linguini1. Concrete test setup
The init-time test opens a pseudofile, seeks to a large offset, Runtime logsBefore this PR: After this PR: |
|
@linguini1 PTAL, here already replied |
Summary
Impact
Testing
I confirm that changes are verified on local setup and work as intended:
CONFIG_PSEUDOFS_FILE=yBefore
After
PR verification Self-Check