[PATCH] rtems: Relax mode checks in rtems_signal_catch()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 19 14:22:27 UTC 2021


Check only for invalid modes if a valid handler is presented to
rtems_signal_catch().  When NULL is used for the handler, ASR processing
is disabled and the mode is not used.

Update #4244.
---
 cpukit/rtems/src/signalcatch.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c
index 9907908a40..6924f34428 100644
--- a/cpukit/rtems/src/signalcatch.c
+++ b/cpukit/rtems/src/signalcatch.c
@@ -39,7 +39,10 @@ rtems_status_code rtems_signal_catch(
   ISR_lock_Context    lock_context;
 
 #if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
-  if ( !_Modes_Is_interrupt_level_supported( mode_set ) ) {
+  if (
+    asr_handler != NULL &&
+    !_Modes_Is_interrupt_level_supported( mode_set )
+  ) {
     return RTEMS_NOT_IMPLEMENTED;
   }
 #endif
@@ -47,7 +50,10 @@ rtems_status_code rtems_signal_catch(
   executing = _Thread_State_acquire_for_executing( &lock_context );
 
 #if defined(RTEMS_SMP)
-  if ( !_Modes_Is_preempt_mode_supported( mode_set, executing ) ) {
+  if (
+    asr_handler != NULL &&
+    !_Modes_Is_preempt_mode_supported( mode_set, executing )
+  ) {
     _Thread_State_release( executing, &lock_context );
     return RTEMS_NOT_IMPLEMENTED;
   }
-- 
2.26.2



More information about the devel mailing list