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

   ## Summary
   
   `arch_setjmp.S` stores `d8`-`d15`, 8 bytes each, at offsets 112 to 176 of 
the `jmp_buf`. `struct setjmp_buf_s` in `arch/arm64/include/setjmp.h` declared 
them as eight 4-byte `float` fields, so the structure was 32 bytes short and 
`setjmp()` wrote past its end.
   
   This matters only with `CONFIG_ARCH_SETJMP_H`. Without it the toolchain's 
larger `jmp_buf` is used, which hid the problem.
   
   `d8`-`d15` are now `uint64_t`. With the FPU the structure is 176 bytes, and 
the layout matches the assembly.
   
   ## Impact
   
   arm64 with `CONFIG_ARCH_SETJMP_H` only.
   
   ## Testing
   
   Compile-time check of the layout with `CONFIG_ARCH_FPU`:
   
   ```
   _Static_assert(offsetof(struct setjmp_buf_s, d8) == 112, "d8");
   _Static_assert(sizeof(struct setjmp_buf_s) == 176, "size");
   ```
   
   `qemu-armv8a:knsh` with `CONFIG_ARCH_SETJMP_H=y` in QEMU 11: the ostest 
setjmp test passes, and ostest exits with status 0.
   


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