diff options
Diffstat (limited to 'dev-lang/ocaml/files')
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.05.0-CVE-2018-9838.patch | 70 | ||||
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.05.0-gcc10.patch | 59 | ||||
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.09.0-cflags.patch | 65 | ||||
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.09.0-gcc-10.patch | 21 | ||||
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.11.2-cflags.patch (renamed from dev-lang/ocaml/files/ocaml-4.10.2-cflags.patch) | 16 | ||||
-rw-r--r-- | dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch | 46 |
6 files changed, 54 insertions, 223 deletions
diff --git a/dev-lang/ocaml/files/ocaml-4.05.0-CVE-2018-9838.patch b/dev-lang/ocaml/files/ocaml-4.05.0-CVE-2018-9838.patch deleted file mode 100644 index cfe3ff636c25..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.05.0-CVE-2018-9838.patch +++ /dev/null @@ -1,70 +0,0 @@ -https://bugs.gentoo.org/755257 - -Needed for both fixing the CVE + compatibility with Debian for e.g. -Unison. - -From c6ca3afc78b75d7748e4e09e56c6b020418be06e Mon Sep 17 00:00:00 2001 -From: Stephane Glondu <steph@glondu.net> -Date: Fri, 25 Jan 2019 14:34:23 +0100 -Subject: [PATCH] Fix integer overflows when unmarshaling a bigarray - -Malicious or corrupted marshaled data can result in a bigarray -with impossibly large dimensions that cause overflow when computing -the in-memory size of the bigarray. Disaster ensues when the data -is read in a too small memory area. This commit checks for overflows -when computing the in-memory size of the bigarray. - -This patch is based on one by Xavier Leroy and has been modified to -use caml_ba_multov instead of caml_umul_overflow which is unavailable -in OCaml 4.05.0. - -The original commit hash is 85162eee9d4072fa9c2f498f03cd94e357033eec. - -Origin: https://github.com/ocaml/ocaml/pull/1718 -Bug: https://github.com/ocaml/ocaml/issues/7765 -Bug-Debian: https://bugs.debian.org/895472 -Bug-CVE: CVE-2018-9838 ---- a/otherlibs/bigarray/bigarray_stubs.c -+++ b/otherlibs/bigarray/bigarray_stubs.c -@@ -966,22 +966,34 @@ static void caml_ba_deserialize_longarray(void * dest, intnat num_elts) - uintnat caml_ba_deserialize(void * dst) - { - struct caml_ba_array * b = dst; -- int i, elt_size; -- uintnat num_elts; -+ int i; -+ uintnat num_elts, size; -+ int overflow; - - /* Read back header information */ - b->num_dims = caml_deserialize_uint_4(); -+ if (b->num_dims < 0 || b->num_dims > CAML_BA_MAX_NUM_DIMS) -+ caml_deserialize_error("input_value: wrong number of bigarray dimensions"); - b->flags = caml_deserialize_uint_4() | CAML_BA_MANAGED; - b->proxy = NULL; - for (i = 0; i < b->num_dims; i++) b->dim[i] = caml_deserialize_uint_4(); -- /* Compute total number of elements */ -- num_elts = caml_ba_num_elts(b); -- /* Determine element size in bytes */ -+ /* Compute total number of elements. Watch out for overflows (MPR#7765). */ -+ num_elts = 1; -+ for (i = 0; i < b->num_dims; i++) { -+ overflow = 0; -+ num_elts = caml_ba_multov(num_elts, b->dim[i], &overflow); -+ if (overflow) -+ caml_deserialize_error("input_value: size overflow for bigarray"); -+ } -+ /* Determine array size in bytes. Watch out for overflows (MPR#7765). */ - if ((b->flags & CAML_BA_KIND_MASK) > CAML_BA_CHAR) - caml_deserialize_error("input_value: bad bigarray kind"); -- elt_size = caml_ba_element_size[b->flags & CAML_BA_KIND_MASK]; -+ overflow = 0; -+ size = caml_ba_multov(num_elts, caml_ba_element_size[b->flags & CAML_BA_KIND_MASK], &overflow); -+ if (overflow) -+ caml_deserialize_error("input_value: size overflow for bigarray"); - /* Allocate room for data */ -- b->data = malloc(elt_size * num_elts); -+ b->data = malloc(size); - if (b->data == NULL) - caml_deserialize_error("input_value: out of memory for bigarray"); - /* Read data */ diff --git a/dev-lang/ocaml/files/ocaml-4.05.0-gcc10.patch b/dev-lang/ocaml/files/ocaml-4.05.0-gcc10.patch deleted file mode 100644 index a0c67da534a0..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.05.0-gcc10.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/byterun/caml/intext.h 2021-01-28 22:46:20.400224678 +0100 -+++ b/byterun/caml/intext.h 2021-01-28 22:46:49.312751054 +0100 -@@ -196,7 +196,7 @@ - - CAMLextern struct code_fragment * caml_extern_find_code(char *addr); - --struct ext_table caml_code_fragments_table; -+extern struct ext_table caml_code_fragments_table; - - #endif /* CAML_INTERNALS */ - ---- a/byterun/caml/major_gc.h 2021-01-28 22:44:12.193323457 +0100 -+++ b/byterun/caml/major_gc.h 2021-01-28 22:45:20.918198701 +0100 -@@ -64,9 +64,9 @@ - extern char *caml_gc_sweep_hp; - - extern int caml_major_window; --double caml_major_ring[Max_major_window]; --int caml_major_ring_index; --double caml_major_work_credit; -+extern double caml_major_ring[Max_major_window]; -+extern int caml_major_ring_index; -+extern double caml_major_work_credit; - extern double caml_gc_clock; - - /* [caml_major_gc_hook] is called just between the end of the mark ---- a/byterun/meta.c 2021-01-28 22:47:34.148016359 +0100 -+++ b/byterun/meta.c 2021-01-28 22:47:56.048657393 +0100 -@@ -32,6 +32,8 @@ - #include "caml/prims.h" - #include "caml/stacks.h" - -+struct ext_table caml_code_fragments_table; -+ - #ifndef NATIVE_CODE - - CAMLprim value caml_get_global_data(value unit) ---- a/byterun/backtrace.c 2021-01-28 22:50:25.275226598 +0100 -+++ b/byterun/backtrace.c 2021-01-28 22:50:37.541027290 +0100 -@@ -28,7 +28,7 @@ - #include "caml/fail.h" - - /* The table of debug information fragments */ --struct ext_table caml_debug_info; -+extern struct ext_table caml_debug_info; - - CAMLexport int32_t caml_backtrace_active = 0; - CAMLexport int32_t caml_backtrace_pos = 0; ---- a/asmrun/startup.c 2021-01-28 23:02:50.526072662 +0100 -+++ b/asmrun/startup.c 2021-01-28 23:03:09.977754311 +0100 -@@ -44,7 +44,7 @@ - #endif - - extern int caml_parser_trace; --CAMLexport header_t caml_atom_table[256]; -+CAMLextern header_t caml_atom_table[256]; - char * caml_code_area_start, * caml_code_area_end; - - /* Initialize the atom table and the static data and code area limits. */ diff --git a/dev-lang/ocaml/files/ocaml-4.09.0-cflags.patch b/dev-lang/ocaml/files/ocaml-4.09.0-cflags.patch deleted file mode 100644 index 8d2391407a35..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.09.0-cflags.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/runtime/Makefile 2022-01-22 19:49:32.914213696 +0100 -+++ b/runtime/Makefile 2022-01-22 19:50:03.765640701 +0100 -@@ -335,7 +335,7 @@ - # (without the extension, which is added by the macro) - define COMPILE_C_FILE - $(1).$(O): %.c -- $$(CC) -c $$(OC_CFLAGS) $$(OC_CPPFLAGS) $$(OUTPUTOBJ)$$@ $$< -+ $$(CC) -c $$(OC_CFLAGS) $(CFLAGS) $$(OC_CPPFLAGS) $$(OUTPUTOBJ)$$@ $$< - endef - - object_types := % %_b %_bd %_bi %_bpic %_n %_nd %_ni %_np %_npic ---- a/yacc/Makefile 2022-01-22 20:02:56.510340885 +0100 -+++ b/yacc/Makefile 2022-01-22 20:03:14.998000508 +0100 -@@ -63,4 +63,4 @@ - # also works for .obj files. - - %.$(O): %.c -- $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< -+ $(CC) -c $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< ---- a/otherlibs/Makefile.otherlibs.common 2022-01-22 20:24:15.316779625 +0100 -+++ b/otherlibs/Makefile.otherlibs.common 2022-01-22 20:24:50.730126701 +0100 -@@ -138,4 +138,4 @@ - $(CAMLOPT) -c $(COMPFLAGS) $(OPTCOMPFLAGS) $< - - .c.$(O): -- $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< -+ $(CC) -c $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< ---- a/ocamltest/Makefile 2022-01-22 20:30:22.454009704 +0100 -+++ b/ocamltest/Makefile 2022-01-22 20:30:33.845799603 +0100 -@@ -221,7 +221,7 @@ - $(ocamllex) -q $< - - %.$(O): %.c -- $(CC) $(OC_CFLAGS) $(OC_CPPFLAGS) -c $< -+ $(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) -c $< - - ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config - sed \ ---- a/otherlibs/systhreads/Makefile 2022-01-22 20:42:17.647349876 +0100 -+++ b/otherlibs/systhreads/Makefile 2022-01-22 20:43:29.766086103 +0100 -@@ -93,11 +93,11 @@ - # twice, each time with different options). - - st_stubs_b.$(O): st_stubs.c $(HEADER) -- $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime \ -+ $(CC) -c $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime \ - $(SHAREDLIB_CFLAGS) $(OUTPUTOBJ)$@ $< - - st_stubs_n.$(O): st_stubs.c $(HEADER) -- $(CC) $(OC_CFLAGS) $(OC_CPPFLAGS) \ -+ $(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) \ - -I$(ROOTDIR)/runtime $(SHAREDLIB_CFLAGS) -DNATIVE_CODE \ - -DTARGET_$(ARCH) -DMODEL_$(MODEL) -DSYS_$(SYSTEM) \ - $(OUTPUTOBJ)$@ -c $< ---- a/tools/Makefile 2022-01-23 09:57:00.788877931 +0100 -+++ b/tools/Makefile 2022-01-23 09:57:21.735516656 +0100 -@@ -322,7 +322,7 @@ - endif - - objinfo_helper$(EXE): objinfo_helper.c $(ROOTDIR)/runtime/caml/s.h -- $(CC) $(OC_CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime $(OUTPUTEXE)$@ \ -+ $(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime $(OUTPUTEXE)$@ \ - $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) $< $(LIBBFD_LINK) - - OBJINFO=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ diff --git a/dev-lang/ocaml/files/ocaml-4.09.0-gcc-10.patch b/dev-lang/ocaml/files/ocaml-4.09.0-gcc-10.patch deleted file mode 100644 index e25d55a5f668..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.09.0-gcc-10.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/runtime/backtrace.c -+++ b/runtime/backtrace.c -@@ -28,7 +28,7 @@ - #include "caml/fail.h" - - /* The table of debug information fragments */ --struct ext_table caml_debug_info; -+extern struct ext_table caml_debug_info; - - CAMLexport int32_t caml_backtrace_active = 0; - CAMLexport int32_t caml_backtrace_pos = 0; ---- a/runtime/startup_nat.c -+++ b/runtime/startup_nat.c -@@ -44,7 +44,6 @@ - #endif - - extern int caml_parser_trace; --CAMLexport header_t caml_atom_table[256]; - char * caml_code_area_start, * caml_code_area_end; - struct ext_table caml_code_fragments_table; - diff --git a/dev-lang/ocaml/files/ocaml-4.10.2-cflags.patch b/dev-lang/ocaml/files/ocaml-4.11.2-cflags.patch index 01117c39887d..7adb1ea0768d 100644 --- a/dev-lang/ocaml/files/ocaml-4.10.2-cflags.patch +++ b/dev-lang/ocaml/files/ocaml-4.11.2-cflags.patch @@ -1,5 +1,5 @@ ---- a/runtime/Makefile 2022-01-22 19:49:32.914213696 +0100 -+++ b/runtime/Makefile 2022-01-22 19:50:03.765640701 +0100 +--- a/runtime/Makefile ++++ b/runtime/Makefile @@ -335,7 +335,7 @@ # (without the extension, which is added by the macro) define COMPILE_C_FILE @@ -9,16 +9,16 @@ endef object_types := % %_b %_bd %_bi %_bpic %_n %_nd %_ni %_np %_npic ---- a/otherlibs/Makefile.otherlibs.common 2022-01-22 20:24:15.316779625 +0100 -+++ b/otherlibs/Makefile.otherlibs.common 2022-01-22 20:24:50.730126701 +0100 +--- a/otherlibs/Makefile.otherlibs.common ++++ b/otherlibs/Makefile.otherlibs.common @@ -138,4 +138,4 @@ $(CAMLOPT) -c $(COMPFLAGS) $(OPTCOMPFLAGS) $< .c.$(O): - $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< + $(CC) -c $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $< ---- a/otherlibs/systhreads/Makefile 2022-01-22 20:42:17.647349876 +0100 -+++ b/otherlibs/systhreads/Makefile 2022-01-22 20:43:29.766086103 +0100 +--- a/otherlibs/systhreads/Makefile ++++ b/otherlibs/systhreads/Makefile @@ -102,10 +102,10 @@ st_stubs_n.$(O): OC_CPPFLAGS += $(NATIVE_CPPFLAGS) @@ -32,8 +32,8 @@ partialclean: rm -f *.cm* ---- a/Makefile.common.in 2022-01-23 18:05:04.192323554 +0100 -+++ b/Makefile.common.in 2022-01-23 18:05:17.211122643 +0100 +--- a/Makefile.common.in ++++ b/Makefile.common.in @@ -79,4 +79,4 @@ # general (it supports both .o and .obj) diff --git a/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch b/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch new file mode 100644 index 000000000000..5ba8582d3a65 --- /dev/null +++ b/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch @@ -0,0 +1,46 @@ +From ddf99786f8229c8282905af5c7c74360d4f2fbd0 Mon Sep 17 00:00:00 2001 +From: Alex Fan <alex.fan.q@gmail.com> +Date: Tue, 22 Feb 2022 19:28:30 +1100 +Subject: [PATCH] riscv: Generate frametable in data section to improve code + relocatability (#11042) + +Similar to what PowerPC and System-Z have done in commit 24980d3fd9848e281761ef2b8fe383e71261789b + +With this commit ocamlopt produces .so shared libraries and PIE relocatable +executables that contain no relocations in the text segment. + +Upstream status: merged in 4.14 and 5.x +--- + Changes | 5 +++++ + asmcomp/riscv/emit.mlp | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Changes b/Changes +index 4898e9d69fc..2bec76daac6 100644 +--- a/Changes ++++ b/Changes +@@ -477,6 +477,11 @@ OCaml 4.14.0 + - #10907, #10959: Wrong type inferred from existential types + (Jacques Garrigue and Gabriel Scherer, report by @dyzsr, review by Leo White) + ++- #10688: Move frame descriptor table from `rodata` to `data` section on ++ RISC-V. Improves support for building DLLs and PIEs. In particular, this ++ applies to all binaries in distributions that build PIEs by default (eg ++ Gentoo and Alpine). ++ (Alex Fan, review by Gabriel Scherer) + + OCaml 4.13 maintenance branch + ----------------------------- +diff --git a/asmcomp/riscv/emit.mlp b/asmcomp/riscv/emit.mlp +index 474a3c6857a..b36aa0ea38c 100644 +--- a/asmcomp/riscv/emit.mlp ++++ b/asmcomp/riscv/emit.mlp +@@ -645,7 +645,7 @@ let end_assembly() = + `{emit_symbol lbl_end}:\n`; + ` .quad 0\n`; + (* Emit the frame descriptors *) +- ` {emit_string rodata_space}\n`; ++ ` {emit_string data_space}\n`; (* not rodata because relocations inside *) + let lbl = Compilenv.make_symbol (Some "frametable") in + declare_global_data lbl; + `{emit_symbol lbl}:\n`; |