(v4) gss-proxy upcall for nfsd
Subsystems (4)
cover (v4) gss-proxy upcall for nfsd
From: "J. Bruce Fields" <[email protected]>
Changes since my last posting:
- disable idle timeout by passing down rpc create flags to xprt create and defining a new RPC_CLNT_CREATE_NO_IDLE_TIMEOUT flag instead of hardwiring timeout to 0 in the AF_LOCAL case. (Chuck's suggestion.)
- Reduce stack usage in gssp_rpc_create by removing some unused structure fields from the xdr code. I plan to do more, but at this point that function is down to about 500 bytes of stack, which probably makes it not an immediately problem. (Thanks to Trond for pointing out the problem.)
- Use C99 initializers to clean up gssp_rpc_create (Trond's suggestion.)
Series description, as before:
The following patches add support for rpc servers to use gss-proxy instead of the existing cache-based method to accept new rpcsec_gss contexts.
The existing cache-based upcall has some increasingly annoying limitations that would be difficult to fix without incompatible changes, and gss-proxy looks like a reasonable replacement.
J. Bruce Fields (2):
SUNRPC: attempt AF_LOCAL connect on setup
SUNRPC: allow disabling idle timeout
Simo Sorce (3):
SUNRPC: conditionally return endtime from import_sec_context
SUNRPC: Add RPC based upcall mechanism for RPCGSS auth
SUNRPC: Use gssproxy upcall for server RPCGSS authentication.
Documentation/filesystems/nfs/00-INDEX | 2 + Documentation/filesystems/nfs/rpc-server-gss.txt | 91 +++ include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/gss_api.h | 2 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/auth_gss/Makefile | 3 +- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 7 +- net/sunrpc/auth_gss/gss_mech_switch.c | 5 +- net/sunrpc/auth_gss/gss_rpc_upcall.c | 357 ++++++++++ net/sunrpc/auth_gss/gss_rpc_upcall.h | 47 ++ net/sunrpc/auth_gss/gss_rpc_xdr.c | 832 ++++++++++++++++++++++ net/sunrpc/auth_gss/gss_rpc_xdr.h | 264 +++++++ net/sunrpc/auth_gss/svcauth_gss.c | 350 ++++++++- net/sunrpc/clnt.c | 2 + net/sunrpc/netns.h | 6 + net/sunrpc/xprt.c | 2 + net/sunrpc/xprtsock.c | 3 + 18 files changed, 1961 insertions(+), 16 deletions(-) create mode 100644 Documentation/filesystems/nfs/rpc-server-gss.txt create mode 100644 net/sunrpc/auth_gss/gss_rpc_upcall.c create mode 100644 net/sunrpc/auth_gss/gss_rpc_upcall.h create mode 100644 net/sunrpc/auth_gss/gss_rpc_xdr.c create mode 100644 net/sunrpc/auth_gss/gss_rpc_xdr.h
Signature · 1 line
1.7.9.5
PATCH 1/5 SUNRPC: attempt AF_LOCAL connect on setup
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case, setup time is when I know I'll have the right namespace for the connect.
In other cases, it might be useful to get any connection errors earlier--though actually in practice it doesn't make any difference for rpcbind.
--- net/sunrpc/xprtsock.c | 3 +++ 1 file changed, 3 insertions(+)
net/sunrpc/xprtsock.c +3 -0
@@ -2655,6 +2655,9 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args) }xprt_set_bound (xprt);xs_format_peer_addresses (xprt,"local" ,RPCBIND_NETID_LOCAL ); + ret =ERR_PTR (xs_local_setup_socket (transport)); +if (ret) + goto out_err;break ;default : ret =ERR_PTR (-EAFNOSUPPORT );
Signature · 1 line
1.7.9.5
PATCH 2/5 SUNRPC: allow disabling idle timeout
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
So, provide a flag that allows the rpc_create caller to turn off the idle timeout.
--- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/clnt.c | 1 + net/sunrpc/xprt.c | 2 ++ 4 files changed, 5 insertions(+)
include/linux/sunrpc/clnt.h +1 -0
@@ -124,6 +124,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_NOPING (1UL << 4)#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 7)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
include/linux/sunrpc/xprt.h +1 -0
@@ -263,6 +263,7 @@ struct xprt_create {size_t addrlen;const char *servername;struct svc_xprt *bc_xprt;/* NFSv4.1 backchannel */ +unsigned long flags; };struct xprt_class {
net/sunrpc/clnt.c +1 -0
@@ -411,6 +411,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .addrlen = args->addrsize, .servername = args->servername, .bc_xprt = args->bc_xprt, + .flags = args->flags, };char servername[48 ];
net/sunrpc/xprt.c +2 -0
@@ -1245,6 +1245,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,
Signature · 1 line
1.7.9.5
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 8 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.
Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the rpc_create flags down to the xprt_create, I don't know if that's reasonable.
--b.
Quoted 65 lines
Signed-off-by J. Bruce Fields <[email protected]>--- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/clnt.c | 1 + net/sunrpc/xprt.c | 2 ++ 4 files changed, 5 insertions(+)include/linux/sunrpc/clnt.h +1
-0@@ -124,6 +124,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_NOPING (1UL << 4)#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 7)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,include/linux/sunrpc/xprt.h +1
-0@@ -263,6 +263,7 @@ struct xprt_create {size_t addrlen;const char *servername;struct svc_xprt *bc_xprt;/* NFSv4.1 backchannel */ +unsigned long flags; };struct xprt_class {net/sunrpc/clnt.c +1
-0@@ -411,6 +411,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .addrlen = args->addrsize, .servername = args->servername, .bc_xprt = args->bc_xprt, + .flags = args->flags, };char servername[48 ];net/sunrpc/xprt.c +2
-0@@ -1245,6 +1245,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
Quoted 6 lines
Quoted 2 lines
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.
This patch will conflict with commit b7993cebb841b0da7a33e9d5ce301a9fd3209165 (SUNRPC: Allow rpc_create() to request that TCP slots be unlimited) that was posted on this list earlier this week.
Quoted 71 lines
--b.
Quoted 65 lines
Signed-off-by J. Bruce Fields <[email protected]>--- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/clnt.c | 1 + net/sunrpc/xprt.c | 2 ++ 4 files changed, 5 insertions(+)include/linux/sunrpc/clnt.h +1
-0@@ -124,6 +124,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_NOPING (1UL << 4)#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 7)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,include/linux/sunrpc/xprt.h +1
-0@@ -263,6 +263,7 @@ struct xprt_create {size_t addrlen;const char *servername;struct svc_xprt *bc_xprt;/* NFSv4.1 backchannel */ +unsigned long flags; };struct xprt_class {net/sunrpc/clnt.c +1
-0@@ -411,6 +411,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .addrlen = args->addrsize, .servername = args->servername, .bc_xprt = args->bc_xprt, + .flags = args->flags, };char servername[48 ];net/sunrpc/xprt.c +2
-0@@ -1245,6 +1245,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 11 lines · Trond
Quoted 10 lines · J. Bruce Fields
Quoted 8 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.
Quoted 8 lines
Quoted 3 lines
Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.This patch will conflict with commit
b7993cebb841b0da7a33e9d5ce301a9fd3209165(SUNRPC: Allowrpc_create()to request that TCP slots be unlimited) that was posted on this list earlier this week.
Oh, sorry, I missed that.
Presumably then I should just work on top of that and do the same thing--define a pair of flags {RP_CLNT_CREATE|XPRT_CREATE}_NO_IDLE_TIMEOUT and translate between the two in rpc_create.
--b.
Quoted 81 lines
Quoted 72 lines
--b.
Quoted 65 lines
Signed-off-by J. Bruce Fields <[email protected]>--- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/clnt.c | 1 + net/sunrpc/xprt.c | 2 ++ 4 files changed, 5 insertions(+)include/linux/sunrpc/clnt.h +1
-0@@ -124,6 +124,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_NOPING (1UL << 4)#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 7)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,include/linux/sunrpc/xprt.h +1
-0@@ -263,6 +263,7 @@ struct xprt_create {size_t addrlen;const char *servername;struct svc_xprt *bc_xprt;/* NFSv4.1 backchannel */ +unsigned long flags; };struct xprt_class {net/sunrpc/clnt.c +1
-0@@ -411,6 +411,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .addrlen = args->addrsize, .servername = args->servername, .bc_xprt = args->bc_xprt, + .flags = args->flags, };char servername[48 ];net/sunrpc/xprt.c +2
-0@@ -1245,6 +1245,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 21 lines · J. Bruce Fields
Quoted 11 lines · Trond
Quoted 10 lines · J. Bruce Fields
Quoted 8 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.Quoted 8 lines
Quoted 3 lines
Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.This patch will conflict with commit
b7993cebb841b0da7a33e9d5ce301a9fd3209165(SUNRPC: Allowrpc_create()to request that TCP slots be unlimited) that was posted on this list earlier this week.
Quoted 6 lines
Oh, sorry, I missed that.
Presumably then I should just work on top of that and do the same thing--define a pair of flags {RP_CLNT_CREATE|XPRT_CREATE}_NO_IDLE_TIMEOUT and translate between the two in
rpc_create.
Agree.
Quoted 81 lines
--b.
Quoted 78 lines
Quoted 72 lines
--b.
Quoted 65 lines
Signed-off-by J. Bruce Fields <[email protected]>---
include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/xprt.h | 1 + net/sunrpc/clnt.c | 1 + net/sunrpc/xprt.c | 2 ++ 4 files changed, 5 insertions(+)include/linux/sunrpc/clnt.h +1
-0@@ -124,6 +124,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_NOPING (1UL << 4)#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 7)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,include/linux/sunrpc/xprt.h +1
-0@@ -263,6 +263,7 @@ struct xprt_create {size_t addrlen;const char *servername;struct svc_xprt *bc_xprt;/* NFSv4.1 backchannel */ +unsigned long flags; };struct xprt_class {net/sunrpc/clnt.c +1
-0@@ -411,6 +411,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .addrlen = args->addrsize, .servername = args->servername, .bc_xprt = args->bc_xprt, + .flags = args->flags, };char servername[48 ];net/sunrpc/xprt.c +2
-0@@ -1245,6 +1245,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Trond Myklebust Linux NFS client maintainer
Quoted 7 lines
Quoted 3 lines
NetApp
[email protected]
www.netapp.com--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 24 lines · Chuck Lever
Quoted 21 lines · J. Bruce Fields
Quoted 19 lines · Trond
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
Quoted 6 lines
Quoted 2 lines
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.This patch will conflict with commit
b7993cebb841b0da7a33e9d5ce301a9fd3209165(SUNRPC: Allowrpc_create()to request that TCP slots be unlimited) that was posted on this list earlier this week.
Quoted 8 lines
Quoted 6 lines
Oh, sorry, I missed that.
Presumably then I should just work on top of that and do the same thing--define a pair of flags {RP_CLNT_CREATE|XPRT_CREATE}_NO_IDLE_TIMEOUT and translate between the two in
rpc_create.Agree.
The result (untested) looks like this.
If this is OK--Trond, do you mind if I merge this commit (or nfs-for-next) into my tree, and then the rest of the gss-proxy patches on top?
Or is the nfs-for-next branch still potentially subject to rewriting?
--b.
commit 17728da224288679811a9b305ae1211c3c7a6e7e
Author: J. Bruce Fields <[email protected]> Date: Thu Apr 11 15:06:36 2013 -0400
SUNRPC: allow disabling idle timeout
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
So, provide a flag that allows the rpc_create caller to turn off the idle timeout.
include/linux/sunrpc/clnt.h +1 -0
@@ -125,6 +125,7 @@ struct rpc_create_args {#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)#define RPC_CLNT_CREATE_QUIET (1UL << 6)#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) +#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)struct rpc_clnt *rpc_create (struct rpc_create_args *args); struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
include/linux/sunrpc/xprt.h +1 -0
@@ -256,6 +256,7 @@ static inline int bc_prealloc(struct rpc_rqst *req)#endif /* CONFIG_SUNRPC_BACKCHANNEL */ #define XPRT_CREATE_INFINITE_SLOTS (1U) +#define XPRT_CREATE_NO_IDLE_TIMEOUT (1U << 1)struct xprt_create {int ident;/* XPRT_TRANSPORT identifier */
net/sunrpc/clnt.c +2 -0
@@ -416,6 +416,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)if (args->flags &RPC_CLNT_CREATE_INFINITE_SLOTS ) xprtargs.flags |=XPRT_CREATE_INFINITE_SLOTS ; +if (args->flags &RPC_CLNT_CREATE_NO_IDLE_TIMEOUT ) + xprtargs.flags |=XPRT_CREATE_NO_IDLE_TIMEOUT ;/* * If the caller chooses not to specify a hostname, whip * up a string representation of the passed-in address.
net/sunrpc/xprt.c +2 -0
@@ -1300,6 +1300,8 @@ found: -PTR_ERR(xprt)); goto out; } +if (args->flags &XPRT_CREATE_NO_IDLE_TIMEOUT ) + xprt->idle_timeout =0 ;INIT_WORK (&xprt->task_cleanup, xprt_autoclose);if (xprt_has_timer (xprt)) setup_timer(&xprt->timer, xprt_init_autodisconnect,
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 34 lines · J. Bruce Fields
Quoted 24 lines · Chuck Lever
Quoted 21 lines · J. Bruce Fields
Quoted 19 lines · Trond
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
Quoted 6 lines
Quoted 2 lines
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.This patch will conflict with commit
b7993cebb841b0da7a33e9d5ce301a9fd3209165(SUNRPC: Allowrpc_create()to request that TCP slots be unlimited) that was posted on this list earlier this week.Quoted 8 lines
Quoted 6 lines
Oh, sorry, I missed that.
Presumably then I should just work on top of that and do the same thing--define a pair of flags {RP_CLNT_CREATE|XPRT_CREATE}_NO_IDLE_TIMEOUT and translate between the two in
rpc_create.Agree.
Quoted 7 lines
The result (untested) looks like this.
If this is OK--Trond, do you mind if I merge this commit (or nfs-for-next) into my tree, and then the rest of the gss-proxy patches on top?
Or is the nfs-for-next branch still potentially subject to rewriting?
nfs-for-next is stable, so it should be safe to pull into your nfsd tree.
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH 2/5] SUNRPC: allow disabling idle timeout
Quoted 37 lines · Trond
Quoted 36 lines · J. Bruce Fields
Quoted 24 lines · Chuck Lever
Quoted 21 lines · J. Bruce Fields
Quoted 19 lines · Trond
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
In the gss-proxy case we don't want to have to reconnect at random--we want to connect only on gss-proxy startup when we can steal gss-proxy's context to do the connect in the right namespace.
Quoted 6 lines
Quoted 2 lines
So, provide a flag that allows the
rpc_createcaller to turn off the idle timeout.Chuck, the basic ideas was your suggestion, does the executation look OK here? I had to copy the
rpc_createflags down to thexprt_create, I don't know if that's reasonable.This patch will conflict with commit
b7993cebb841b0da7a33e9d5ce301a9fd3209165(SUNRPC: Allowrpc_create()to request that TCP slots be unlimited) that was posted on this list earlier this week.Quoted 8 lines
Quoted 6 lines
Oh, sorry, I missed that.
Presumably then I should just work on top of that and do the same thing--define a pair of flags {RP_CLNT_CREATE|XPRT_CREATE}_NO_IDLE_TIMEOUT and translate between the two in
rpc_create.Agree.
The result (untested) looks like this.
Quoted 8 lines
Quoted 5 lines
If this is OK--Trond, do you mind if I merge this commit (or nfs-for-next) into my tree, and then the rest of the gss-proxy patches on top?
Or is the nfs-for-next branch still potentially subject to rewriting?
nfs-for-next is stable, so it should be safe to pull into your nfsd tree.
OK, done locally, pushing out that and the gss-proxy work soon pending some testing.
This just means I'll want to wait till after your branch is pulled for the next merge window before sending my pull-request, to avoid creating confusion about who did what.
Therefore, please delay your request as long as you like, as that will give me an excuse for my own procrastination. Thanks!
--b.
PATCH 3/5 SUNRPC: conditionally return endtime from import_sec_context
In reply to J. Bruce FieldsFrom: Simo Sorce <[email protected]>
We expose this parameter for a future caller.
It will be used to extract the endtime from the gss-proxy upcall mechanism, in order to set the rsc cache expiration time.
--- include/linux/sunrpc/gss_api.h | 2 ++ net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 7 +++++-- net/sunrpc/auth_gss/gss_mech_switch.c | 5 +++-- net/sunrpc/auth_gss/svcauth_gss.c | 3 ++- 5 files changed, 13 insertions(+), 6 deletions(-)
include/linux/sunrpc/gss_api.h +2 -0
@@ -37,6 +37,7 @@ int gss_import_sec_context(size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, + time_t *endtime, gfp_t gfp_mask); u32 gss_get_mic( struct gss_ctx *ctx_id,
@@ -92,6 +93,7 @@ struct gss_api_ops {const void *input_token, size_t bufsize, struct gss_ctx *ctx_id, + time_t *endtime, gfp_t gfp_mask); u32 (*gss_get_mic)( struct gss_ctx *ctx_id,
net/sunrpc/auth_gss/auth_gss.c +1 -1
@@ -238,7 +238,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct p =ERR_PTR (-EFAULT ); goto err; } - ret =gss_import_sec_context (p, seclen, gm, &ctx->gc_gss_ctx,GFP_NOFS ); + ret =gss_import_sec_context (p, seclen, gm, &ctx->gc_gss_ctx,NULL ,GFP_NOFS );if (ret <0 ) { p =ERR_PTR (ret); goto err;
net/sunrpc/auth_gss/gss_krb5_mech.c +5 -2
@@ -679,6 +679,7 @@ out_err:static int gss_import_sec_context_kerberos (const void *p,size_t len,struct gss_ctx *ctx_id, +time_t *endtime,gfp_t gfp_mask) {const void *end = (const void *)((const char *)p + len);
@@ -694,9 +695,11 @@ gss_import_sec_context_kerberos(const void *p, size_t len,else ret =gss_import_v2_context (p, end, ctx, gfp_mask); -if (ret ==0 ) +if (ret ==0 ) { ctx_id->internal_ctx_id = ctx; -else +if (endtime) + *endtime = ctx->endtime; + }else kfree (ctx);dprintk ("RPC: %s: returning %d\n" , __func__, ret);
net/sunrpc/auth_gss/gss_mech_switch.c +3 -2
@@ -325,14 +325,15 @@ int gss_import_sec_context(const void *input_token, size_t bufsize, struct gss_api_mech *mech, struct gss_ctx **ctx_id, + time_t *endtime, gfp_t gfp_mask) { if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask))) return -ENOMEM; (*ctx_id)->mech_type =gss_mech_get (mech); -return mech->gm_ops - ->gss_import_sec_context (input_token, bufsize, *ctx_id, gfp_mask); +return mech->gm_ops->gss_import_sec_context (input_token, bufsize, + *ctx_id, endtime, gfp_mask); }/* gss_get_mic: compute a mic over message and return mic_token. */
net/sunrpc/auth_gss/svcauth_gss.c +2 -1
@@ -497,7 +497,8 @@ static int rsc_parse(struct cache_detail *cd, len =qword_get (&mesg, buf, mlen);if (len <0 ) goto out; - status =gss_import_sec_context (buf, len, gm, &rsci.mechctx,GFP_KERNEL ); + status =gss_import_sec_context (buf, len, gm, &rsci.mechctx, +NULL ,GFP_KERNEL );if (status) goto out;
Signature · 1 line
1.7.9.5
PATCH 4/5 SUNRPC: Add RPC based upcall mechanism for RPCGSS auth
In reply to J. Bruce FieldsFrom: Simo Sorce <[email protected]>
This patch implements a sunrpc client to use the services of the gssproxy userspace daemon.
In particular it allows to perform calls in user space using an RPC call instead of custom hand-coded upcall/downcall messages.
Currently only accept_sec_context is implemented as that is all is needed for the server case.
File server modules like NFS and CIFS can use full gssapi services this way, once init_sec_context is also implemented.
For the NFS server case this code allow to lift the limit of max 2k krb5 tickets. This limit is prevents legitimate kerberos deployments from using krb5 authentication with the Linux NFS server as they have normally ticket that are many kilobytes large.
It will also allow to lift the limitation on the size of the credential set (uid,gid,gids) passed down from user space for users that have very many groups associated. Currently the downcall mechanism used by rpc.svcgssd is limited to around 2k secondary groups of the 65k allowed by kernel structures.
--- net/sunrpc/auth_gss/Makefile | 3 +- net/sunrpc/auth_gss/gss_rpc_upcall.c | 355 +++++++++++++++ net/sunrpc/auth_gss/gss_rpc_upcall.h | 47 ++ net/sunrpc/auth_gss/gss_rpc_xdr.c | 832 ++++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_rpc_xdr.h | 264 +++++++++++ net/sunrpc/clnt.c | 1 + net/sunrpc/netns.h | 3 + 7 files changed, 1504 insertions(+), 1 deletion(-) create mode 100644 net/sunrpc/auth_gss/gss_rpc_upcall.c create mode 100644 net/sunrpc/auth_gss/gss_rpc_upcall.h create mode 100644 net/sunrpc/auth_gss/gss_rpc_xdr.c create mode 100644 net/sunrpc/auth_gss/gss_rpc_xdr.h
net/sunrpc/auth_gss/Makefile +2 -1
@@ -5,7 +5,8 @@ obj-$(CONFIG_SUNRPC_GSS) += auth_rpcgss.o auth_rpcgss-y := auth_gss.o gss_generic_token.o \ - gss_mech_switch.o svcauth_gss.o + gss_mech_switch.o svcauth_gss.o \ + gss_rpc_upcall.o gss_rpc_xdr.o obj-$(CONFIG_RPCSEC_GSS_KRB5) += rpcsec_gss_krb5.o
net/sunrpc/auth_gss/gss_rpc_upcall.c new file +355 -0
355 lines not on this page · raw message
net/sunrpc/auth_gss/gss_rpc_upcall.h new file +47 -0
47 lines not on this page · raw message
net/sunrpc/auth_gss/gss_rpc_xdr.c new file +832 -0
832 lines not on this page · raw message
net/sunrpc/auth_gss/gss_rpc_xdr.h new file +264 -0
264 lines not on this page · raw message
net/sunrpc/clnt.c +1 -0
@@ -685,6 +685,7 @@ rpc_release_client(struct rpc_clnt *clnt)if (atomic_dec_and_test (&clnt->cl_count))rpc_free_auth (clnt); } +EXPORT_SYMBOL_GPL (rpc_release_client);/** * rpc_bind_new_program - bind a new RPC program to an existing client
net/sunrpc/netns.h +3 -0
@@ -23,6 +23,9 @@ struct sunrpc_net {struct rpc_clnt *rpcb_local_clnt4;spinlock_t rpcb_clnt_lock;unsigned int rpcb_users; + +struct mutex gssp_lock; +struct rpc_clnt *gssp_clnt; };extern int sunrpc_net_id;
Signature · 1 line
1.7.9.5
PATCH 5/5 SUNRPC: Use gssproxy upcall for server RPCGSS authentication.
In reply to J. Bruce FieldsFrom: Simo Sorce <[email protected]>
The main advantge of this new upcall mechanism is that it can handle big tickets as seen in Kerberos implementations where tickets carry authorization data like the MS-PAC buffer with AD or the Posix Authorization Data being discussed in IETF on the krbwg working group.
The Gssproxy program is used to perform the accept_sec_context call on the kernel's behalf. The code is changed to also pass the input buffer straight to upcall mechanism to avoid allocating and copying many pages as tokens can be as big (potentially more in future) as 64KiB.
--- Documentation/filesystems/nfs/00-INDEX | 2 + Documentation/filesystems/nfs/rpc-server-gss.txt | 91 ++++++ net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 + net/sunrpc/auth_gss/svcauth_gss.c | 347 +++++++++++++++++++++- net/sunrpc/netns.h | 3 + 5 files changed, 436 insertions(+), 9 deletions(-) create mode 100644 Documentation/filesystems/nfs/rpc-server-gss.txt
Documentation/filesystems/nfs/00-INDEX +2 -0
@@ -20,3 +20,5 @@ rpc-cache.txt - introduction to the caching mechanisms in the sunrpc layer. idmapper.txt - information for configuring request-keys to be used by idmapper +knfsd-rpcgss.txt + - Information on GSS authentication support in the NFS Server
Documentation/filesystems/nfs/rpc-server-gss.txt new file +91 -0
91 lines not on this page · raw message
net/sunrpc/auth_gss/gss_rpc_upcall.c +2 -0
@@ -137,6 +137,7 @@ void init_gssp_clnt(struct sunrpc_net *sn) {mutex_init (&sn->gssp_lock); sn->gssp_clnt =NULL ; +init_waitqueue_head (&sn->gssp_wq); }int set_gssp_clnt (struct net *net)
@@ -153,6 +154,7 @@ int set_gssp_clnt(struct net *net) sn->gssp_clnt = clnt; }mutex_unlock (&sn->gssp_lock); +wake_up (&sn->gssp_wq);return ret; }
net/sunrpc/auth_gss/svcauth_gss.c +338 -9
404 lines not on this page · raw message
net/sunrpc/netns.h +3 -0
@@ -25,7 +25,10 @@ struct sunrpc_net {unsigned int rpcb_users;struct mutex gssp_lock; +wait_queue_head_t gssp_wq;struct rpc_clnt *gssp_clnt; +int use_gss_proxy; +struct proc_dir_entry *use_gssp_proc; };extern int sunrpc_net_id;
Signature · 1 line
1.7.9.5