Skip to content

Commit

Permalink
rcar:logging: Fix forever assert recursion hang
Browse files Browse the repository at this point in the history
Forever recursive occurring is at (4) in below snip of code.
This patch updates source code of rcar_log_func to avoid this situation.

-------------------------------------------------------------------------
 # ifdef NDEBUG
 # define assert(expr)	((void)0)
 # else
 # define assert(expr)	\
   ((expr) ? (void)0 : _assert_trap(#expr, __FILE__, __LINE__,
    __func__))// (2)
 # endif

_assert_trap()
_assert_log();
EMSG_RAW()
trace_printf()
trace_vprintf();   // lib/libutils/ext/trace.c
trace_ext_puts(const char *str)   //core\arch\arm\plat-rcar\trace_ext.c
log_debug_send(msg_block, msg_block_num);
cpu_id = get_core_pos();       //core\arch\arm\plat-rcar\rcar_log_func.c
  /*
   * Foreign interrupts must be disabled before playing with current
  * core since we otherwise may be rescheduled to a different core.
  */
  assert(thread_get_exceptions() & THREAD_EXCP_FOREIGN_INTR); //(4)
	return __get_core_pos();

-------------------------------------------------------------------------

Signed-off-by: Dien Pham <[email protected]>
  • Loading branch information
DienPhamM committed Oct 21, 2023
1 parent 67c90b0 commit 3933e1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/arch/arm/plat-rcar/rcar_log_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ void log_debug_send(const struct msg_block_t *msg_block, int32_t msg_block_num)
size_t memcpy_size;
int32_t i;

cpu_id = get_core_pos();
/*
* Foreign interrupts must be disabled before playing with current
* core since we otherwise may be rescheduled to a different core.
*/
if (!(thread_get_exceptions() & THREAD_EXCP_FOREIGN_INTR))
return;
cpu_id = __get_core_pos();

if ((log_nonsec_ptr != NULL) && (cpu_id < CFG_TEE_CORE_NB_CORE)) {
log_area = &log_nonsec_ptr[cpu_id * LOG_NS_CPU_AREA_SIZE];
Expand Down

0 comments on commit 3933e1a

Please sign in to comment.