From 5a725f0ab8ef9e2a8b08f088ba4e87531ae4530d Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Wed, 16 Mar 2016 14:31:19 +0000 Subject: [PATCH] HADOOP-12888 Shell to disable bash and setsid support when running under JVM security manager (Costin Leau via stevel) --- .../src/main/java/org/apache/hadoop/util/Shell.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java index df9ffa7fe7..0af3752806 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java @@ -717,6 +717,10 @@ private static boolean checkIsBashSupported() { } catch (IOException ioe) { LOG.warn("Bash is not supported by the OS", ioe); supported = false; + } catch (SecurityException se) { + LOG.info("Bash execution is not allowed by the JVM " + + "security manager.Considering it not supported."); + supported = false; } return supported; @@ -744,7 +748,11 @@ private static boolean isSetsidSupported() { } catch (IOException ioe) { LOG.debug("setsid is not available on this machine. So not using it."); setsidSupported = false; - } catch (Error err) { + } catch (SecurityException se) { + LOG.debug("setsid is not allowed to run by the JVM "+ + "security manager. So not using it."); + setsidSupported = false; + } catch (Error err) { if (err.getMessage() != null && err.getMessage().contains("posix_spawn is not " + "a supported process launch mechanism")