diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2005-07-26 07:11:56 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2005-07-26 07:11:56 +0000 |
commit | 6618ef73c7e86b52a44ea09e7ad59588c97c1ea5 (patch) | |
tree | 4f61530064c2aef24dfcde424b68e121b997c3cb /sys/uvm | |
parent | 6a102c43acb2901c959adb21d0af6e5afc07a8a0 (diff) |
- Make a UVM_OBJ_IS_DEVICE macro.
- Use it to skip device mappings while dumping core.
- Ignore EFAULT errors while dumping core since they can happen
even for valid mappings. Just skip that part of the core file and
let it get automagically zero-filled.
This fixes the broken X core dumps that people have been seeing and also
fixes some other potential problems that could prevent core dumps (mmaps
beyond EOF, etc.).
tedu@ ok
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_object.h | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_pager.c | 15 | ||||
-rw-r--r-- | sys/uvm/uvm_unix.c | 15 |
3 files changed, 19 insertions, 17 deletions
diff --git a/sys/uvm/uvm_object.h b/sys/uvm/uvm_object.h index b1b1daa9490..7dda1ae55a0 100644 --- a/sys/uvm/uvm_object.h +++ b/sys/uvm/uvm_object.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_object.h,v 1.8 2001/12/19 08:58:07 art Exp $ */ +/* $OpenBSD: uvm_object.h,v 1.9 2005/07/26 07:11:55 art Exp $ */ /* $NetBSD: uvm_object.h,v 1.11 2001/03/09 01:02:12 chs Exp $ */ /* @@ -86,10 +86,14 @@ struct uvm_object { #ifdef _KERNEL extern struct uvm_pagerops uvm_vnodeops; +extern struct uvm_pagerops uvm_deviceops; #define UVM_OBJ_IS_VNODE(uobj) \ ((uobj)->pgops == &uvm_vnodeops) +#define UVM_OBJ_IS_DEVICE(uobj) \ + ((uobj)->pgops == &uvm_deviceops) + #define UVM_OBJ_IS_VTEXT(uobj) \ ((uobj)->pgops == &uvm_vnodeops && \ ((struct vnode *)uobj)->v_flag & VTEXT) diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c index c415e211d64..04fbfcb6801 100644 --- a/sys/uvm/uvm_pager.c +++ b/sys/uvm/uvm_pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pager.c,v 1.36 2005/05/24 21:11:47 tedu Exp $ */ +/* $OpenBSD: uvm_pager.c,v 1.37 2005/07/26 07:11:55 art Exp $ */ /* $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $ */ /* @@ -52,23 +52,10 @@ struct pool *uvm_aiobuf_pool; -/* - * list of uvm pagers in the system - */ - -extern struct uvm_pagerops uvm_deviceops; -extern struct uvm_pagerops uvm_vnodeops; -#ifdef UBC -extern struct uvm_pagerops ubc_pager; -#endif - struct uvm_pagerops *uvmpagerops[] = { &aobj_pager, &uvm_deviceops, &uvm_vnodeops, -#ifdef UBC - &ubc_pager, -#endif }; /* diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index e53a882b597..21ef2c69449 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.26 2003/03/04 18:24:05 mickey Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.27 2005/07/26 07:11:55 art Exp $ */ /* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* @@ -206,6 +206,13 @@ uvm_coredump(p, vp, cred, chdr) if (!(entry->protection & VM_PROT_WRITE)) continue; + /* + * Don't dump mmaped devices. + */ + if (entry->object.uvm_obj != NULL && + UVM_OBJ_IS_DEVICE(entry->object.uvm_obj)) + continue; + start = entry->start; end = entry->end; @@ -243,7 +250,11 @@ uvm_coredump(p, vp, cred, chdr) (caddr_t)&cseg, chdr->c_seghdrsize, offset, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p); - if (error) + /* + * We might get an EFAULT on objects mapped beyond + * EOF. Ignore the error. + */ + if (error && error != EFAULT) break; offset += chdr->c_seghdrsize; |