Commit 84e57b2a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restore: Add prctl validation

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 2e00d019
...@@ -331,21 +331,25 @@ self_len_end: ...@@ -331,21 +331,25 @@ self_len_end:
/* /*
* Tune up the task fields. * Tune up the task fields.
*/ */
sys_prctl(PR_SET_NAME, (long)core_entry->task_comm, 0, 0, 0);
sys_prctl(PR_SET_MM, PR_SET_MM_START_CODE, #define sys_prctl_safe(opcode, val1, val2) \
(long)core_entry->mm_start_code, 0, 0); do { \
sys_prctl(PR_SET_MM, PR_SET_MM_END_CODE, ret = sys_prctl(opcode, val1, val2, 0, 0); \
(long)core_entry->mm_end_code, 0, 0); if (ret) { \
sys_prctl(PR_SET_MM, PR_SET_MM_START_DATA, write_num_n(__LINE__); \
(long)core_entry->mm_start_data, 0, 0); write_num_n(ret); \
sys_prctl(PR_SET_MM, PR_SET_MM_END_DATA, goto core_restore_end; \
(long)core_entry->mm_end_data, 0, 0); } \
sys_prctl(PR_SET_MM, PR_SET_MM_START_STACK, } while (0)
(long)core_entry->mm_start_stack, 0, 0);
sys_prctl(PR_SET_MM, PR_SET_MM_START_BRK, sys_prctl_safe(PR_SET_NAME, (long)core_entry->task_comm, 0);
(long)core_entry->mm_start_brk, 0, 0); sys_prctl_safe(PR_SET_MM, PR_SET_MM_START_CODE, (long)core_entry->mm_start_code);
sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_prctl_safe(PR_SET_MM, PR_SET_MM_END_CODE, (long)core_entry->mm_end_code);
(long)core_entry->mm_brk, 0, 0); sys_prctl_safe(PR_SET_MM, PR_SET_MM_START_DATA, (long)core_entry->mm_start_data);
sys_prctl_safe(PR_SET_MM, PR_SET_MM_END_DATA, (long)core_entry->mm_end_data);
sys_prctl_safe(PR_SET_MM, PR_SET_MM_START_STACK,(long)core_entry->mm_start_stack);
sys_prctl_safe(PR_SET_MM, PR_SET_MM_START_BRK, (long)core_entry->mm_start_brk);
sys_prctl_safe(PR_SET_MM, PR_SET_MM_BRK, (long)core_entry->mm_brk);
/* /*
* We need to prepare a valid sigframe here, so * We need to prepare a valid sigframe here, so
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment