diff --git a/xen.spec b/xen.spec index 4114785..fc2d7f1 100644 --- a/xen.spec +++ b/xen.spec @@ -50,7 +50,7 @@ Summary: Xen is a virtual machine monitor Name: xen Version: 4.8.0 -Release: 10%{?dist} +Release: 11%{?dist} Group: Development/Libraries License: GPLv2+ and LGPLv2+ and BSD URL: http://xen.org/ @@ -149,6 +149,8 @@ Patch80: xsa206-4.80012-oxenstored-allow-self-conflicts.patch Patch81: xsa206-4.80013-oxenstored-do-not-commit-read-only-transactions.patch Patch82: xsa206-4.80014-oxenstored-don-t-wake-to-issue-no-conflict-credit.patch Patch83: xsa206-4.80015-oxenstored-transaction-conflicts-improve-logging.patch +Patch84: xsa206-4.80016-oxenstored-trim-history-in-the-frequent_ops-function.patch +Patch85: xen.xsa206.gcc7.fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -369,6 +371,8 @@ manage Xen virtual machines. %patch81 -p1 %patch82 -p1 %patch83 -p1 +%patch84 -p1 +%patch85 -p1 # qemu-xen-traditional patches pushd tools/qemu-xen-traditional @@ -912,6 +916,10 @@ rm -rf %{buildroot} %endif %changelog +* Wed Mar 29 2017 Michael Young - 4.8.0-11 +- add additional patch for [XSA-206] (#1436690) +- gcc7 build fix for [XSA-206] + * Tue Mar 28 2017 Michael Young - 4.8.0-10 - xenstore denial of service via repeated update [XSA-206] (#1436690) diff --git a/xen.xsa206.gcc7.fix.patch b/xen.xsa206.gcc7.fix.patch new file mode 100644 index 0000000..ab86c13 --- /dev/null +++ b/xen.xsa206.gcc7.fix.patch @@ -0,0 +1,12 @@ +--- xen-4.8.0/tools/xenstore/xenstored_domain.c.orig 2017-03-29 22:14:17.567582077 +0100 ++++ xen-4.8.0/tools/xenstore/xenstored_domain.c 2017-03-29 22:19:42.851492159 +0100 +@@ -946,7 +946,8 @@ + (long)domain->wrl_credit, (long)wrl_reserve); + + if (domain->wrl_credit < 0) { +- if (!domain->wrl_delay_logged++) { ++ if (!domain->wrl_delay_logged) { ++ domain->wrl_delay_logged = true; + WRL_LOG(now, "domain %ld is affected", + (long)domain->domid); + } else if (!wrl_log_last_warning) { diff --git a/xsa206-4.80016-oxenstored-trim-history-in-the-frequent_ops-function.patch b/xsa206-4.80016-oxenstored-trim-history-in-the-frequent_ops-function.patch new file mode 100644 index 0000000..40102ef --- /dev/null +++ b/xsa206-4.80016-oxenstored-trim-history-in-the-frequent_ops-function.patch @@ -0,0 +1,79 @@ +From 26b15d4eb7ac71fcab28a7fca664afa0549c135c Mon Sep 17 00:00:00 2001 +From: Thomas Sanders +Date: Tue, 28 Mar 2017 18:57:52 +0100 +Subject: [PATCH 16/15] oxenstored: trim history in the frequent_ops function + +We were trimming the history of commits only at the end of each +transaction (regardless of how it ended). + +Therefore if non-transactional writes were being made but no +transactions were being ended, the history would grow +indefinitely. Now we trim the history at regular intervals. + +Signed-off-by: Thomas Sanders +--- + tools/ocaml/xenstored/history.ml | 6 +++--- + tools/ocaml/xenstored/transaction.ml | 8 ++++++-- + tools/ocaml/xenstored/xenstored.ml | 1 + + 3 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/tools/ocaml/xenstored/history.ml b/tools/ocaml/xenstored/history.ml +index 4079588..f39565b 100644 +--- a/tools/ocaml/xenstored/history.ml ++++ b/tools/ocaml/xenstored/history.ml +@@ -39,7 +39,8 @@ let mark_symbols () = + (* Keep only enough commit-history to protect the running transactions that we are still tracking *) + (* There is scope for optimisation here, replacing List.filter with something more efficient, + * probably on a different list-like structure. *) +-let trim () = ++let trim ?txn () = ++ Transaction.trim_short_running_transactions txn; + history := match Transaction.oldest_short_running_transaction () with + | None -> [] (* We have no open transaction, so no history is needed *) + | Some (_, txn) -> ( +@@ -49,8 +50,7 @@ let trim () = + + let end_transaction txn con tid commit = + let success = Connection.end_transaction con tid commit in +- Transaction.end_transaction txn; +- trim (); ++ trim ~txn (); + success + + let push (x: history_record) = +diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml +index da4a3e3..23e7ccf 100644 +--- a/tools/ocaml/xenstored/transaction.ml ++++ b/tools/ocaml/xenstored/transaction.ml +@@ -106,10 +106,14 @@ let oldest_short_running_transaction () = + | x :: xs -> last xs + in last !short_running_txns + +-let end_transaction txn = ++let trim_short_running_transactions txn = + let cutoff = Unix.gettimeofday () -. !Define.conflict_max_history_seconds in ++ let keep = match txn with ++ | None -> (function (start_time, _) -> start_time >= cutoff) ++ | Some t -> (function (start_time, tx) -> start_time >= cutoff && tx != t) ++ in + short_running_txns := List.filter +- (function (start_time, tx) -> start_time >= cutoff && tx != txn) ++ keep + !short_running_txns + + let make ?(internal=false) id store = +diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml +index 92ea99e..c45146d 100644 +--- a/tools/ocaml/xenstored/xenstored.ml ++++ b/tools/ocaml/xenstored/xenstored.ml +@@ -280,6 +280,7 @@ let _ = + * than the periodic_ops function *) + let frequent_ops () = + if Unix.gettimeofday () > !next_frequent_ops then ( ++ History.trim (); + Domains.incr_conflict_credit domains; + advance_next_frequent_ops () + ) in +-- +1.7.9.5 +