ae1b71fa3b
BSD specific fixes: - Fix BsdNativeDispatcher - Support thread name setting on OpenBSD and NetBSD Security fixes: - S8225261: Better method resolutions - S8224909, CVE-2020-2583: Unlink Set of LinkedHashSets - S8225279: Better XRender interpolation - S8226352, CVE-2020-2590: Improve Kerberos interop capabilities - S8227758: More valid PKIX processing - S8227816: More Colorful ICC profiles - S8228548, CVE-2020-2593: Normalize normalization for all - S8229951, CVE-2020-2601: Better Ticket Granting Services - S8230279: Improve Pack200 file reading - S8230318: Better trust store usage - S8230967: Improve Registry support of clients - S8231129: More glyph images - S8231139: Improved keystore support - S8231422, CVE-2020-2604: Better serial filter handling - S8231795, CVE-2020-2659: Enhance datagram socket support - S8232419: Improve Registry registration - S8234037, CVE-2020-2654: Improve Object Identifier Processing ~100 additional minor bugfixes.
151 lines
5.2 KiB
Text
151 lines
5.2 KiB
Text
$NetBSD: patch-aa,v 1.9 2020/03/06 10:50:08 tnn Exp $
|
|
|
|
-DragonFly support.
|
|
-Add workaround for missing sem_timedwait() in NetBSD < 6.99.4
|
|
|
|
--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2020-01-16 18:18:12.000000000 +0000
|
|
+++ hotspot/src/os/bsd/vm/os_bsd.cpp
|
|
@@ -110,7 +110,7 @@
|
|
# include <vm/vm_param.h>
|
|
#endif
|
|
|
|
-#if defined(__FreeBSD__) || defined(__NetBSD__)
|
|
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
# include <elf.h>
|
|
#endif
|
|
|
|
@@ -294,6 +294,7 @@ void os::Bsd::initialize_system_info() {
|
|
size_t len;
|
|
int cpu_val;
|
|
julong mem_val;
|
|
+ struct rlimit limits;
|
|
|
|
/* get processors count via hw.ncpus sysctl */
|
|
mib[0] = CTL_HW;
|
|
@@ -332,14 +333,11 @@ void os::Bsd::initialize_system_info() {
|
|
_physical_memory = 256*1024*1024; // fallback (XXXBSD?)
|
|
}
|
|
|
|
-#ifdef __OpenBSD__
|
|
- {
|
|
- // limit _physical_memory memory view on OpenBSD since
|
|
- // datasize rlimit restricts us anyway.
|
|
- struct rlimit limits;
|
|
- getrlimit(RLIMIT_DATA, &limits);
|
|
- _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
- }
|
|
+ getrlimit(RLIMIT_DATA, &limits);
|
|
+ _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
+#if defined(RLIMIT_AS)
|
|
+ getrlimit(RLIMIT_AS, &limits);
|
|
+ _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur);
|
|
#endif
|
|
}
|
|
|
|
@@ -391,7 +389,7 @@ void os::init_system_properties_values()
|
|
// ...
|
|
// 7: The default directories, normally /lib and /usr/lib.
|
|
#ifndef DEFAULT_LIBPATH
|
|
-#define DEFAULT_LIBPATH "/lib:/usr/lib"
|
|
+#define DEFAULT_LIBPATH "@PREFIX@/lib/jni:@PREFIX@/lib:/lib:/usr/lib"
|
|
#endif
|
|
|
|
// Base path of extensions installed on the system.
|
|
@@ -1603,8 +1601,15 @@ void * os::dll_load(const char *filename
|
|
{EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
|
|
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
|
|
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
|
|
+#if defined(EM_AARCH64)
|
|
+ {EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"Aarch64"},
|
|
+#endif
|
|
+#if defined(EM_S390)
|
|
{EM_S390, EM_S390, ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"},
|
|
+#endif
|
|
+#if defined(EM_ALPHA)
|
|
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
|
|
+#endif
|
|
{EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"},
|
|
{EM_MIPS, EM_MIPS, ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"},
|
|
{EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"},
|
|
@@ -2135,6 +2140,33 @@ bool Semaphore::timedwait(unsigned int s
|
|
|
|
#else
|
|
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ < 699000400)
|
|
+static inline int sem_timedwait(sem_t *sem, struct timespec *ts) {
|
|
+ struct timespec onems = { 0, 1000000 };
|
|
+ struct timespec total = { 0, 0 };
|
|
+ struct timespec unslept;
|
|
+ struct timespec elapsed;
|
|
+ struct timespec tmp;
|
|
+
|
|
+ while (timespeccmp(ts, &total, >)) {
|
|
+ if (sem_trywait(sem) == 0)
|
|
+ return 0;
|
|
+
|
|
+ if (errno != EAGAIN)
|
|
+ return -1;
|
|
+
|
|
+ (void)nanosleep(&onems, &unslept);
|
|
+
|
|
+ timespecsub(&onems, &unslept, &elapsed);
|
|
+ timespecadd(&total, &elapsed, &tmp);
|
|
+ total.tv_sec = tmp.tv_sec;
|
|
+ total.tv_nsec = tmp.tv_nsec;
|
|
+ }
|
|
+ errno = ETIMEDOUT;
|
|
+ return -1;
|
|
+}
|
|
+#endif /* __NetBSD__ */
|
|
+
|
|
bool Semaphore::trywait() {
|
|
return sem_trywait(&_semaphore) == 0;
|
|
}
|
|
@@ -2285,7 +2317,7 @@ static void warn_fail_commit_memory(char
|
|
// problem.
|
|
bool os::pd_commit_memory(char* addr, size_t size, bool exec) {
|
|
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
|
|
-#ifdef __OpenBSD__
|
|
+#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
// XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD
|
|
if (::mprotect(addr, size, prot) == 0) {
|
|
return true;
|
|
@@ -2980,7 +3012,7 @@ OSReturn os::set_native_priority(Thread*
|
|
#ifdef __OpenBSD__
|
|
// OpenBSD pthread_setprio starves low priority threads
|
|
return OS_OK;
|
|
-#elif defined(__FreeBSD__)
|
|
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
|
int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);
|
|
return (ret == 0) ? OS_OK : OS_ERR;
|
|
#elif defined(__APPLE__) || defined(__NetBSD__)
|
|
@@ -3009,7 +3041,7 @@ OSReturn os::get_native_priority(const T
|
|
}
|
|
|
|
errno = 0;
|
|
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
|
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
|
*priority_ptr = pthread_getprio(thread->osthread()->pthread_id());
|
|
#elif defined(__APPLE__) || defined(__NetBSD__)
|
|
int policy;
|
|
@@ -3696,7 +3728,11 @@ void os::Bsd::check_signal_handler(int s
|
|
struct sigaction act;
|
|
if (os_sigaction == NULL) {
|
|
// only trust the default sigaction, in case it has been interposed
|
|
+#if defined(__NetBSD__)
|
|
+ os_sigaction = (os_sigaction_t)dlsym(RTLD_DEFAULT, "__sigaction14");
|
|
+#else
|
|
os_sigaction = (os_sigaction_t)dlsym(RTLD_DEFAULT, "sigaction");
|
|
+#endif
|
|
if (os_sigaction == NULL) return;
|
|
}
|
|
|
|
@@ -4028,7 +4064,7 @@ void os::set_native_thread_name(const ch
|
|
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
pthread_set_name_np(pthread_self(), name);
|
|
#elif defined(__NetBSD__)
|
|
- pthread_setname_np(pthread_self(), "%s", name);
|
|
+ pthread_setname_np(pthread_self(), "%s", (void*)name);
|
|
#endif
|
|
}
|
|
}
|