Skip to content

Commit

Permalink
binfmt: add enter_critical_section
Browse files Browse the repository at this point in the history
adding enter_critical_section to ensure non preemption in smp
Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Aug 10, 2023
1 parent b705103 commit 2759262
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions binfmt/binfmt_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
FAR const posix_spawnattr_t *attr)
{
FAR struct binary_s *bin;
irqstate_t flags;
int pid;
int ret;

Expand Down Expand Up @@ -126,6 +127,7 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
* handler.
*/

flags = enter_critical_section();
sched_lock();

/* Then start the module */
Expand Down Expand Up @@ -160,10 +162,12 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
#endif

sched_unlock();
leave_critical_section(flags);
return pid;

errout_with_lock:
sched_unlock();
leave_critical_section(flags);
unload_module(bin);
errout_with_bin:
kmm_free(bin);
Expand Down

0 comments on commit 2759262

Please sign in to comment.