aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/audit.c9
-rw-r--r--kernel/taskstats.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 53e987df0..9b7565b0a 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -588,10 +588,19 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
{
int err = 0;
+ /*
+ * If 'CONFIG_USER_NS' is not defined, current_user_ns()
+ * is already defined as '&init_user_ns'.
+ * In GCC 6 it makes tautological-compare warning.
+ * So just compare when 'CONFIG_USER_NS' is defined.
+ * - jollaman999 -
+ */
+#ifdef CONFIG_USER_NS
/* Only support the initial namespaces for now. */
if ((current_user_ns() != &init_user_ns) ||
(task_active_pid_ns(current) != &init_pid_ns))
return -EPERM;
+#endif
switch (msg_type) {
case AUDIT_LIST:
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 145bb4d3b..1782bd942 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -294,8 +294,10 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
if (!cpumask_subset(mask, cpu_possible_mask))
return -EINVAL;
+#ifdef CONFIG_USER_NS
if (current_user_ns() != &init_user_ns)
return -EINVAL;
+#endif
if (task_active_pid_ns(current) != &init_pid_ns)
return -EINVAL;