public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount
@ 2014-01-22 14:59 Jeff Layton
  2014-01-22 16:25 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2014-01-22 14:59 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs, nmorey, rh-bugzilla, m.a.young

Some krb5 routines will attempt to access files in the user's home
directory. This is problematic for gssd when the user's homedir is
on a kerberized NFS mount as it will end up deadlocked.

Fix this by setting $HOME unconditionally to "/".

Fixes this Fedora bug:

    https://bugzilla.redhat.com/show_bug.cgi?id=1052902

Reported-by: Enrico Scholz <rh-bugzilla@ensc.de>
Reported-by: nmorey <nmorey@kalray.eu>
Tested-by: Michael Young <m.a.young@durham.ac.uk>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 utils/gssd/gssd.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index fdad153..611ef1a 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -46,6 +46,7 @@
 
 #include <unistd.h>
 #include <err.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -161,6 +162,18 @@ main(int argc, char *argv[])
 		}
 	}
 
+	/*
+	 * Some krb5 routines try to scrape info out of files in the user's
+	 * home directory. This can easily deadlock when that homedir is on a
+	 * kerberized NFS mount. By setting $HOME unconditionally to "/", we
+	 * prevent this behavior in routines that use $HOME in preference to
+	 * the results of getpw*.
+	 */
+	if (setenv("HOME", "/", 1)) {
+		printerr(1, "Unable to set $HOME: %s\n", strerror(errno));
+		exit(1);
+	}
+
 	i = 0;
 	ccachesearch[i++] = strtok(ccachedir, ":");
 	do {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount
  2014-01-22 14:59 [PATCH] gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount Jeff Layton
@ 2014-01-22 16:25 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2014-01-22 16:25 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-nfs, nmorey, rh-bugzilla, m.a.young



On 22/01/14 09:59, Jeff Layton wrote:
> Some krb5 routines will attempt to access files in the user's home
> directory. This is problematic for gssd when the user's homedir is
> on a kerberized NFS mount as it will end up deadlocked.
> 
> Fix this by setting $HOME unconditionally to "/".
> 
> Fixes this Fedora bug:
> 
>     https://bugzilla.redhat.com/show_bug.cgi?id=1052902
> 
> Reported-by: Enrico Scholz <rh-bugzilla@ensc.de>
> Reported-by: nmorey <nmorey@kalray.eu>
> Tested-by: Michael Young <m.a.young@durham.ac.uk>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
Committed... 

steved.

> ---
>  utils/gssd/gssd.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
> index fdad153..611ef1a 100644
> --- a/utils/gssd/gssd.c
> +++ b/utils/gssd/gssd.c
> @@ -46,6 +46,7 @@
>  
>  #include <unistd.h>
>  #include <err.h>
> +#include <errno.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> @@ -161,6 +162,18 @@ main(int argc, char *argv[])
>  		}
>  	}
>  
> +	/*
> +	 * Some krb5 routines try to scrape info out of files in the user's
> +	 * home directory. This can easily deadlock when that homedir is on a
> +	 * kerberized NFS mount. By setting $HOME unconditionally to "/", we
> +	 * prevent this behavior in routines that use $HOME in preference to
> +	 * the results of getpw*.
> +	 */
> +	if (setenv("HOME", "/", 1)) {
> +		printerr(1, "Unable to set $HOME: %s\n", strerror(errno));
> +		exit(1);
> +	}
> +
>  	i = 0;
>  	ccachesearch[i++] = strtok(ccachedir, ":");
>  	do {
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-22 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22 14:59 [PATCH] gssd: set $HOME to prevent recursion when home dirs are on kerberized NFS mount Jeff Layton
2014-01-22 16:25 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox