Page MenuHomeFreeBSD

Drop support for using mmap() with /dev/kmem.
ClosedPublic

Authored by jhb on Oct 14 2016, 5:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 23, 8:05 AM
Unknown Object (File)
Dec 19 2024, 2:31 PM
Unknown Object (File)
Dec 10 2024, 5:38 PM
Unknown Object (File)
Dec 10 2024, 5:36 PM
Unknown Object (File)
Sep 24 2024, 4:55 PM
Unknown Object (File)
Sep 24 2024, 3:17 AM
Unknown Object (File)
Sep 21 2024, 4:34 PM
Unknown Object (File)
Sep 20 2024, 12:50 PM
Subscribers

Details

Reviewers
kib
jhibbits
Summary

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.

Test Plan
  • wrote a little test program that used kvm_read and mmap to read osreldate. kvm_read still works after this change (and before it osreldate was the same via both means, but osreldate is in a "stable" page). mmap of /dev/kmem fails after this change (tested on amd64)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5603
Build 5867: arc lint + arc unit

Event Timeline

jhb retitled this revision from to Drop support for using mmap() with /dev/kmem..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: kib.
kib edited edge metadata.
kib added inline comments.
sys/amd64/amd64/mem.c
177

You can reduce excessive indent by doing

{
  if (dev2unit(dev) != CDEV_MINOR_MEM || offset >= (1ULL << cpu_maxphyaddr))
    return (-1);
  *paddr = offset;
  return (0);
}
This revision is now accepted and ready to land.Oct 14 2016, 12:09 PM
sys/amd64/amd64/mem.c
177

I have another pending change to this code (fixing the maxphyaddr on i386) so I'll leave this alone for now but perhaps fix it up there.

Forgot to refer to differential in commit, but this was committed in rS307332