mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 01:38:57 +00:00
Guard against address wrap in kernacc(). Otherwise, a program accessing a
bad address range through /dev/kmem can panic the machine. Submitted by: Mark W. Krentel Reported by: Kris Kennaway MFC after: 1 week
This commit is contained in:
parent
14cedfc842
commit
75337a5677
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140622
@ -133,6 +133,11 @@ kernacc(addr, len, rw)
|
||||
|
||||
KASSERT((rw & ~VM_PROT_ALL) == 0,
|
||||
("illegal ``rw'' argument to kernacc (%x)\n", rw));
|
||||
|
||||
if ((vm_offset_t)addr + len > kernel_map->max_offset ||
|
||||
(vm_offset_t)addr + len < (vm_offset_t)addr)
|
||||
return (FALSE);
|
||||
|
||||
prot = rw;
|
||||
saddr = trunc_page((vm_offset_t)addr);
|
||||
eaddr = round_page((vm_offset_t)addr + len);
|
||||
|
Loading…
Reference in New Issue
Block a user