Skip to content

Commit

Permalink
✨ mprotect syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
froz42 committed Oct 15, 2023
1 parent 3967cb5 commit 9965433
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion includes/syscall_strace.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define POLL_FDS_AFTER 10
#define SEEK_WHENCE 11
#define PTR 12
#define MMAP_PROT 13
#define MEM_PROT 13
#define MMAP_FLAGS 14

/**
Expand Down
2 changes: 1 addition & 1 deletion srcs/syscall/param_log/log_mmap_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static const flag_str_t mmap_prot_flags[] = {
* @param value the value to log
* @return int the number of bytes written
*/
int log_MMAP_PROT(uint64_t value)
int log_MEM_PROT(uint64_t value)
{
if (value == 0)
return ft_dprintf(STDERR_FILENO, "PROT_NONE");
Expand Down
2 changes: 1 addition & 1 deletion srcs/syscall/param_log/param_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int log_SEEK_WHENCE(uint64_t value);
* @param value the value to log
* @return int the number of bytes written
*/
int log_MMAP_PROT(uint64_t value);
int log_MEM_PROT(uint64_t value);

/**
* @brief Log mmap flags
Expand Down
4 changes: 3 additions & 1 deletion srcs/syscall/syscall_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ static const syscall_description_t x86_64_syscalls[] = {
[6] = {"lstat", SIGNED_INT, {-STRING, STAT_STRUCT, NONE}},
[7] = {"poll", POLL_FDS_AFTER, {-POLL_FDS, -INT, -SIGNED_INT, NONE}},
[8] = {"lseek", SIGNED_INT, {-SIGNED_INT, -SIGNED_INT, -SEEK_WHENCE, NONE}},
[9] = {"mmap", PTR, {-PTR, -INT, -MMAP_PROT, -MMAP_FLAGS, -SIGNED_INT, HEX}}};
[9] = {"mmap", PTR, {-PTR, -INT, -MEM_PROT, -MMAP_FLAGS, -SIGNED_INT, HEX}},
[10] = {"mprotect", SIGNED_INT, {-PTR, -SIGNED_INT, -MEM_PROT, NONE}},
};
2 changes: 1 addition & 1 deletion srcs/syscall/syscall_log_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static const log_function_t log_functions[] = {
ADD_LOGGER(POLL_FDS_AFTER),
ADD_LOGGER(SEEK_WHENCE),
ADD_LOGGER(PTR),
ADD_LOGGER(MMAP_PROT),
ADD_LOGGER(MEM_PROT),
ADD_LOGGER(MMAP_FLAGS),
};

Expand Down

0 comments on commit 9965433

Please sign in to comment.