|
|
8be66a |
From 1c8d1c3bbdf8bdfb2ee4f85b9f559f54c6e4cac4 Mon Sep 17 00:00:00 2001
|
|
|
8be66a |
From: Wen Yang <wenyang@linux.alibaba.com>
|
|
|
8be66a |
Date: Wed, 1 Jul 2020 04:45:33 +0800
|
|
|
8be66a |
Subject: [PATCH] mount-setup: fix segfault in mount_cgroup_controllers when
|
|
|
8be66a |
using gcc9 compiler
|
|
|
8be66a |
|
|
|
8be66a |
According to the documentation:
|
|
|
8be66a |
https://gcc.gnu.org/gcc-9/porting_to.html#complit
|
|
|
8be66a |
|
|
|
8be66a |
The 'join_controllers' that relied on the extended lifetime needs
|
|
|
8be66a |
to be fixed, move the compound literals to the function scope it
|
|
|
8be66a |
need to accessible in.
|
|
|
8be66a |
|
|
|
8be66a |
Resolves: #1868877
|
|
|
8be66a |
---
|
|
|
8be66a |
src/core/mount-setup.c | 24 +++++++++++++-----------
|
|
|
8be66a |
1 file changed, 13 insertions(+), 11 deletions(-)
|
|
|
8be66a |
|
|
|
8be66a |
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
|
|
|
8be66a |
index 16880e6157..a6594580e5 100644
|
|
|
8be66a |
--- a/src/core/mount-setup.c
|
|
|
8be66a |
+++ b/src/core/mount-setup.c
|
|
|
8be66a |
@@ -237,20 +237,22 @@ int mount_cgroup_controllers(char ***join_controllers) {
|
|
|
8be66a |
if (!cg_is_legacy_wanted())
|
|
|
8be66a |
return 0;
|
|
|
8be66a |
|
|
|
8be66a |
+ /* The defaults:
|
|
|
8be66a |
+ * mount "cpu" + "cpuacct" together, and "net_cls" + "net_prio".
|
|
|
8be66a |
+ *
|
|
|
8be66a |
+ * We'd like to add "cpuset" to the mix, but "cpuset" doesn't really
|
|
|
8be66a |
+ * work for groups with no initialized attributes.
|
|
|
8be66a |
+ */
|
|
|
8be66a |
+ char ***default_join_controllers = (char**[]) {
|
|
|
8be66a |
+ STRV_MAKE("cpu", "cpuacct"),
|
|
|
8be66a |
+ STRV_MAKE("net_cls", "net_prio"),
|
|
|
8be66a |
+ NULL,
|
|
|
8be66a |
+ };
|
|
|
8be66a |
+
|
|
|
8be66a |
/* Mount all available cgroup controllers that are built into the kernel. */
|
|
|
8be66a |
|
|
|
8be66a |
if (!has_argument)
|
|
|
8be66a |
- /* The defaults:
|
|
|
8be66a |
- * mount "cpu" + "cpuacct" together, and "net_cls" + "net_prio".
|
|
|
8be66a |
- *
|
|
|
8be66a |
- * We'd like to add "cpuset" to the mix, but "cpuset" doesn't really
|
|
|
8be66a |
- * work for groups with no initialized attributes.
|
|
|
8be66a |
- */
|
|
|
8be66a |
- join_controllers = (char**[]) {
|
|
|
8be66a |
- STRV_MAKE("cpu", "cpuacct"),
|
|
|
8be66a |
- STRV_MAKE("net_cls", "net_prio"),
|
|
|
8be66a |
- NULL,
|
|
|
8be66a |
- };
|
|
|
8be66a |
+ join_controllers = default_join_controllers;
|
|
|
8be66a |
|
|
|
8be66a |
r = cg_kernel_controllers(&controllers);
|
|
|
8be66a |
if (r < 0)
|