From c3085db7862ff80a17838cd2d8cec30a6a06e8fc Mon Sep 17 00:00:00 2001 From: Michael Young Date: Dec 18 2017 22:08:26 +0000 Subject: fix build with OCaml 4.0.6 (#1526703) disable annobin for x86_64 hypervisor to allow it to build --- diff --git a/xen.ocaml.safe-strings.patch b/xen.ocaml.safe-strings.patch new file mode 100644 index 0000000..e9891ab --- /dev/null +++ b/xen.ocaml.safe-strings.patch @@ -0,0 +1,143 @@ +--- xen-4.10.0/tools/ocaml/libs/xc/xenctrl.ml.orig 2017-12-13 11:37:59.000000000 +0000 ++++ xen-4.10.0/tools/ocaml/libs/xc/xenctrl.ml 2017-12-16 15:01:29.683432280 +0000 +@@ -263,7 +263,7 @@ + (* coredump *) + let coredump xch domid fd = + let dump s = +- let wd = Unix.write fd s 0 (String.length s) in ++ let wd = Unix.write fd (Bytes.of_string s) 0 (String.length s) in + if wd <> String.length s then + failwith "error while writing"; + in +--- xen-4.10.0/tools/ocaml/libs/xb/xb.ml.orig 2017-12-13 11:37:59.000000000 +0000 ++++ xen-4.10.0/tools/ocaml/libs/xb/xb.ml 2017-12-16 16:30:25.195726461 +0000 +@@ -84,7 +84,7 @@ + + let read con s len = + match con.backend with +- | Fd backfd -> read_fd backfd con s len ++ | Fd backfd -> read_fd backfd con (Bytes.of_string s) len + | Xenmmap backmmap -> read_mmap backmmap con s len + + let write_fd back con s len = +@@ -98,7 +98,7 @@ + + let write con s len = + match con.backend with +- | Fd backfd -> write_fd backfd con s len ++ | Fd backfd -> write_fd backfd con (Bytes.of_string s) len + | Xenmmap backmmap -> write_mmap backmmap con s len + + (* NB: can throw Reconnect *) +@@ -147,7 +147,7 @@ + | NoHdr (i, buf) -> + (* we complete the partial header *) + if sz > 0 then +- String.blit s 0 buf (Partial.header_size () - i) sz; ++ String.blit s 0 (Bytes.of_string buf) (Partial.header_size () - i) sz; + con.partial_in <- if sz = i then + HaveHdr (Partial.of_string buf) else NoHdr (i - sz, buf) + ); +--- xen-4.10.0/tools/ocaml/xenstored/stdext.ml.orig 2017-12-13 11:37:59.000000000 +0000 ++++ xen-4.10.0/tools/ocaml/xenstored/stdext.ml 2017-12-16 16:39:35.645109021 +0000 +@@ -122,7 +122,7 @@ + let pid = Unix.getpid () in + let buf = string_of_int pid ^ "\n" in + let len = String.length buf in +- if Unix.write fd buf 0 len <> len ++ if Unix.write fd (Bytes.of_string buf) 0 len <> len + then failwith "pidfile_write failed"; + ) + (fun () -> Unix.close fd) +diff -ur xen-4.10.0.orig/tools/ocaml/xenstored/logging.ml xen-4.10.0/tools/ocaml/xenstored/logging.ml +--- xen-4.10.0.orig/tools/ocaml/xenstored/logging.ml 2017-12-13 11:37:59.000000000 +0000 ++++ xen-4.10.0/tools/ocaml/xenstored/logging.ml 2017-12-16 23:24:47.402606119 +0000 +@@ -60,11 +60,11 @@ + let truncate_line nb_chars line = + if String.length line > nb_chars - 1 then + let len = max (nb_chars - 1) 2 in +- let dst_line = String.create len in +- String.blit line 0 dst_line 0 (len - 2); +- dst_line.[len-2] <- '.'; +- dst_line.[len-1] <- '.'; +- dst_line ++ let dst_line = Bytes.create len in ++ Bytes.blit_string line 0 dst_line 0 (len - 2); ++ Bytes.set dst_line (len-2) '.'; ++ Bytes.set dst_line (len-1) '.'; ++ Bytes.to_string dst_line + else line + + let log_rotate ref_ch log_file log_nb_files = +@@ -252,13 +252,13 @@ + *) + + let sanitize_data data = +- let data = String.copy data in +- for i = 0 to String.length data - 1 ++ let data = Bytes.copy data in ++ for i = 0 to Bytes.length data - 1 + do +- if data.[i] = '\000' then +- data.[i] <- ' ' ++ if Bytes.get data i = '\000' then ++ Bytes.set data i ' ' + done; +- String.escaped data ++ String.escaped (Bytes.to_string data) + + let activate_access_log = ref true + let access_log_destination = ref (File (Paths.xen_log_dir ^ "/xenstored-access.log")) +@@ -291,7 +291,7 @@ + let date = string_of_date() in + let tid = string_of_tid ~con tid in + let access_type = string_of_access_type access_type in +- let data = sanitize_data data in ++ let data = sanitize_data (Bytes.of_string data) in + let prefix = prefix !access_log_destination date in + let msg = Printf.sprintf "%s %s %s %s" prefix tid access_type data in + logger.write ~level msg) +diff -ur xen-4.10.0.orig/tools/ocaml/xenstored/utils.ml xen-4.10.0/tools/ocaml/xenstored/utils.ml +--- xen-4.10.0.orig/tools/ocaml/xenstored/utils.ml 2017-12-13 11:37:59.000000000 +0000 ++++ xen-4.10.0/tools/ocaml/xenstored/utils.ml 2017-12-16 23:26:24.968649002 +0000 +@@ -45,23 +45,23 @@ + + let hexify s = + let hexseq_of_char c = sprintf "%02x" (Char.code c) in +- let hs = String.create (String.length s * 2) in ++ let hs = Bytes.create (String.length s * 2) in + for i = 0 to String.length s - 1 + do + let seq = hexseq_of_char s.[i] in +- hs.[i * 2] <- seq.[0]; +- hs.[i * 2 + 1] <- seq.[1]; ++ Bytes.set hs (i * 2) seq.[0]; ++ Bytes.set hs (i * 2 + 1) seq.[1]; + done; +- hs ++ Bytes.to_string hs + + let unhexify hs = + let char_of_hexseq seq0 seq1 = Char.chr (int_of_string (sprintf "0x%c%c" seq0 seq1)) in +- let s = String.create (String.length hs / 2) in +- for i = 0 to String.length s - 1 ++ let s = Bytes.create (String.length hs / 2) in ++ for i = 0 to Bytes.length s - 1 + do +- s.[i] <- char_of_hexseq hs.[i * 2] hs.[i * 2 + 1] ++ Bytes.set s i (char_of_hexseq hs.[i * 2] hs.[i * 2 + 1]) + done; +- s ++ Bytes.to_string s + + let trim_path path = + try +@@ -85,7 +85,7 @@ + let read_file_single_integer filename = + let fd = Unix.openfile filename [ Unix.O_RDONLY ] 0o640 in + let buf = String.make 20 (char_of_int 0) in +- let sz = Unix.read fd buf 0 20 in ++ let sz = Unix.read fd (Bytes.of_string buf) 0 20 in + Unix.close fd; + int_of_string (String.sub buf 0 sz) + diff --git a/xen.spec b/xen.spec index 0c9075f..16af21a 100644 --- a/xen.spec +++ b/xen.spec @@ -60,7 +60,7 @@ Summary: Xen is a virtual machine monitor Name: xen Version: 4.10.0 -Release: 0%{?dist} +Release: 1%{?dist} Group: Development/Libraries License: GPLv2+ and LGPLv2+ and BSD URL: http://xen.org/ @@ -104,17 +104,18 @@ Patch25: qemu.trad.CVE-2016-5338.patch Patch26: xen.xs_watch.stacksize.patch Patch27: qemu.trad.CVE-2016-6351.patch Patch28: xen.glibcfix.patch -Patch33: qemu.trad.CVE-2016-8669.patch -Patch35: qemu.trad.CVE-2016-8910.patch -Patch43: qemu.trad.bug1399055.patch -Patch49: qemu.trad.CVE-2016-9776.patch -Patch52: xen.gcc7.fix.patch -Patch53: xen.canonicalize.patch -Patch55: qemu.trad.CVE-2017-6505.patch -Patch60: qemu.trad.CVE-2017-7718.patch -Patch67: droplibvirtconflict.patch -Patch70: qemu.trad.CVE-2017-8309.patch -Patch73: qemu.trad.CVE-2017-9330.patch +Patch29: qemu.trad.CVE-2016-8669.patch +Patch30: qemu.trad.CVE-2016-8910.patch +Patch31: qemu.trad.bug1399055.patch +Patch32: qemu.trad.CVE-2016-9776.patch +Patch33: xen.gcc7.fix.patch +Patch34: xen.canonicalize.patch +Patch35: qemu.trad.CVE-2017-6505.patch +Patch36: qemu.trad.CVE-2017-7718.patch +Patch37: droplibvirtconflict.patch +Patch38: qemu.trad.CVE-2017-8309.patch +Patch39: qemu.trad.CVE-2017-9330.patch +Patch40: xen.ocaml.safe-strings.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -321,21 +322,22 @@ manage Xen virtual machines. %patch25 -p1 %patch26 -p1 %patch28 -p1 -%patch52 -p1 -%patch53 -p1 -%patch67 -p1 +%patch33 -p1 +%patch34 -p1 +%patch37 -p1 +%patch40 -p1 # qemu-xen-traditional patches pushd tools/qemu-xen-traditional %patch27 -p1 -%patch33 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 %patch35 -p1 -%patch43 -p1 -%patch49 -p1 -%patch55 -p1 -%patch60 -p1 -%patch70 -p1 -%patch73 -p1 +%patch36 -p1 +%patch38 -p1 +%patch39 -p1 popd # qemu-xen patches @@ -370,12 +372,16 @@ export EXTRA_CFLAGS_QEMU_XEN="$RPM_OPT_FLAGS" %if %build_hyp %if %build_crosshyp %define efi_flags LD_EFI=false -XEN_TARGET_ARCH=x86_64 make %{?_smp_mflags} %{?efi_flags} prefix=/usr xen CC="/usr/bin/x86_64-linux-gnu-gcc `echo $RPM_OPT_FLAGS | sed -e 's/-m32//g' -e 's/-march=i686//g' -e 's/-mtune=atom//g'`" +XEN_TARGET_ARCH=x86_64 make %{?_smp_mflags} %{?efi_flags} prefix=/usr xen CC="/usr/bin/x86_64-linux-gnu-gcc `echo $RPM_OPT_FLAGS | sed -e 's/-m32//g' -e 's/-march=i686//g' -e 's/-mtune=atom//g' -e 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g'`" %else %ifarch armv7hl make %{?_smp_mflags} %{?efi_flags} prefix=/usr xen CC="gcc `echo $RPM_OPT_FLAGS | sed -e 's/-mfloat-abi=hard//g' -e 's/-march=armv7-a//g'`" %else +%ifarch aarch64 make %{?_smp_mflags} %{?efi_flags} prefix=/usr xen CC="gcc $RPM_OPT_FLAGS" +%else +make %{?_smp_mflags} %{?efi_flags} prefix=/usr xen CC="gcc `echo $RPM_OPT_FLAGSi | sed -e 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g'`" +%endif %endif %endif %endif @@ -869,6 +875,11 @@ rm -rf %{buildroot} %endif %changelog +* Mon Dec 18 2017 Michael Young - 4.10.0-1 +- renumber patches +- fix build with OCaml 4.0.6 (#1526703) +- disable annobin for x86_64 hypervisor to allow it to build + * Mon Dec 18 2017 Michael Young - allow building without hypervisor, docs, qemu-xen-traditional or stubdoms - fix build without ocaml