svn commit: r303753 - head/sys/amd64/amd64
John Baldwin
jhb at FreeBSD.org
Thu Aug 4 17:55:24 UTC 2016
Author: jhb
Date: Thu Aug 4 17:55:23 2016
New Revision: 303753
URL: https://svnweb.freebsd.org/changeset/base/303753
Log:
Don't permit mappings of invalid physical addresses on amd64 via /dev/mem.
Discussed with: kib
Modified:
head/sys/amd64/amd64/mem.c
Modified: head/sys/amd64/amd64/mem.c
==============================================================================
--- head/sys/amd64/amd64/mem.c Thu Aug 4 17:46:07 2016 (r303752)
+++ head/sys/amd64/amd64/mem.c Thu Aug 4 17:55:23 2016 (r303753)
@@ -168,9 +168,11 @@ int
memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
int prot __unused, vm_memattr_t *memattr __unused)
{
- if (dev2unit(dev) == CDEV_MINOR_MEM)
+ if (dev2unit(dev) == CDEV_MINOR_MEM) {
+ if (offset >= (1ULL << cpu_maxphyaddr))
+ return (-1);
*paddr = offset;
- else if (dev2unit(dev) == CDEV_MINOR_KMEM)
+ } else if (dev2unit(dev) == CDEV_MINOR_KMEM)
*paddr = vtophys(offset);
/* else panic! */
return (0);
More information about the svn-src-all
mailing list