mirror of
https://github.com/tailix/kernel.git
synced 2024-12-04 11:34:42 -05:00
Validate process area
This commit is contained in:
parent
1138bfcb06
commit
32ea70c6c4
2 changed files with 11 additions and 2 deletions
|
@ -71,6 +71,10 @@ enum KernelMQ_Process_Error KernelMQ_Process_create_from_kernel(
|
||||||
return KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG;
|
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].base = base;
|
||||||
process->areas[area_index].size = size;
|
process->areas[area_index].size = size;
|
||||||
process->areas[area_index].limit = limit;
|
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;
|
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].base = base;
|
||||||
process->areas[0].size = size;
|
process->areas[0].size = size;
|
||||||
process->areas[0].limit = limit;
|
process->areas[0].limit = limit;
|
||||||
|
|
|
@ -18,8 +18,9 @@ enum KernelMQ_Process_Error {
|
||||||
KERNELMQ_PROCESS_ERROR_OK = 0,
|
KERNELMQ_PROCESS_ERROR_OK = 0,
|
||||||
KERNELMQ_PROCESS_ERROR_CMDLINE_TOO_LONG = 1,
|
KERNELMQ_PROCESS_ERROR_CMDLINE_TOO_LONG = 1,
|
||||||
KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG = 2,
|
KERNELMQ_PROCESS_ERROR_ADDR_TOO_BIG = 2,
|
||||||
KERNELMQ_PROCESS_ERROR_KERNEL_AREAS_LENGTH_TOO_LONG = 3,
|
KERNELMQ_PROCESS_ERROR_INVALID_AREA = 3,
|
||||||
KERNELMQ_PROCESS_ERROR_MODULES_TOO_MANY = 4,
|
KERNELMQ_PROCESS_ERROR_KERNEL_AREAS_LENGTH_TOO_LONG = 4,
|
||||||
|
KERNELMQ_PROCESS_ERROR_MODULES_TOO_MANY = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KernelMQ_Process_CreatedFrom {
|
enum KernelMQ_Process_CreatedFrom {
|
||||||
|
|
Loading…
Reference in a new issue