Skip to content

Commit

Permalink
Add execveat syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
asvrada committed Nov 29, 2021
1 parent 6c8ab64 commit ca9139e
Show file tree
Hide file tree
Showing 5 changed files with 461 additions and 162 deletions.
10 changes: 8 additions & 2 deletions include/myst/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,18 @@ long myst_syscall_fchownat(
gid_t group,
int flags);

#define FB_PATH_NOT_EMPTY 0x0000
#define FB_TYPE_FILE 0x0001
#define FB_TYPE_DIRECTORY 0x0010
#define FB_THROW_ERROR_NOFOLLOW 0x00010000

/* Used by XXXXXat() syscalls */
long myst_get_absolute_path_from_dirfd(
int dirfd,
const char* filename,
const char* pathname,
int flags,
char** abspath_out);
char** abspath_out,
const int flags_behavior);

long myst_syscall_get_process_stack(void** stack, size_t* stack_size);

Expand Down
7 changes: 4 additions & 3 deletions kernel/chown.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,15 @@ long myst_syscall_fchownat(
if ((flags & ~(AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW)) != 0)
ERAISE(-EINVAL);

ECHECK(myst_get_absolute_path_from_dirfd(dirfd, pathname, flags, &abspath));

if (*abspath == '\0')
if (*pathname == '\0' && (flags & AT_EMPTY_PATH) && dirfd != AT_FDCWD)
{
ECHECK(myst_syscall_fchown(dirfd, owner, group));
}
else
{
ECHECK(myst_get_absolute_path_from_dirfd(
dirfd, pathname, flags, &abspath, FB_PATH_NOT_EMPTY));

if (flags & AT_SYMLINK_NOFOLLOW)
{
ECHECK(myst_syscall_lchown(abspath, owner, group));
Expand Down
Loading

0 comments on commit ca9139e

Please sign in to comment.