diff options
author | 2014-09-08 19:42:57 +0000 | |
---|---|---|
committer | 2014-09-08 19:42:57 +0000 | |
commit | e7d50abd4b27bd45de4b53e6f7a3bdb02b3f1af0 (patch) | |
tree | 3f6a9e66b2af53900518393e6f56c1a7982dbfd7 | |
parent | bump minor after addition of \<word\> support to regcomp; ok miod@ (diff) | |
download | wireguard-openbsd-e7d50abd4b27bd45de4b53e6f7a3bdb02b3f1af0.tar.xz wireguard-openbsd-e7d50abd4b27bd45de4b53e6f7a3bdb02b3f1af0.zip |
Don't sleep on allocation of hash table entries. Should fix crashes people
have been seeing with tmpfs. Based on a similar fix from Bitrig by
Owain Ainsworth.
ok jsg@
-rw-r--r-- | sys/uvm/uvm_aobj.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c index c658c075b91..7664520d907 100644 --- a/sys/uvm/uvm_aobj.c +++ b/sys/uvm/uvm_aobj.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_aobj.c,v 1.67 2014/07/12 18:44:01 tedu Exp $ */ +/* $OpenBSD: uvm_aobj.c,v 1.68 2014/09/08 19:42:57 kettenis Exp $ */ /* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */ /* @@ -237,7 +237,17 @@ uao_find_swhash_elt(struct uvm_aobj *aobj, int pageidx, boolean_t create) return NULL; /* allocate a new entry for the bucket and init/insert it in */ - elt = pool_get(&uao_swhash_elt_pool, PR_WAITOK | PR_ZERO); + elt = pool_get(&uao_swhash_elt_pool, PR_NOWAIT | PR_ZERO); + /* + * XXX We cannot sleep here as the hash table might disappear + * from under our feet. And we run the risk of deadlocking + * the pagedeamon. In fact this code will only be called by + * the pagedaemon and allocation will only fail if we + * exhausted the pagedeamon reserve. In that case we're + * doomed anyway, so panic. + */ + if (elt == NULL) + panic("%s: can't allocate entry", __func__); LIST_INSERT_HEAD(swhash, elt, list); elt->tag = page_tag; |