Author: jhb Date: Fri Oct 14 20:01:07 2016 New Revision: 307332 URL: https://svnweb.freebsd.org/changeset/base/307332
Log: Drop support for using mmap() with /dev/kmem. Using the device pager with /dev/kmem is not stable since KVA mappings are transient, but the device pager caches the PA associated with a given offset forever. Interestingly, mips' implementation of memmap() already refused requests for /dev/kmem. Note that kvm_read/kvm_write do not use mmap, but use read and write on /dev/kmem, so this should not affect libkvm users. Reviewed by: kib MFC after: 2 months Modified: head/sys/amd64/amd64/mem.c head/sys/arm/arm/mem.c head/sys/arm64/arm64/mem.c head/sys/i386/i386/mem.c head/sys/powerpc/powerpc/mem.c Modified: head/sys/amd64/amd64/mem.c ============================================================================== --- head/sys/amd64/amd64/mem.c Fri Oct 14 18:43:17 2016 (r307331) +++ head/sys/amd64/amd64/mem.c Fri Oct 14 20:01:07 2016 (r307332) @@ -172,10 +172,9 @@ memmmap(struct cdev *dev, vm_ooffset_t o if (offset >= (1ULL << cpu_maxphyaddr)) return (-1); *paddr = offset; - } else if (dev2unit(dev) == CDEV_MINOR_KMEM) - *paddr = vtophys(offset); - /* else panic! */ - return (0); + return (0); + } + return (-1); } /* Modified: head/sys/arm/arm/mem.c ============================================================================== --- head/sys/arm/arm/mem.c Fri Oct 14 18:43:17 2016 (r307331) +++ head/sys/arm/arm/mem.c Fri Oct 14 20:01:07 2016 (r307332) @@ -161,10 +161,9 @@ 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) { *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) - *paddr = vtophys(offset); - /* else panic! */ - return (0); + return (0); + } + return (-1); } Modified: head/sys/arm64/arm64/mem.c ============================================================================== --- head/sys/arm64/arm64/mem.c Fri Oct 14 18:43:17 2016 (r307331) +++ head/sys/arm64/arm64/mem.c Fri Oct 14 20:01:07 2016 (r307332) @@ -123,10 +123,9 @@ 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) { *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) - *paddr = vtophys(offset); - /* else panic! */ - return (0); + return (0); + } + return (-1); } Modified: head/sys/i386/i386/mem.c ============================================================================== --- head/sys/i386/i386/mem.c Fri Oct 14 18:43:17 2016 (r307331) +++ head/sys/i386/i386/mem.c Fri Oct 14 20:01:07 2016 (r307332) @@ -161,12 +161,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) { *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) - *paddr = vtophys(offset); - /* else panic! */ - return (0); + return (0); + } + return (-1); } /* Modified: head/sys/powerpc/powerpc/mem.c ============================================================================== --- head/sys/powerpc/powerpc/mem.c Fri Oct 14 18:43:17 2016 (r307331) +++ head/sys/powerpc/powerpc/mem.c Fri Oct 14 20:01:07 2016 (r307332) @@ -179,8 +179,6 @@ memmmap(struct cdev *dev, vm_ooffset_t o if (dev2unit(dev) == CDEV_MINOR_MEM) *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) - *paddr = vtophys(offset); else return (EFAULT); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"