[31471] in CVS-changelog-for-Kerberos-V5
krb5 commit: Fix profile_open_file() last_stat locking
daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Fri Sep 19 11:57:20 2025
From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20250919155713.B795E104104@krbdev.mit.edu>
Date: Fri, 19 Sep 2025 11:57:13 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/3466589de7de7e74aa53c560b83313ae7d2f8b6f
commit 3466589de7de7e74aa53c560b83313ae7d2f8b6f
Author: Alexey Milovidov <milovidov@clickhouse.com>
Date: Mon Apr 10 04:19:01 2023 +0200
Fix profile_open_file() last_stat locking
Commit 53d6d0d64e96b84b57b7446a787e683312e2a529 changed
profile_open_file() to force a stat() when reusing a profile object,
by setting the last_stat field to 0 on the data object. The last_stat
field is controlled by the data object mutex (unlike the refcount
field, which is controlled by g_shared_trees_mutex). Lock the data
object before setting last_stat.
[ghudson@mit.edu: switched to using profile_update_data_file_locked()
so we don't lock and unlock the data object twice; rewrote commit
message]
ticket: 9184 (new)
src/util/profile/prof_file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index 8b0b2bb44..4ff1538fd 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -220,9 +220,11 @@ errcode_t profile_open_file(const_profile_filespec_t filespec,
}
if (data) {
data->refcount++;
- data->last_stat = 0; /* Make sure to stat when updating. */
k5_mutex_unlock(&g_shared_trees_mutex);
- retval = profile_update_file_data(data, NULL);
+ k5_mutex_lock(&data->lock);
+ data->last_stat = 0; /* Make sure to stat when updating. */
+ retval = profile_update_file_data_locked(data, NULL);
+ k5_mutex_unlock(&data->lock);
free(expanded_filename);
if (retval) {
profile_dereference_data(data);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5