Check for page being resident when doing I/O with /dev/kmem and return
EFAULT if it is not resident. This prevents the system from manufacturing a zero-fill page for unused but allocated areas of the kernel's VM. This should fix the "CMAP busy" panic that some people saw during system startup.
This commit is contained in:
parent
6bd660b66b
commit
97e112628f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10812
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
||||
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: mem.c,v 1.11 1995/09/08 11:07:08 bde Exp $
|
||||
* $Id: mem.c,v 1.12 1995/09/09 18:09:46 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -163,13 +163,26 @@ mmrw(dev, uio, flags)
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
case 1: {
|
||||
vm_offset_t addr, eaddr;
|
||||
c = iov->iov_len;
|
||||
|
||||
/*
|
||||
* Make sure that all of the pages are currently resident so
|
||||
* that we don't create any zero-fill pages.
|
||||
*/
|
||||
addr = trunc_page(uio->uio_offset);
|
||||
eaddr = round_page(addr + c);
|
||||
for (; addr < eaddr; addr += PAGE_SIZE)
|
||||
if (pmap_extract(kernel_pmap, addr) == 0)
|
||||
return EFAULT;
|
||||
|
||||
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return(EFAULT);
|
||||
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* minor device 2 is EOF/RATHOLE */
|
||||
case 2:
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
||||
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: mem.c,v 1.11 1995/09/08 11:07:08 bde Exp $
|
||||
* $Id: mem.c,v 1.12 1995/09/09 18:09:46 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -163,13 +163,26 @@ mmrw(dev, uio, flags)
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
case 1: {
|
||||
vm_offset_t addr, eaddr;
|
||||
c = iov->iov_len;
|
||||
|
||||
/*
|
||||
* Make sure that all of the pages are currently resident so
|
||||
* that we don't create any zero-fill pages.
|
||||
*/
|
||||
addr = trunc_page(uio->uio_offset);
|
||||
eaddr = round_page(addr + c);
|
||||
for (; addr < eaddr; addr += PAGE_SIZE)
|
||||
if (pmap_extract(kernel_pmap, addr) == 0)
|
||||
return EFAULT;
|
||||
|
||||
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return(EFAULT);
|
||||
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* minor device 2 is EOF/RATHOLE */
|
||||
case 2:
|
||||
|
Loading…
Reference in New Issue
Block a user