Andreas Schwab
ba646d627b
- nscd-gc-crash.patch: Fix nscd assertion failure in gc (bsc#965699, BZ #19755) OBS-URL: https://build.opensuse.org/request/show/401556 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=440
74 lines
2.3 KiB
Diff
74 lines
2.3 KiB
Diff
[BZ #19755]
|
|
* nscd/pwdcache.c (cache_addpw): Lock prune_run_lock while adding
|
|
new entries in auto-propagate mode.
|
|
* nscd/grpcache.c (cache_addgr): Likewise.
|
|
|
|
Index: glibc-2.23/nscd/grpcache.c
|
|
===================================================================
|
|
--- glibc-2.23.orig/nscd/grpcache.c
|
|
+++ glibc-2.23/nscd/grpcache.c
|
|
@@ -205,10 +205,19 @@ cache_addgr (struct database_dyn *db, in
|
|
dataset = NULL;
|
|
|
|
if (he == NULL)
|
|
- dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
|
+ {
|
|
+ /* Prevent an INVALIDATE request from pruning the data between
|
|
+ the two calls to cache_add. */
|
|
+ if (db->propagate)
|
|
+ pthread_mutex_lock (&db->prune_run_lock);
|
|
+ dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
|
+ }
|
|
|
|
if (dataset == NULL)
|
|
{
|
|
+ if (he == NULL && db->propagate)
|
|
+ pthread_mutex_unlock (&db->prune_run_lock);
|
|
+
|
|
/* We cannot permanently add the result in the moment. But
|
|
we can provide the result as is. Store the data in some
|
|
temporary memory. */
|
|
@@ -396,6 +405,8 @@ cache_addgr (struct database_dyn *db, in
|
|
|
|
out:
|
|
pthread_rwlock_unlock (&db->lock);
|
|
+ if (he == NULL && db->propagate)
|
|
+ pthread_mutex_unlock (&db->prune_run_lock);
|
|
}
|
|
}
|
|
|
|
Index: glibc-2.23/nscd/pwdcache.c
|
|
===================================================================
|
|
--- glibc-2.23.orig/nscd/pwdcache.c
|
|
+++ glibc-2.23/nscd/pwdcache.c
|
|
@@ -198,10 +198,19 @@ cache_addpw (struct database_dyn *db, in
|
|
dataset = NULL;
|
|
|
|
if (he == NULL)
|
|
- dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
|
+ {
|
|
+ /* Prevent an INVALIDATE request from pruning the data between
|
|
+ the two calls to cache_add. */
|
|
+ if (db->propagate)
|
|
+ pthread_mutex_lock (&db->prune_run_lock);
|
|
+ dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
|
+ }
|
|
|
|
if (dataset == NULL)
|
|
{
|
|
+ if (he == NULL && db->propagate)
|
|
+ pthread_mutex_unlock (&db->prune_run_lock);
|
|
+
|
|
/* We cannot permanently add the result in the moment. But
|
|
we can provide the result as is. Store the data in some
|
|
temporary memory. */
|
|
@@ -374,6 +383,8 @@ cache_addpw (struct database_dyn *db, in
|
|
|
|
out:
|
|
pthread_rwlock_unlock (&db->lock);
|
|
+ if (he == NULL && db->propagate)
|
|
+ pthread_mutex_unlock (&db->prune_run_lock);
|
|
}
|
|
}
|
|
|