From 4d52c65a91433815a6e96662774370494f33e62c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 16:08:43 +0000 Subject: import systemd-239-30.el8_2 --- diff --git a/SOURCES/0343-pid1-fix-the-names-of-AllowedCPUs-and-AllowedMemoryN.patch b/SOURCES/0343-pid1-fix-the-names-of-AllowedCPUs-and-AllowedMemoryN.patch new file mode 100644 index 0000000..3e615dc --- /dev/null +++ b/SOURCES/0343-pid1-fix-the-names-of-AllowedCPUs-and-AllowedMemoryN.patch @@ -0,0 +1,81 @@ +From 061330ee69c102b0acecec6bccacfd7080a8c378 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 24 Nov 2019 14:14:43 +0100 +Subject: [PATCH] pid1: fix the names of AllowedCPUs= and AllowedMemoryNodes= + +The original PR was submitted with CPUSetCpus and CPUSetMems, which was later +changed to AllowedCPUs and AllowedMemmoryNodes everywhere (including the parser +used by systemd-run), but not in the parser for unit files. + +Since we already released -rc1, let's keep support for the old names. I think +we can remove it in a release or two if anyone remembers to do that. + +Fixes #14126. Follow-up for 047f5d63d7a1ab75073f8485e2f9b550d25b0772. + +(cherry picked from commit 0b8d3075872a05e0449906d24421ce192f50c29f) + +Related: #1824129 +--- + src/core/load-fragment-gperf.gperf.m4 | 4 ++-- + src/core/load-fragment.c | 4 ++-- + src/core/load-fragment.h | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 +index ebb44df487..161c5a2c82 100644 +--- a/src/core/load-fragment-gperf.gperf.m4 ++++ b/src/core/load-fragment-gperf.gperf.m4 +@@ -161,14 +161,14 @@ $1.KillSignal, config_parse_signal, 0, + )m4_dnl + m4_define(`CGROUP_CONTEXT_CONFIG_ITEMS', + `$1.Slice, config_parse_unit_slice, 0, 0 ++$1.AllowedCPUs, config_parse_allowed_cpus, 0, offsetof($1, cgroup_context) ++$1.AllowedMemoryNodes, config_parse_allowed_mems, 0, offsetof($1, cgroup_context) + $1.CPUAccounting, config_parse_bool, 0, offsetof($1, cgroup_context.cpu_accounting) + $1.CPUWeight, config_parse_cg_weight, 0, offsetof($1, cgroup_context.cpu_weight) + $1.StartupCPUWeight, config_parse_cg_weight, 0, offsetof($1, cgroup_context.startup_cpu_weight) + $1.CPUShares, config_parse_cpu_shares, 0, offsetof($1, cgroup_context.cpu_shares) + $1.StartupCPUShares, config_parse_cpu_shares, 0, offsetof($1, cgroup_context.startup_cpu_shares) + $1.CPUQuota, config_parse_cpu_quota, 0, offsetof($1, cgroup_context) +-$1.CPUSetCpus, config_parse_cpuset_cpus, 0, offsetof($1, cgroup_context) +-$1.CPUSetMems, config_parse_cpuset_mems, 0, offsetof($1, cgroup_context) + $1.MemoryAccounting, config_parse_bool, 0, offsetof($1, cgroup_context.memory_accounting) + $1.MemoryLow, config_parse_memory_limit, 0, offsetof($1, cgroup_context) + $1.MemoryHigh, config_parse_memory_limit, 0, offsetof($1, cgroup_context) +diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c +index 6debf82401..2082166afb 100644 +--- a/src/core/load-fragment.c ++++ b/src/core/load-fragment.c +@@ -3011,7 +3011,7 @@ int config_parse_cpu_quota( + return 0; + } + +-int config_parse_cpuset_cpus( ++int config_parse_allowed_cpus( + const char *unit, + const char *filename, + unsigned line, +@@ -3030,7 +3030,7 @@ int config_parse_cpuset_cpus( + return 0; + } + +-int config_parse_cpuset_mems( ++int config_parse_allowed_mems( + const char *unit, + const char *filename, + unsigned line, +diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h +index 6612e1fb32..424fa478a7 100644 +--- a/src/core/load-fragment.h ++++ b/src/core/load-fragment.h +@@ -86,8 +86,8 @@ CONFIG_PARSER_PROTOTYPE(config_parse_set_status); + CONFIG_PARSER_PROTOTYPE(config_parse_namespace_path_strv); + CONFIG_PARSER_PROTOTYPE(config_parse_temporary_filesystems); + CONFIG_PARSER_PROTOTYPE(config_parse_cpu_quota); +-CONFIG_PARSER_PROTOTYPE(config_parse_cpuset_cpus); +-CONFIG_PARSER_PROTOTYPE(config_parse_cpuset_mems); ++CONFIG_PARSER_PROTOTYPE(config_parse_allowed_cpus); ++CONFIG_PARSER_PROTOTYPE(config_parse_allowed_mems); + CONFIG_PARSER_PROTOTYPE(config_parse_protect_home); + CONFIG_PARSER_PROTOTYPE(config_parse_protect_system); + CONFIG_PARSER_PROTOTYPE(config_parse_bus_name); diff --git a/SOURCES/0344-core-fix-re-realization-of-cgroup-siblings.patch b/SOURCES/0344-core-fix-re-realization-of-cgroup-siblings.patch new file mode 100644 index 0000000..3293ea8 --- /dev/null +++ b/SOURCES/0344-core-fix-re-realization-of-cgroup-siblings.patch @@ -0,0 +1,62 @@ +From 88e03493cc361628315cd4c948a6bfd01f1d3a45 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 9 Jan 2020 17:30:31 +0100 +Subject: [PATCH] core: fix re-realization of cgroup siblings + +This is a fix-up for eef85c4a3f8054d29383a176f6cebd1ef3a15b9a which +broke this. + +Tracked down by @w-simon + +Fixes: #14453 +(cherry picked from commit 65f6b6bdcb500c576674b5838e4cc4c35e18bfde) + +Related: #1824129 +--- + src/core/cgroup.c | 21 +++++++-------------- + 1 file changed, 7 insertions(+), 14 deletions(-) + +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 664d269483..3f7665b755 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -1796,32 +1796,25 @@ unsigned manager_dispatch_cgroup_realize_queue(Manager *m) { + static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { + Unit *slice; + +- /* This adds the siblings of the specified unit and the +- * siblings of all parent units to the cgroup queue. (But +- * neither the specified unit itself nor the parents.) */ ++ /* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup ++ * queue. (But neither the specified unit itself nor the parents.) */ + + while ((slice = UNIT_DEREF(u->slice))) { + Iterator i; + Unit *m; + void *v; + +- HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) { +- if (m == u) +- continue; +- +- /* Skip units that have a dependency on the slice +- * but aren't actually in it. */ ++ HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) { ++ /* Skip units that have a dependency on the slice but aren't actually in it. */ + if (UNIT_DEREF(m->slice) != slice) + continue; + +- /* No point in doing cgroup application for units +- * without active processes. */ ++ /* No point in doing cgroup application for units without active processes. */ + if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m))) + continue; + +- /* If the unit doesn't need any new controllers +- * and has current ones realized, it doesn't need +- * any changes. */ ++ /* If the unit doesn't need any new controllers and has current ones realized, it ++ * doesn't need any changes. */ + if (unit_has_mask_realized(m, + unit_get_target_mask(m), + unit_get_enable_mask(m), diff --git a/SOURCES/0345-basic-use-comma-as-separator-in-cpuset-cgroup-cpu-ra.patch b/SOURCES/0345-basic-use-comma-as-separator-in-cpuset-cgroup-cpu-ra.patch new file mode 100644 index 0000000..17ea6d3 --- /dev/null +++ b/SOURCES/0345-basic-use-comma-as-separator-in-cpuset-cgroup-cpu-ra.patch @@ -0,0 +1,99 @@ +From 77e4fe56bc4fdebb629e5250c113aa1750b0d0a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= +Date: Tue, 14 Apr 2020 16:16:45 +0200 +Subject: [PATCH] basic: use comma as separator in cpuset cgroup cpu ranges + +This is a workaround for +https://bugzilla.redhat.com/show_bug.cgi?id=1819152 and should be +reverted in RHEL-8.3. + +RHEL-only + +Related: #1824129 +--- + src/basic/cpu-set-util.c | 45 ++++++++++++++++++++++++++++++++++++++++ + src/basic/cpu-set-util.h | 1 + + src/core/cgroup.c | 2 +- + 3 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/src/basic/cpu-set-util.c b/src/basic/cpu-set-util.c +index 36cb017ae7..51752ad1a6 100644 +--- a/src/basic/cpu-set-util.c ++++ b/src/basic/cpu-set-util.c +@@ -86,6 +86,51 @@ char *cpu_set_to_range_string(const CPUSet *set) { + return TAKE_PTR(str) ?: strdup(""); + } + ++/* XXX(msekleta): this is the workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1819152, remove in 8.3 */ ++char *cpu_set_to_range_string_kernel(const CPUSet *set) { ++ unsigned range_start = 0, range_end; ++ _cleanup_free_ char *str = NULL; ++ size_t allocated = 0, len = 0; ++ bool in_range = false; ++ int r; ++ ++ for (unsigned i = 0; i < set->allocated * 8; i++) ++ if (CPU_ISSET_S(i, set->allocated, set->set)) { ++ if (in_range) ++ range_end++; ++ else { ++ range_start = range_end = i; ++ in_range = true; ++ } ++ } else if (in_range) { ++ in_range = false; ++ ++ if (!GREEDY_REALLOC(str, allocated, len + 2 + 2 * DECIMAL_STR_MAX(unsigned))) ++ return NULL; ++ ++ if (range_end > range_start) ++ r = sprintf(str + len, len > 0 ? ",%d-%d" : "%d-%d", range_start, range_end); ++ else ++ r = sprintf(str + len, len > 0 ? ",%d" : "%d", range_start); ++ assert_se(r > 0); ++ len += r; ++ } ++ ++ if (in_range) { ++ if (!GREEDY_REALLOC(str, allocated, len + 2 + 2 * DECIMAL_STR_MAX(int))) ++ return NULL; ++ ++ if (range_end > range_start) ++ r = sprintf(str + len, len > 0 ? ",%d-%d" : "%d-%d", range_start, range_end); ++ else ++ r = sprintf(str + len, len > 0 ? ",%d" : "%d", range_start); ++ assert_se(r > 0); ++ } ++ ++ return TAKE_PTR(str) ?: strdup(""); ++} ++ ++ + int cpu_set_realloc(CPUSet *cpu_set, unsigned ncpus) { + size_t need; + +diff --git a/src/basic/cpu-set-util.h b/src/basic/cpu-set-util.h +index 295028cb54..8519a9b6c8 100644 +--- a/src/basic/cpu-set-util.h ++++ b/src/basic/cpu-set-util.h +@@ -27,6 +27,7 @@ int cpu_set_add_all(CPUSet *a, const CPUSet *b); + + char* cpu_set_to_string(const CPUSet *a); + char *cpu_set_to_range_string(const CPUSet *a); ++char *cpu_set_to_range_string_kernel(const CPUSet *a); + int cpu_set_realloc(CPUSet *cpu_set, unsigned ncpus); + + int parse_cpu_set_full( +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 3f7665b755..9e4c3c7dac 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -557,7 +557,7 @@ static void cgroup_apply_unified_cpuset(Unit *u, CPUSet cpus, const char *name) + _cleanup_free_ char *buf = NULL; + int r; + +- buf = cpu_set_to_range_string(&cpus); ++ buf = cpu_set_to_range_string_kernel(&cpus); + if (!buf) + return; + diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index 1c03e7a..4da596e 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -13,7 +13,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 239 -Release: 29%{?dist} +Release: 30%{?dist} # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -392,6 +392,9 @@ Patch0339: 0339-test-add-a-simple-sanity-check-for-systems-without-N.patch Patch0340: 0340-test-drop-the-missed-exit-1-expression.patch Patch0341: 0341-test-replace-cursor-file-with-a-plain-cursor.patch Patch0342: 0342-cryptsetup-Treat-key-file-errors-as-a-failed-passwor.patch +Patch0343: 0343-pid1-fix-the-names-of-AllowedCPUs-and-AllowedMemoryN.patch +Patch0344: 0344-core-fix-re-realization-of-cgroup-siblings.patch +Patch0345: 0345-basic-use-comma-as-separator-in-cpuset-cgroup-cpu-ra.patch %ifarch %{ix86} x86_64 aarch64 @@ -1016,6 +1019,11 @@ fi %files tests -f .file-list-tests %changelog +* Wed Apr 15 2020 systemd maintenance team - 239-30 +- pid1: fix the names of AllowedCPUs= and AllowedMemoryNodes= (#1824129) +- core: fix re-realization of cgroup siblings (#1824129) +- basic: use comma as separator in cpuset cgroup cpu ranges (#1824129) + * Mon Mar 23 2020 systemd maintenance team - 239-29 - cryptsetup: Treat key file errors as a failed password attempt (#1763155)