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

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Fixes for the sim user heap that is built on the host allocator 
(`CONFIG_MM_UMM_CUSTOMIZE_MANAGER`, used for example by `sim:asan`), from 
Xiaomi Vela, split out of #22206 as asked in its review.
   
   - **sim/sim_ummheap.c: fix incompatible_cast bug**: `update_stats()` passed 
`&usmblks`, a `size_t`, to `atomic_try_cmpxchg()`, which reads it as an `int`. 
The two locals are `int` now.
   - **sim/ummheap: panic if total memory exceeds limit**: `update_stats()` 
reports and panics (`DEBUGPANIC()`) when the heap usage passes `SIM_HEAP_SIZE`.
   - **arch/sim: give the customize heap static its own name**: `g_heap` 
becomes `g_sim_heap`. `fs/procfs` has a static `g_heap` too, and a debugger 
that resolves `g_heap` may pick that one instead of the sim heap, whose `struct 
mm_heap_s` layout is defined only in this file.
   
   ## Impact
   
   - sim with the customized user heap: the heap reports and panics 
(`DEBUGPANIC()`) when its usage passes the heap size.
   - Other builds are not affected.
   
   ## Testing
   
   Host: Ubuntu 22.04 x86_64, GCC 13.4.0, CMake 3.23 + Ninja 1.10. Base: master 
25b649e1c08.
   
   `./tools/checkpatch.sh -c -u -m -g HEAD~3..HEAD` passes.
   
   `sim:asan` (`CONFIG_SIM_ASAN=y`, `CONFIG_MM_UMM_CUSTOMIZE_MANAGER=y`) builds 
and runs `free`, `hello` and `ostest` with the same output as master. In this 
configuration ostest stops at aio_test, which cannot open `/tmp/aio_test.dat` 
because there is no `/tmp`; master does the same.
   
   Not tested: a heap usage above `SIM_HEAP_SIZE`.
   


-- 
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