Bug 187826 - [kern] /dev/mem accesses may cause page faults
Summary: [kern] /dev/mem accesses may cause page faults
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-21 18:50 UTC by Adrian Chadd
Modified: 2017-12-31 22:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Chadd freebsd_committer freebsd_triage 2014-03-21 18:50:00 UTC
From the commit to amd64 (r263475):

Fix two issues with /dev/mem access on amd64, both causing kernel page
  faults.

  First, for accesses to direct map region should check for the limit by
  which direct map is instantiated.

  Second, for accesses to the kernel map, success returned from the
  kernacc(9) does not guarantee that consequent attempt to read or write
  to the checked address succeed, since other thread might invalidate
  the address meantime.  Add a new thread private flag TDP_DEVMEMIO,
  which instructs vm_fault() to return error when fault happens on the
  MAP_ENTRY_NOFAULT entry, instead of panicing.  The trap handler would
  then see a page fault from access, and recover in normal way, making
  /dev/mem access safer.

  Remove GIANT_REQUIRED from the amd64 memrw(), since it is not needed
  and having Giant locked does not solve issues for amd64.

  Note that at least the second issue exists on other architectures, and
  requires similar patching for md code.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped