1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-12-11 11:35:39 -05:00

Validate process area

This commit is contained in:
Alex Kotov 2020-11-26 17:22:33 +05:00
parent 1138bfcb06
commit 32ea70c6c4
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 11 additions and 2 deletions

View file

@ -71,6 +71,10 @@ enum KernelMQ_Process_Error KernelMQ_Process_create_from_kernel(
return KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG;
}
if (base + size - 1 != limit) {
return KERNELMQ_PROCESS_ERROR_INVALID_AREA;
}
process->areas[area_index].base = base;
process->areas[area_index].size = size;
process->areas[area_index].limit = limit;
@ -108,6 +112,10 @@ enum KernelMQ_Process_Error KernelMQ_Process_create_from_module(
return KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG;
}
if (base + size - 1 != limit) {
return KERNELMQ_PROCESS_ERROR_INVALID_AREA;
}
process->areas[0].base = base;
process->areas[0].size = size;
process->areas[0].limit = limit;

View file

@ -18,8 +18,9 @@ enum KernelMQ_Process_Error {
KERNELMQ_PROCESS_ERROR_OK = 0,
KERNELMQ_PROCESS_ERROR_CMDLINE_TOO_LONG = 1,
KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG = 2,
KERNELMQ_PROCESS_ERROR_KERNEL_AREAS_LENGTH_TOO_LONG = 3,
KERNELMQ_PROCESS_ERROR_MODULES_TOO_MANY = 4,
KERNELMQ_PROCESS_ERROR_INVALID_AREA = 3,
KERNELMQ_PROCESS_ERROR_KERNEL_AREAS_LENGTH_TOO_LONG = 4,
KERNELMQ_PROCESS_ERROR_MODULES_TOO_MANY = 5,
};
enum KernelMQ_Process_CreatedFrom {