--- old/src/hotspot/os/posix/os_posix.cpp 2018-11-22 17:27:13.497061000 +0100 +++ new/src/hotspot/os/posix/os_posix.cpp 2018-11-22 17:27:12.793058000 +0100 @@ -36,6 +36,8 @@ #include "utilities/vmError.hpp" #include +#include +#include #include #include #include @@ -427,6 +429,38 @@ st->cr(); } +void os::Posix::print_umask(outputStream* st, mode_t umsk) { + st->print((umsk & S_IRUSR) ? "r" : "-"); + st->print((umsk & S_IWUSR) ? "w" : "-"); + st->print((umsk & S_IXUSR) ? "x" : "-"); + st->print((umsk & S_IRGRP) ? "r" : "-"); + st->print((umsk & S_IWGRP) ? "w" : "-"); + st->print((umsk & S_IXGRP) ? "x" : "-"); + st->print((umsk & S_IROTH) ? "r" : "-"); + st->print((umsk & S_IWOTH) ? "w" : "-"); + st->print((umsk & S_IXOTH) ? "x" : "-"); +} + +void os::Posix::print_user_info(outputStream* st) { + unsigned id = (unsigned) ::getuid(); + st->print("uid : %u ", id); + id = (unsigned) ::geteuid(); + st->print("euid : %u ", id); + id = (unsigned) ::getgid(); + st->print("gid : %u ", id); + id = (unsigned) ::getegid(); + st->print_cr("egid : %u", id); + st->cr(); + + mode_t umsk = ::umask(0); + ::umask(umsk); + st->print("umask: %04o (", (unsigned) umsk); + print_umask(st, umsk); + st->print_cr(")"); + st->cr(); +} + + bool os::get_host_name(char* buf, size_t buflen) { struct utsname name; uname(&name); --- old/src/hotspot/os/posix/os_posix.hpp 2018-11-22 17:27:16.310096000 +0100 +++ new/src/hotspot/os/posix/os_posix.hpp 2018-11-22 17:27:15.611090000 +0100 @@ -116,6 +116,10 @@ // Returns true if either given uid is effective uid and given gid is // effective gid, or if given uid is root. static bool matches_effective_uid_and_gid_or_root(uid_t uid, gid_t gid); + + static void print_umask(outputStream* st, mode_t umsk); + + static void print_user_info(outputStream* st); }; // On POSIX platforms the signal handler is global so we just do the write. --- old/src/hotspot/share/utilities/vmError.cpp 2018-11-22 17:27:19.103141000 +0100 +++ new/src/hotspot/share/utilities/vmError.cpp 2018-11-22 17:27:18.394130000 +0100 @@ -820,6 +820,14 @@ st->cr(); } +#ifndef _WIN32 + STEP("printing user info") + + if (ExtensiveErrorReports && _verbose) { + os::Posix::print_user_info(st); + } +#endif + STEP("printing all threads") // all threads