libtirpc: disallow calling auth_refresh from clnt_call with RPCSEC_GSS
Subsystems (2)
PATCH 1/1 libtirpc: disallow calling auth_refresh from clnt_call with RPCSEC_GSS
Disallow calling auth_refresh from clnt_{dg,vc}_call if the client is using RPCSEC_GSS. Doing so can recurse back into clnt_{dg,vc}_call, where we'll self-deadlock waiting on the condition variable.
--- src/auth_gss.c | 6 ++++++ src/clnt_dg.c | 8 ++++++++ src/clnt_vc.c | 9 +++++++++ tirpc/rpc/auth_gss.h | 2 ++ 4 files changed, 25 insertions(+)
src/auth_gss.c +6 -0
@@ -982,3 +982,9 @@ rpc_gss_max_data_length(AUTH *auth, int maxlen)rpc_gss_clear_error ();return result; } + +bool_t +is_authgss_client (CLIENT *clnt) +{ +return (clnt->cl_auth->ah_ops == &authgss_ops); +}
src/clnt_dg.c +8 -0
@@ -61,6 +61,9 @@#include <sys/uio.h> #endif +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif #define MAX_DEFAULT_FDS 20000
@@ -334,6 +337,11 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) salen = cu->cu_rlen; } +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + nrefreshes =0 ; +#endif +/* Clean up in case the last call ended in a longjmp(3) call. */ call_again: xdrs = &(cu->cu_outxdrs);
src/clnt_vc.c +9 -0
@@ -69,6 +69,10 @@#include "rpc_com.h" #include "clnt_fd_locks.h" +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif +#define MCALL_MSG_SIZE 24#define CMGROUP_MAX 16
@@ -363,6 +367,11 @@ clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) (xdr_results ==NULL && timeout.tv_sec ==0 && timeout.tv_usec ==0 ) ? FALSE : TRUE; +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + refreshes =0 ; +#endif + call_again: xdrs->x_op =XDR_ENCODE ; ct->ct_error.re_status =RPC_SUCCESS ;
tirpc/rpc/auth_gss.h +2 -0
@@ -120,6 +120,8 @@ void gss_log_debug (const char *fmt, ...);void gss_log_status (char *m,OM_uint32 major,OM_uint32 minor);void gss_log_hexdump (const u_char *buf,int len,int offset); +bool_t is_authgss_client (CLIENT *); + #ifdef __cplusplus }#endif
Signature · 1 line
2.25.4
Quoted 3 lines · Scott Mayhew
Disallow calling
auth_refreshfrom clnt_{dg,vc}_call if the client is usingRPCSEC_GSS. Doing so can recurse back into clnt_{dg,vc}_call, where we'll self-deadlock waiting on the condition variable.
Note this fixes the issue that some folks were having at the Virtual Bakeathon where clients were hanging when mounting some servers that didn't have krb5 configured.
-Scott
Quoted 92 lines
Signed-off-by Scott Mayhew <[email protected]>--- src/auth_gss.c | 6 ++++++ src/clnt_dg.c | 8 ++++++++ src/clnt_vc.c | 9 +++++++++ tirpc/rpc/auth_gss.h | 2 ++ 4 files changed, 25 insertions(+)src/auth_gss.c +6
-0@@ -982,3 +982,9 @@ rpc_gss_max_data_length(AUTH *auth, int maxlen)rpc_gss_clear_error ();return result; } + +bool_t +is_authgss_client (CLIENT *clnt) +{ +return (clnt->cl_auth->ah_ops == &authgss_ops); +}src/clnt_dg.c +8
-0@@ -61,6 +61,9 @@#include <sys/uio.h> #endif +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif #define MAX_DEFAULT_FDS 20000@@ -334,6 +337,11 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) salen = cu->cu_rlen; } +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + nrefreshes =0 ; +#endif +/* Clean up in case the last call ended in a longjmp(3) call. */ call_again: xdrs = &(cu->cu_outxdrs);src/clnt_vc.c +9
-0@@ -69,6 +69,10 @@#include "rpc_com.h" #include "clnt_fd_locks.h" +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif +#define MCALL_MSG_SIZE 24#define CMGROUP_MAX 16@@ -363,6 +367,11 @@ clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) (xdr_results ==NULL && timeout.tv_sec ==0 && timeout.tv_usec ==0 ) ? FALSE : TRUE; +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + refreshes =0 ; +#endif + call_again: xdrs->x_op =XDR_ENCODE ; ct->ct_error.re_status =RPC_SUCCESS ;tirpc/rpc/auth_gss.h +2
-0@@ -120,6 +120,8 @@ void gss_log_debug (const char *fmt, ...);void gss_log_status (char *m,OM_uint32 major,OM_uint32 minor);void gss_log_hexdump (const u_char *buf,int len,int offset); +bool_t is_authgss_client (CLIENT *); + #ifdef __cplusplus }#endif Signature · 1 line
2.25.4
Quoted 5 lines · Scott Mayhew
Disallow calling
auth_refreshfrom clnt_{dg,vc}_call if the client is usingRPCSEC_GSS. Doing so can recurse back into clnt_{dg,vc}_call, where we'll self-deadlock waiting on the condition variable.Signed-off-by Scott Mayhew <[email protected]>
Committed... (tag: libtirpc-1-3-2-rc1)
steved.
Quoted 88 lines
--- src/auth_gss.c | 6 ++++++ src/clnt_dg.c | 8 ++++++++ src/clnt_vc.c | 9 +++++++++ tirpc/rpc/auth_gss.h | 2 ++ 4 files changed, 25 insertions(+)src/auth_gss.c +6
-0@@ -982,3 +982,9 @@ rpc_gss_max_data_length(AUTH *auth, int maxlen)rpc_gss_clear_error ();return result; } + +bool_t +is_authgss_client (CLIENT *clnt) +{ +return (clnt->cl_auth->ah_ops == &authgss_ops); +}src/clnt_dg.c +8
-0@@ -61,6 +61,9 @@#include <sys/uio.h> #endif +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif #define MAX_DEFAULT_FDS 20000@@ -334,6 +337,11 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) salen = cu->cu_rlen; } +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + nrefreshes =0 ; +#endif +/* Clean up in case the last call ended in a longjmp(3) call. */ call_again: xdrs = &(cu->cu_outxdrs);src/clnt_vc.c +9
-0@@ -69,6 +69,10 @@#include "rpc_com.h" #include "clnt_fd_locks.h" +#ifdef HAVE_RPCSEC_GSS +#include <rpc/auth_gss.h> +#endif +#define MCALL_MSG_SIZE 24#define CMGROUP_MAX 16@@ -363,6 +367,11 @@ clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) (xdr_results ==NULL && timeout.tv_sec ==0 && timeout.tv_usec ==0 ) ? FALSE : TRUE; +#ifdef HAVE_RPCSEC_GSS +if (is_authgss_client (cl)) + refreshes =0 ; +#endif + call_again: xdrs->x_op =XDR_ENCODE ; ct->ct_error.re_status =RPC_SUCCESS ;tirpc/rpc/auth_gss.h +2
-0@@ -120,6 +120,8 @@ void gss_log_debug (const char *fmt, ...);void gss_log_status (char *m,OM_uint32 major,OM_uint32 minor);void gss_log_hexdump (const u_char *buf,int len,int offset); +bool_t is_authgss_client (CLIENT *); + #ifdef __cplusplus }#endif