lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <b741c2440911012346k7213befcida229606f10c0399@mail.gmail.com>
Date:	Mon, 2 Nov 2009 15:46:57 +0800
From:	Liu Aleaxander <aleaxander@...il.com>
To:	menage@...gle.com, lizf@...fujitsu.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] Fix the 'current css_set' problem in debug subsystem

>From 61c93b1a66e43d44820e9b8d22ef0bec80dfc814 Mon Sep 17 00:00:00 2001
From: Liu Aleaxander <Aleaxander@...il.com>
Date: Mon, 2 Nov 2009 14:30:07 +0800
Subject: [PATCH 2/3] Fix the 'current css_set' problem in debug subsystem

In the current implementation, it always print the same information
no matter which group you are in. And this would be meaningless. So
we should make it print the information of the 'real' current one.

Well, I am not sure it's the current one, but I'm sure it's the first
one of that cgroup.

Signed-off-by: Liu Aleaxander <Aleaxander@...il.com>
---
 include/linux/cgroup.h |    2 --
 kernel/cgroup.c        |   19 ++++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 4d63c5c..0008dee 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -389,8 +389,6 @@ int cgroup_add_files(struct cgroup *cgrp,
             const struct cftype cft[],
             int count);

-struct css_set* cgroup_first_css_set(const struct cgroup *cgrp);
-
 int cgroup_is_removed(const struct cgroup *cgrp);

 int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 863089f..ddd4d33 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -340,7 +340,7 @@ static inline void put_css_set_taskexit(struct css_set *cg)
 /*
  * Get the first css_set of the cgroup 'cgrp'.
  */
-struct css_set* cgroup_first_css_set(const struct cgroup *cgrp)
+static struct css_set* cgroup_first_css_set(const struct cgroup *cgrp)
 {
        struct list_head *head = &cgrp->css_sets;
        struct cg_cgroup_link *link;
@@ -4093,17 +4093,22 @@ static u64 debug_taskcount_read(struct cgroup
*cont, struct cftype *cft)

 static u64 current_css_set_read(struct cgroup *cont, struct cftype *cft)
 {
-    return (u64)(unsigned long)current->cgroups;
+    return (u64)(long)cgroup_first_css_set(cont);
 }

 static u64 current_css_set_refcount_read(struct cgroup *cont,
                        struct cftype *cft)
 {
-    u64 count;
-
-    rcu_read_lock();
-    count = atomic_read(&current->cgroups->refcount);
-    rcu_read_unlock();
+    u64 count = 0;
+    struct css_set *cg;
+
+    cg = cgroup_first_css_set(cont);
+    if (cg) {
+        rcu_read_lock();
+        count = atomic_read(&cg->refcount);
+        rcu_read_unlock();
+    }
+
     return count;
 }

-- 
1.6.2.5



-- 
regards
Liu Aleaxander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