* [PATCH 1/1] gssd: protect kerberos ticket cache access
@ 2025-10-27 15:38 Olga Kornievskaia
2025-11-19 18:22 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Olga Kornievskaia @ 2025-10-27 15:38 UTC (permalink / raw)
To: steved; +Cc: linux-nfs
gssd_get_single_krb5_cred() is a function that's will (for when needed)
send a TGT request to the KDC and then store it in a credential cache.
If multiple threads (eg., parallel mounts) are making an upcall at the
same time then getting creds and storing creds need to be serialized due
to do kerberos API not being concurrency safe.
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
---
utils/gssd/krb5_util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 09625fb9..137cffda 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -456,12 +456,14 @@ gssd_get_single_krb5_cred(krb5_context context,
krb5_get_init_creds_opt_set_tkt_life(opts, 5*60);
#endif
+ pthread_mutex_lock(&ple_lock);
if ((code = krb5_get_init_creds_opt_set_out_ccache(context, opts,
ccache))) {
k5err = gssd_k5_err_msg(context, code);
printerr(1, "WARNING: %s while initializing ccache for "
"principal '%s' using keytab '%s'\n", k5err,
pname ? pname : "<unparsable>", kt_name);
+ pthread_mutex_unlock(&ple_lock);
goto out;
}
if ((code = krb5_get_init_creds_keytab(context, &my_creds, ple->princ,
@@ -470,10 +472,10 @@ gssd_get_single_krb5_cred(krb5_context context,
printerr(1, "WARNING: %s while getting initial ticket for "
"principal '%s' using keytab '%s'\n", k5err,
pname ? pname : "<unparsable>", kt_name);
+ pthread_mutex_unlock(&ple_lock);
goto out;
}
- pthread_mutex_lock(&ple_lock);
ple->endtime = my_creds.times.endtime;
pthread_mutex_unlock(&ple_lock);
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] gssd: protect kerberos ticket cache access
2025-10-27 15:38 [PATCH 1/1] gssd: protect kerberos ticket cache access Olga Kornievskaia
@ 2025-11-19 18:22 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2025-11-19 18:22 UTC (permalink / raw)
To: Olga Kornievskaia; +Cc: linux-nfs
On 10/27/25 11:38 AM, Olga Kornievskaia wrote:
> gssd_get_single_krb5_cred() is a function that's will (for when needed)
> send a TGT request to the KDC and then store it in a credential cache.
> If multiple threads (eg., parallel mounts) are making an upcall at the
> same time then getting creds and storing creds need to be serialized due
> to do kerberos API not being concurrency safe.
>
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Committed... (tag: nfs-utils-2-8-5-rc1)
steved.> ---
> utils/gssd/krb5_util.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index 09625fb9..137cffda 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -456,12 +456,14 @@ gssd_get_single_krb5_cred(krb5_context context,
> krb5_get_init_creds_opt_set_tkt_life(opts, 5*60);
> #endif
>
> + pthread_mutex_lock(&ple_lock);
> if ((code = krb5_get_init_creds_opt_set_out_ccache(context, opts,
> ccache))) {
> k5err = gssd_k5_err_msg(context, code);
> printerr(1, "WARNING: %s while initializing ccache for "
> "principal '%s' using keytab '%s'\n", k5err,
> pname ? pname : "<unparsable>", kt_name);
> + pthread_mutex_unlock(&ple_lock);
> goto out;
> }
> if ((code = krb5_get_init_creds_keytab(context, &my_creds, ple->princ,
> @@ -470,10 +472,10 @@ gssd_get_single_krb5_cred(krb5_context context,
> printerr(1, "WARNING: %s while getting initial ticket for "
> "principal '%s' using keytab '%s'\n", k5err,
> pname ? pname : "<unparsable>", kt_name);
> + pthread_mutex_unlock(&ple_lock);
> goto out;
> }
>
> - pthread_mutex_lock(&ple_lock);
> ple->endtime = my_creds.times.endtime;
> pthread_mutex_unlock(&ple_lock);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-19 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-27 15:38 [PATCH 1/1] gssd: protect kerberos ticket cache access Olga Kornievskaia
2025-11-19 18:22 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox