~openjdk/openjdk/openjdk7

« back to all changes in this revision

Viewing changes to patches/kfreebsd-support-hotspot.diff

  • Committer: Matthias Klose
  • Date: 2015-10-22 12:00:33 UTC
  • Revision ID: doko@ubuntu.com-20151022120033-9nk8twp82wx63tdg
openjdk-7 (7u85-2.6.1-6) unstable; urgency=high

  [ Tiago Stürmer Daitx ]
  * Security fixes
    - S8048030, CVE-2015-4734: Expectations should be consistent
    - S8068842, CVE-2015-4803: Better JAXP data handling
    - S8076339, CVE-2015-4903: Better handling of remote object invocation
    - S8076383, CVE-2015-4835: Better CORBA exception handling
    - S8076387, CVE-2015-4882: Better CORBA value handling
    - S8076392, CVE-2015-4881: Improve IIOPInputStream consistency
    - S8076413, CVE-2015-4883: Better JRMP message handling
    - S8078427, CVE-2015-4842: More supportive home environment
    - S8078440: Safer managed types
    - S8080541: More direct property handling
    - S8080688, CVE-2015-4860: Service for DGC services
    - S8081744, CVE-2015-4868: Clear out list corner case
    - S8081760: Better group dynamics
    - S8086092. CVE-2015-4840: More palette improvements
    - S8086733, CVE-2015-4893: Improve namespace handling
    - S8087350: Improve array conversions
    - S8103671, CVE-2015-4805: More objective stream classes
    - S8103675: Better Binary searches
    - S8129611: Accessbridge error handling improvement
    - S8130078, CVE-2015-4911: Document better processing
    - S8130185: More accessible access switch
    - S8130193, CVE-2015-4806: Improve HTTP connections
    - S8130864: Better server identity handling
    - S8130891, CVE-2015-4843: (bf) More direct buffering
    - S8131291, CVE-2015-4872: Perfect parameter patterning
    - S8132042, CVE-2015-4844: Preserve layout presentation
  * S6966259: Make PrincipalName and Realm immutable, required for S8048030
  * S8078822: 8068842 fix missed one new file
    PrimeNumberSequenceGenerator.java

  [ Matthias Klose ]
  * Re-enable the atk bridge for releases with a fixed atk bridge.
    Again closes: #797595.

 -- Matthias Klose <doko@ubuntu.com>  Thu, 22 Oct 2015 00:42:34 +0200

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 #include <pthread.h>
10
10
 #else
11
11
 #include <thread.h>
12
 
@@ -107,7 +107,7 @@
 
12
@@ -107,7 +107,7 @@ extern char **environ;
13
13
  *      A collection of useful strings. One should think of these as #define
14
14
  *      entries, but actual strings can be more efficient (with many compilers).
15
15
  */
18
18
 static const char *system_dir   = "/usr/java";
19
19
 static const char *user_dir     = "/java";
20
20
 #else /* Solaris */
21
 
@@ -444,7 +444,7 @@
 
21
@@ -444,7 +444,7 @@ CreateExecutionEnvironment(int *_argcp,
22
22
       runpath = getenv(LD_LIBRARY_PATH);
23
23
 #endif /* __sun */
24
24
 
27
27
       /*
28
28
        * On linux, if a binary is running as sgid or suid, glibc sets
29
29
        * LD_LIBRARY_PATH to the empty string for security purposes.  (In
30
 
@@ -834,7 +834,7 @@
 
30
@@ -834,7 +834,7 @@ error:
31
31
 jboolean
32
32
 GetApplicationHome(char *buf, jint bufsize)
33
33
 {
36
36
     char *execname = GetExecname();
37
37
     if (execname) {
38
38
         strncpy(buf, execname, bufsize-1);
39
 
@@ -1003,7 +1003,7 @@
 
39
@@ -1003,7 +1003,7 @@ SetExecname(char **argv)
40
40
             }
41
41
         }
42
42
     }
45
45
     {
46
46
         const char* self = "/proc/self/exe";
47
47
         char buf[PATH_MAX+1];
48
 
@@ -1898,7 +1898,7 @@
 
48
@@ -1898,7 +1898,7 @@ jlong_format_specifier() {
49
49
 int
50
50
 ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
51
51
     int rslt;
77
77
 // The attach mechanism on Linux uses a UNIX domain socket. An attach listener
78
78
 // thread is created at startup or is created on-demand via a signal from
79
79
 // the client tool. The attach listener creates a socket and binds it to a file
80
 
@@ -337,9 +341,15 @@
 
80
@@ -337,9 +341,15 @@ LinuxAttachOperation* LinuxAttachListene
81
81
 
82
82
     // get the credentials of the peer and check the effective uid/guid
83
83
     // - check with jeff on this.
93
93
       int res;
94
94
       RESTARTABLE(::close(s), res);
95
95
       continue;
96
 
@@ -347,7 +357,11 @@
 
96
@@ -347,7 +357,11 @@ LinuxAttachOperation* LinuxAttachListene
97
97
     uid_t euid = geteuid();
98
98
     gid_t egid = getegid();
99
99
 
107
107
       continue;
108
108
--- openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp.orig
109
109
+++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
110
 
@@ -169,7 +169,9 @@
 
110
@@ -169,7 +169,9 @@ struct siglabel siglabels[] = {
111
111
   "WINCH",      SIGWINCH,       /* Window size change (4.3 BSD, Sun).  */
112
112
   "POLL",       SIGPOLL,        /* Pollable event occurred (System V).  */
113
113
   "IO",         SIGIO,          /* I/O now possible (4.2 BSD).  */
127
127
 // no precompiled headers
128
128
 #include "classfile/classLoader.hpp"
129
129
 #include "classfile/systemDictionary.hpp"
130
 
@@ -110,8 +111,16 @@
 
130
@@ -114,8 +115,16 @@
131
131
 # include <semaphore.h>
132
132
 # include <fcntl.h>
133
133
 # include <string.h>
144
144
 # include <gnu/libc-version.h>
145
145
 # include <sys/ipc.h>
146
146
 # include <sys/shm.h>
147
 
@@ -220,11 +229,22 @@
 
147
@@ -224,11 +233,22 @@ julong os::available_memory() {
148
148
 }
149
149
 
150
150
 julong os::Linux::available_memory() {
167
167
 }
168
168
 
169
169
 julong os::physical_memory() {
170
 
@@ -2299,18 +2319,22 @@
 
170
@@ -2325,18 +2345,22 @@ void os::print_memory_info(outputStream*
171
171
   st->print("Memory:");
172
172
   st->print(" %dk page", os::vm_page_size()>>10);
173
173
 
190
190
   st->cr();
191
191
 }
192
192
 
193
 
@@ -6122,6 +6146,7 @@
194
 
 int os::fork_and_exec(char* cmd) {
195
 
   const char * argv[4] = {"sh", "-c", cmd, NULL};
196
 
 
 
193
@@ -6218,8 +6242,12 @@ int os::fork_and_exec(char* cmd) {
 
194
 #if defined(SPARC)
 
195
   sparc_fork(__NR_fork, &pid, &is_child);
 
196
 #else
197
197
+#ifdef __linux__
198
 
   // fork() in LinuxThreads/NPTL is not async-safe. It needs to run
199
 
   // pthread_atfork handlers and reset pthread library. All we need is a
200
 
   // separate process to execve. Make a direct syscall to fork process.
201
 
@@ -6130,6 +6155,9 @@
202
 
   pid_t pid = NOT_IA64(NOT_AARCH64(syscall(SYS_fork);))
 
198
   pid = NOT_IA64(syscall(__NR_fork);)
203
199
               IA64_ONLY(fork();)
204
 
               AARCH64_ONLY(vfork();)
205
200
+#else
206
 
+  pid_t pid = fork();
 
201
+  pid = fork();
207
202
+#endif
208
203
 
209
 
   if (pid < 0) {
210
 
     // fork failed
211
 
@@ -6138,6 +6166,7 @@
212
 
   } else if (pid == 0) {
 
204
   // set the is_child flag by checking the pid
 
205
   if (pid == 0) {
 
206
@@ -6236,6 +6264,7 @@ int os::fork_and_exec(char* cmd) {
 
207
   } else if (is_child) {
213
208
     // child process
214
209
 
215
210
+#ifdef __linux__
216
211
     // execve() in LinuxThreads will call pthread_kill_other_threads_np()
217
212
     // first to kill every thread on the thread list. Because this list is
218
213
     // not reset by fork() (see notes above), execve() will instead kill
219
 
@@ -6147,6 +6176,9 @@
 
214
@@ -6245,6 +6274,9 @@ int os::fork_and_exec(char* cmd) {
220
215
     // above.
221
 
     NOT_IA64(syscall(SYS_execve, "/bin/sh", argv, environ);)
 
216
     NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
222
217
     IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
223
218
+#else
224
219
+    execve("/bin/sh", (char* const*)argv, environ);
309
304
 
310
305
 address os::current_stack_pointer() {
311
306
 #ifdef SPARC_WORKS
312
 
@@ -113,15 +163,27 @@
 
307
@@ -113,15 +163,27 @@ void os::initialize_thread(Thread* thr)
313
308
 }
314
309
 
315
310
 address os::Linux::ucontext_get_pc(ucontext_t * uc) {
337
332
 }
338
333
 
339
334
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread
340
 
@@ -277,12 +339,20 @@
 
335
@@ -277,12 +339,20 @@ JVM_handle_linux_signal(int sig,
341
336
     pc = (address) os::Linux::ucontext_get_pc(uc);
342
337
 
343
338
     if (pc == (address) Fetch32PFI) {
358
353
        return 1 ;
359
354
     }
360
355
 #endif // AMD64
361
 
@@ -433,7 +503,11 @@
 
356
@@ -433,7 +503,11 @@ JVM_handle_linux_signal(int sig,
362
357
   // Furthermore, a false-positive should be harmless.
363
358
   if (UnguardOnExecutionViolation > 0 &&
364
359
       (sig == SIGSEGV || sig == SIGBUS) &&
370
365
     int page_size = os::vm_page_size();
371
366
     address addr = (address) info->si_addr;
372
367
     address pc = os::Linux::ucontext_get_pc(uc);
373
 
@@ -503,7 +577,11 @@
 
368
@@ -503,7 +577,11 @@ JVM_handle_linux_signal(int sig,
374
369
     // save all thread context in case we need to restore it
375
370
     if (thread != NULL) thread->set_saved_exception_pc(pc);
376
371
 
382
377
     return true;
383
378
   }
384
379
 
385
 
@@ -755,6 +833,7 @@
 
380
@@ -755,6 +833,7 @@ void os::print_context(outputStream *st,
386
381
 
387
382
   ucontext_t *uc = (ucontext_t*)context;
388
383
   st->print_cr("Registers:");
390
385
 #ifdef AMD64
391
386
   st->print(  "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
392
387
   st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
393
 
@@ -797,6 +876,48 @@
 
388
@@ -797,6 +876,48 @@ void os::print_context(outputStream *st,
394
389
   st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
395
390
   st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2);
396
391
 #endif // AMD64
439
434
   st->cr();
440
435
   st->cr();
441
436
 
442
 
@@ -827,6 +948,7 @@
 
437
@@ -827,6 +948,7 @@ void os::print_register_info(outputStrea
443
438
 
444
439
   // this is only for the "general purpose" registers
445
440
 
447
442
 #ifdef AMD64
448
443
   st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
449
444
   st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
450
 
@@ -854,6 +976,35 @@
 
445
@@ -854,6 +976,35 @@ void os::print_register_info(outputStrea
451
446
   st->print("ESI="); print_location(st, uc->uc_mcontext.gregs[REG_ESI]);
452
447
   st->print("EDI="); print_location(st, uc->uc_mcontext.gregs[REG_EDI]);
453
448
 #endif // AMD64
528
523
 #endif // __STDC_LIMIT_MACROS
529
524
--- openjdk/hotspot/make/defs.make.orig
530
525
+++ openjdk/hotspot/make/defs.make
531
 
@@ -152,9 +152,6 @@
 
526
@@ -152,9 +152,6 @@ endif
532
527
 # Windows should have OS predefined
533
528
 ifeq ($(OS),)
534
529
   OS   := $(shell uname -s)
538
533
   ifeq ($(OS), Darwin)
539
534
     OS=bsd
540
535
   endif
541
 
@@ -180,6 +177,10 @@
 
536
@@ -180,6 +177,10 @@ else
542
537
   OSNAME=linux
543
538
 endif
544
539
 
551
546
 
552
547
--- openjdk/hotspot/make/linux/Makefile.orig
553
548
+++ openjdk/hotspot/make/linux/Makefile
554
 
@@ -238,6 +238,9 @@
555
 
 SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
 
549
@@ -258,6 +258,9 @@ checks: check_os_version check_j2se_vers
 
550
 SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4%
556
551
 OS_VERSION := $(shell uname -r)
557
552
 EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
558
553
+ifeq ($(shell uname -s), GNU/kFreeBSD)
563
558
 ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
564
559
--- openjdk/hotspot/make/linux/makefiles/defs.make.orig
565
560
+++ openjdk/hotspot/make/linux/makefiles/defs.make
566
 
@@ -91,7 +91,7 @@
 
561
@@ -91,7 +91,7 @@ ifeq ($(ARCH), x86_64)
567
562
 endif
568
563
 
569
564
 # i686
574
569
   VM_PLATFORM      = linux_i486
575
570
--- openjdk/hotspot/agent/src/os/linux/ps_core.c.orig
576
571
+++ openjdk/hotspot/agent/src/os/linux/ps_core.c
577
 
@@ -539,11 +539,16 @@
 
572
@@ -539,11 +539,16 @@ static bool core_handle_prstatus(struct
578
573
       return false;
579
574
 
580
575
    // copy regs
591
586
       // print the regset
592
587
       print_debug("\teax = 0x%x\n", newthr->regs.eax);
593
588
       print_debug("\tebx = 0x%x\n", newthr->regs.ebx);
594
 
@@ -554,9 +559,21 @@
 
589
@@ -554,9 +559,21 @@ static bool core_handle_prstatus(struct
595
590
       print_debug("\tesi = 0x%x\n", newthr->regs.esi);
596
591
       print_debug("\tedi = 0x%x\n", newthr->regs.edi);
597
592
       print_debug("\teip = 0x%x\n", newthr->regs.eip);
613
608
       // print the regset
614
609
       print_debug("\tr15 = 0x%lx\n", newthr->regs.r15);
615
610
       print_debug("\tr14 = 0x%lx\n", newthr->regs.r14);
616
 
@@ -585,6 +602,27 @@
 
611
@@ -585,6 +602,27 @@ static bool core_handle_prstatus(struct
617
612
       print_debug("\tes = 0x%lx\n", newthr->regs.es);
618
613
       print_debug("\tfs = 0x%lx\n", newthr->regs.fs);
619
614
       print_debug("\tgs = 0x%lx\n", newthr->regs.gs);
643
638
 
644
639
--- openjdk/hotspot/agent/src/os/linux/ps_proc.c.orig
645
640
+++ openjdk/hotspot/agent/src/os/linux/ps_proc.c
646
 
@@ -38,6 +38,22 @@
 
641
@@ -40,6 +40,22 @@
647
642
 #define __WALL          0x40000000  // Copied from /usr/include/linux/wait.h
648
643
 #endif
649
644
 
666
661
 // This file has the libproc implementation specific to live process
667
662
 // For core files, refer to ps_core.c
668
663
 
669
 
@@ -55,7 +71,11 @@
 
664
@@ -57,7 +73,11 @@ static inline uintptr_t align(uintptr_t
670
665
 // before calling process_read_data.
671
666
 
672
667
 static bool process_read_data(struct ps_prochandle* ph, uintptr_t addr, char *buf, size_t size) {
678
673
   size_t i, words;
679
674
   uintptr_t end_addr = addr + size;
680
675
   uintptr_t aligned_addr = align(addr, sizeof(long));
681
 
@@ -63,36 +83,62 @@
 
676
@@ -65,36 +85,62 @@ static bool process_read_data(struct ps_
682
677
   if (aligned_addr != addr) {
683
678
     char *ptr = (char *)&rslt;
684
679
     errno = 0;
741
736
     if (errno) {
742
737
       print_debug("ptrace(PTRACE_PEEKDATA, ..) failed for %d bytes @ %lx\n", size, addr);
743
738
       return false;
744
 
@@ -131,7 +177,11 @@
 
739
@@ -133,7 +179,11 @@ static bool process_get_lwp_regs(struct
745
740
 #endif
746
741
 
747
742
 #ifdef PTRACE_GETREGS_REQ
753
748
    print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
754
749
    return false;
755
750
  }
756
 
@@ -203,7 +253,11 @@
 
751
@@ -205,7 +255,11 @@ static bool ptrace_waitpid(pid_t pid) {
757
752
 
758
753
 // attach to a process/thread specified by "pid"
759
754
 static bool ptrace_attach(pid_t pid) {
765
760
     print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
766
761
     return false;
767
762
   } else {
768
 
@@ -339,7 +393,11 @@
 
763
@@ -341,7 +395,11 @@ static bool read_lib_info(struct ps_proc
769
764
 
770
765
 // detach a given pid
771
766
 static bool ptrace_detach(pid_t pid) {
790
785
 #include "proc_service.h"
791
786
 
792
787
 #if defined(arm) || defined(ppc)
793
 
@@ -117,6 +121,10 @@
 
788
@@ -80,6 +84,10 @@ unsigned long   regs[IA64_REG_COUNT];
794
789
 #define user_regs_struct  pt_regs
795
790
 #endif
796
791
 
803
798
 
804
799
--- openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c.orig
805
800
+++ openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c
806
 
@@ -317,7 +317,7 @@
 
801
@@ -318,7 +318,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv
807
802
 
808
803
 #ifdef i386
809
804
 #define REG_INDEX(reg) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##reg
812
807
   regs[REG_INDEX(GS)]  = (uintptr_t) gregs.xgs;
813
808
   regs[REG_INDEX(FS)]  = (uintptr_t) gregs.xfs;
814
809
   regs[REG_INDEX(ES)]  = (uintptr_t) gregs.xes;
815
 
@@ -333,7 +333,23 @@
 
810
@@ -334,7 +334,23 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv
816
811
   regs[REG_INDEX(PC)] = (uintptr_t) gregs.eip;
817
812
   regs[REG_INDEX(CS)]  = (uintptr_t) gregs.xcs;
818
813
   regs[REG_INDEX(SS)]  = (uintptr_t) gregs.xss;
837
832
 #endif /* i386 */
838
833
 
839
834
 #if ia64
840
 
@@ -345,7 +361,7 @@
 
835
@@ -346,7 +362,7 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv
841
836
 
842
837
 #ifdef amd64
843
838
 #define REG_INDEX(reg) sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_##reg
846
841
   regs[REG_INDEX(R15)] = gregs.r15;
847
842
   regs[REG_INDEX(R14)] = gregs.r14;
848
843
   regs[REG_INDEX(R13)] = gregs.r13;
849
 
@@ -371,7 +387,27 @@
 
844
@@ -372,7 +388,27 @@ JNIEXPORT jlongArray JNICALL Java_sun_jv
850
845
   regs[REG_INDEX(ES)] = gregs.es;
851
846
   regs[REG_INDEX(FS)] = gregs.fs;
852
847
   regs[REG_INDEX(GS)] = gregs.gs;
875
870
 #endif /* amd64 */
876
871
 
877
872
 #if defined(sparc) || defined(sparcv9)
878
 
--- openjdk/hotspot/agent/src/os/linux/libproc.h.orig
879
 
+++ openjdk/hotspot/agent/src/os/linux/libproc.h
880
 
@@ -38,7 +38,9 @@
881
 
 #include "libproc_md.h"
882
 
 #endif
883
 
 
884
 
+#ifdef __linux__
885
 
 #include <linux/ptrace.h>
886
 
+#endif
887
 
 
888
 
 /************************************************************************************
889