Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions buildhurd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ -d hotspot/agent ]; then
mv hotspot/agent hotspot/agent.disabled
fi

if [ ! -d apache-ant-1.7.1 ]; then
wget -c https://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar -xf apache-ant-1.7.1-bin.tar.gz
fi

unset JAVA_HOME
export LANG=C

JDK_TO_BUILD_WITH=$(realpath ../jdk6/build/linux-x86/langtools/dist/bootstrap)
export ALT_BOOTDIR=${JDK_TO_BUILD_WITH}
export ALT_JDK_IMPORT_PATH=${JDK_TO_BUILD_WITH}

source ./jdk/make/jdk_generic_profile.sh

make ANT_HOME=$(realpath apache-ant-1.7.1) GENERATE_DOCS=false BUILD_JAXWS=false BUILD_JAXP=false BUILD_CORBA=false BUILD_JDK=true BUILD_LANGTOOLS=true ALSA_CHECK=newer SKIP_FREETYPE_CHECK=true EXTRA_CXXFLAGS="-fpermissive" EXTRA_CFLAGS="-fpermissive" USE_PRECOMPILED_HEADER=0 INCLUDE_TRACE=0 COMPILER_WARNINGS_FATAL=false ALT_SDT_H=/nowhere ARCH=x86 ARCH_DATA_MODEL=64 LP64=1 LIBARCH=amd64 PLATFORM=linux BOOT_VER=1.5.0 FT2_CFLAGS="$(pkg-config --cflags freetype2)" FT2_LIBS="$(pkg-config --libs freetype2)" STATIC_CXX=false NO_DOCS=true DEBUG_CLASSFILES=true DEBUG_BINARIES=true STRIP_POLICY=no_strip FULL_DEBUG_SYMBOLS=1 debug_build
2 changes: 1 addition & 1 deletion hotspot/make/aix/makefiles/trace.make
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen

XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
XML_DEPS = $(TraceSrcDir)/trace.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
ifeq ($(HAS_ALT_SRC), true)
XML_DEPS += $(TraceAltSrcDir)/traceevents.xml
Expand Down
2 changes: 1 addition & 1 deletion hotspot/make/bsd/makefiles/trace.make
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen

XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
XML_DEPS = $(TraceSrcDir)/trace.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
ifeq ($(HAS_ALT_SRC), true)
XML_DEPS += $(TraceAltSrcDir)/traceevents.xml
Expand Down
6 changes: 6 additions & 0 deletions hotspot/make/defs.make
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,18 @@ endif
# Windows should have OS predefined
ifeq ($(OS),)
OS := $(shell uname -s)
ifeq ($(OS), GNU/kFreeBSD)
OS=Linux
endif
ifneq ($(findstring BSD,$(OS)),)
OS=bsd
endif
ifeq ($(OS), Darwin)
OS=bsd
endif
ifeq ($(OS), GNU)
OS=Linux
endif
HOST := $(shell uname -n)
endif

Expand Down
6 changes: 5 additions & 1 deletion hotspot/make/linux/makefiles/defs.make
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ LIBRARY_SUFFIX=so
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms
VM_DEBUG=jvmg

EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
# XXX Does not work
#EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html

# client and server subdirectories have symbolic links to ../libjsig.so
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
Expand Down Expand Up @@ -348,6 +349,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
endif
endif
# XXX Disable for now
ADD_SA_BINARIES/x86 =

ADD_SA_BINARIES/ppc =
ADD_SA_BINARIES/ppc64 =
ADD_SA_BINARIES/ia64 =
Expand Down
2 changes: 1 addition & 1 deletion hotspot/make/linux/makefiles/jvmti.make
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ VPATH += $(Src_Dirs_V:%=%:)
JvmtiGeneratedNames = \
jvmtiEnv.hpp \
jvmtiEnter.cpp \
jvmtiEnterTrace.cpp \
jvmtiEnvRecommended.cpp \
bytecodeInterpreterWithChecks.cpp \
jvmti.h \
#XXX fails link jvmtiEnterTrace.cpp \

JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java
JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class
Expand Down
4 changes: 2 additions & 2 deletions hotspot/make/linux/makefiles/rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ QUIETLY$(MAKE_VERBOSE) = @
RUN.JAR$(MAKE_VERBOSE) += >/dev/null

# Settings for javac
BOOT_SOURCE_LANGUAGE_VERSION = 6
BOOT_TARGET_CLASS_VERSION = 6
BOOT_SOURCE_LANGUAGE_VERSION = 5
BOOT_TARGET_CLASS_VERSION = 5
JAVAC_FLAGS = -g -encoding ascii
BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)

