RFR(s): 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

David Lloyd david.lloyd at redhat.com
Mon May 13 18:53:54 UTC 2019

On Mon, May 13, 2019 at 11:01 AM Thomas Stüfe <thomas.stuefe at gmail.com> wrote:
> Hi all,
> may I have please your opinions about the following change:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223777
> webrev:
> http://cr.openjdk.java.net/~stuefe/webrevs/8223777-posix_spawn-no-exec-error/webrev.00/webrev/
> [...]
> But at least we can test the execute permissions on the
> jspawnhelper. Which this fix does. This fixes Ubuntu 16.4 (Now, I get an
> IOException if jspawnhelper is not executable).

I like it.  But I wonder if it's a good idea to test in this way:

+        /* Require all bits set since this is how jspawnhelper
+         * is set up in a canonical installation */
+        if (s.st_mode & S_IXUSR &&
+            s.st_mode & S_IXGRP &&
+            s.st_mode & S_IXOTH) {
+            return 1;
+        } else {

What if the JDK is not world-accessible for some reason?  This would
not seem unreasonable.  I think it would be best to err on the side of
caution: if no `x` bit is set, then it would not be executable and an
exception should be reported, but otherwise it *may* be executable so
either no error should be reported at this point, or a "smarter" check
should be done (e.g. comparing the UIDs and so forth).


More information about the core-libs-dev mailing list