Skip to content

Commit 90907b8

Browse files
committed
rtos/esp32_stacking: AddressSanitizer: heap-buffer-overflow issue
#0 0x10c41485f in __asan_memcpy+0x1af (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x4285f) #1 0x10ab3dcfd in buf_cpy binarybuffer.c:60 #2 0x10ab2774b in rtos_generic_stack_read rtos.c:664 #3 0x10aac3ed9 in freertos_get_thread_registers_from_stack FreeRTOS.c:1148 #4 0x10aab2ea2 in freertos_get_thread_reg_list FreeRTOS.c:1238 #5 0x10aab32b1 in freertos_get_thread_reg FreeRTOS.c:1269 #6 0x10aabe903 in freertos_get_tasks_details FreeRTOS.c:797 #7 0x10aab270f in freertos_update_threads FreeRTOS.c:1060 #8 0x10ab1d66e in rtos_thread_packet rtos.c:395 #9 0x10ab1bad2 in gdb_thread_packet rtos.c:191 #10 0x10aa4643d in gdb_input_inner gdb_server.c:3547 #11 0x10aa3d534 in gdb_input gdb_server.c:3743 #12 0x10aa8e565 in server_loop server.c:566 #13 0x1099f6e66 in openocd_thread openocd.c:380 #14 0x1099f685e in openocd_main openocd.c:419 #15 0x1099f52b1 in main main.c:40 #16 0x7fff6bf78cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)
1 parent 2922be3 commit 90907b8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/rtos/rtos_freertos_stackings.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ static int rtos_freertos_esp_xtensa_stack_read_voluntary(struct target *target,
3535

3636
/*
3737
The XTensa FreeRTOS implementation has *two* types of stack frames; one for
38-
involuntatrily swapped out tasks and another one for tasks which voluntarily yielded.
38+
involuntarily swapped out tasks and another one for tasks which voluntarily yielded.
3939
*/
40+
41+
/*
42+
Important Note: If you modify one of the stack_register_offset array, also check corresponding
43+
stack_registers_size in rtos_register_stacking
44+
*/
45+
4046
static const struct stack_register_offset rtos_freertos_esp32_stack_offsets[] = {
4147
{ XT_REG_IDX_PC, 0x04, 32 }, /* PC */
4248
{ XT_REG_IDX_AR0, 0x0c, 32 }, /* A0 */
@@ -672,7 +678,7 @@ static const struct stack_register_offset rtos_freertos_esp32_s3_voluntary_stack
672678
};
673679

674680
const struct rtos_register_stacking rtos_freertos_esp32_stacking = {
675-
30*4, /* stack_registers_size */
681+
40*4, /* stack_registers_size */
676682
-1, /* stack_growth_direction */
677683
ESP32_NUM_REGS_G_COMMAND, /* num_output_registers */
678684
rtos_generic_stack_align8, /* stack_alignment */
@@ -690,7 +696,7 @@ const struct rtos_register_stacking rtos_freertos_esp32_s2_stacking = {
690696
};
691697

692698
const struct rtos_register_stacking rtos_freertos_esp32_s3_stacking = {
693-
30*4, /* stack_registers_size */
699+
40*4, /* stack_registers_size */
694700
-1, /* stack_growth_direction */
695701
ESP32_S3_NUM_REGS_G_COMMAND, /* num_output_registers */
696702
rtos_generic_stack_align8, /* stack_alignment */

0 commit comments

Comments
 (0)