Expand Down
2 changes: 1 addition & 1 deletion hotspot/make/linux/makefiles/trace.make
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen

XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
XML_DEPS = $(TraceSrcDir)/trace.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
ifeq ($(HAS_ALT_SRC), true)
XML_DEPS += $(TraceAltSrcDir)/traceevents.xml
Expand Down
2 changes: 1 addition & 1 deletion hotspot/make/solaris/makefiles/trace.make
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen

XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
XML_DEPS = $(TraceSrcDir)/trace.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
ifeq ($(HAS_ALT_SRC), true)
XML_DEPS += $(TraceAltSrcDir)/traceevents.xml
Expand Down
2 changes: 1 addition & 1 deletion hotspot/make/windows/makefiles/trace.make
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TraceGeneratedFiles = $(TraceGeneratedFiles) \

XSLT = $(QUIETLY) $(REMOTE) $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen

XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
XML_DEPS = $(TraceSrcDir)/trace.xml \
$(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod

!if EXISTS($(TraceAltSrcDir))
Expand Down
33 changes: 30 additions & 3 deletions hotspot/src/os/linux/vm/attachListener_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include <sys/un.h>
#include <sys/stat.h>

#if defined(__FreeBSD_kernel__)
# include <sys/ucred.h>
#endif

#ifndef UNIX_PATH_MAX
#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path)
#endif
Expand All @@ -55,6 +59,27 @@
// obtain the credentials of client. We check that the effective uid
// of the client matches this process.

// Linux (SO_PEERCRED) and FreeBSD (LOCAL_PEERCRED) have very similar
// interfaces for this but incompatible names, so we define macros for each
// system which are used in dequeue() below. For systems which don't have
// either, you may want to disable the check (#warning below, but make sure
// file modes are enough to prevent unwanted connections).
#ifdef SO_PEERCRED
# define UCRED_OPTION SO_PEERCRED
# define UCRED_T struct ucred
# define UCRED_UID uid
# define UCRED_GID gid
#elif defined(LOCAL_PEERCRED)
# define UCRED_OPTION LOCAL_PEERCRED
# define UCRED_T struct xucred
# define UCRED_UID cr_uid
# define UCRED_GID cr_gid
#elif defined(__GNU__)
//XXX fails on -Werror # warning SO_PEERCRED not available, authentication will rely on file mode
#else
# error SO_PEERCRED not available, please implement checks for your system
#endif

// forward reference
class LinuxAttachOperation;

Expand Down Expand Up @@ -335,23 +360,25 @@ LinuxAttachOperation* LinuxAttachListener::dequeue() {
return NULL; // log a warning?
}

#ifdef UCRED_OPTION // (see above)
// get the credentials of the peer and check the effective uid/guid
// - check with jeff on this.
struct ucred cred_info;
UCRED_T cred_info;
socklen_t optlen = sizeof(cred_info);
if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) {
if (::getsockopt(s, SOL_SOCKET, UCRED_OPTION, (void*)&cred_info, &optlen) == -1) {
int res;
RESTARTABLE(::close(s), res);
continue;
}
uid_t euid = geteuid();
gid_t egid = getegid();

if (cred_info.uid != euid || cred_info.gid != egid) {
if (cred_info.UCRED_UID != euid || cred_info.UCRED_GID != egid) {
int res;
RESTARTABLE(::close(s), res);
continue;
}
#endif

// peer credential look okay so we read the request
LinuxAttachOperation* op = read_request(s);
Expand Down
2 changes: 2 additions & 0 deletions hotspot/src/os/linux/vm/jvm_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ struct siglabel siglabels[] = {
"WINCH", SIGWINCH, /* Window size change (4.3 BSD, Sun). */
"POLL", SIGPOLL, /* Pollable event occurred (System V). */
"IO", SIGIO, /* I/O now possible (4.2 BSD). */
#ifdef SIGPWR
"PWR", SIGPWR, /* Power failure restart (System V). */
#endif
#ifdef SIGSYS
"SYS", SIGSYS /* Bad system call. Only on some Linuxen! */
#endif
Expand Down
13 changes: 13 additions & 0 deletions hotspot/src/os/linux/vm/jvm_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@
#include <sys/socket.h> /* For socklen_t */
#include <unistd.h> /* For F_OK, R_OK, W_OK */

/* MAXPATHLEN and PATH_MAX are optional. */
#ifndef MAXPATHLEN
# define MAXPATHLEN 4096
#endif
#ifndef PATH_MAX
# define PATH_MAX MAXPATHLEN
#endif

/* MAP_NORESERVE is Linux-specific. */
#ifndef MAP_NORESERVE
# define MAP_NORESERVE 0
#endif

#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"}
Expand Down
Loading