Skip to content

Commit

Permalink
execute elf add executable permissions check. (RT-Thread#7769)
Browse files Browse the repository at this point in the history
  • Loading branch information
geniusgogo authored Jul 3, 2023
1 parent fd3b432 commit 2aa4510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/lwp/lwp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,11 @@ pid_t lwp_execve(char *filename, int debug, int argc, char **argv, char **envp)
return -RT_ERROR;
}

if (access(filename, X_OK) != 0)
{
return -EACCES;
}

lwp = lwp_new();

if (lwp == RT_NULL)
Expand Down
5 changes: 5 additions & 0 deletions components/lwp/lwp_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,11 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
int i;
struct lwp_args_info args_info;

if (access(path, X_OK) != 0)
{
return -EACCES;
}

lwp = lwp_self();
thread = rt_thread_self();
uni_thread = 1;
Expand Down

0 comments on commit 2aa4510

Please sign in to comment.