mprotect: return -ENOMEM if speicified range is out of range
This commit is contained in:
@ -1228,16 +1228,20 @@ SYSCALL_DECLARE(mprotect)
|
|||||||
end = start + len;
|
end = start + len;
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if ((start & (PAGE_SIZE - 1))
|
if (start & (PAGE_SIZE - 1)) {
|
||||||
|| (start < region->user_start)
|
|
||||||
|| (region->user_end <= start)
|
|
||||||
|| (len > (region->user_end - region->user_start)
|
|
||||||
|| ((region->user_end - len) < start))) {
|
|
||||||
ekprintf("[%d]sys_mprotect(%lx,%lx,%x): -EINVAL\n",
|
ekprintf("[%d]sys_mprotect(%lx,%lx,%x): -EINVAL\n",
|
||||||
ihk_mc_get_processor_id(), start, len0, prot);
|
ihk_mc_get_processor_id(), start, len0, prot);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((start < region->user_start)
|
||||||
|
|| (region->user_end <= start)
|
||||||
|
|| ((region->user_end - start) < len)) {
|
||||||
|
ekprintf("[%d]sys_mprotect(%lx,%lx,%x): -ENOMEM\n",
|
||||||
|
ihk_mc_get_processor_id(), start, len0, prot);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user