Skip to contentSkip to conversation

Fix capability.c to work with threaded init

PATCH In review sukadev-r/[email protected] 3 participants 4 messages Aug 3, 2007 2 messages not in the archive Capabilities

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix capability.c to work with threaded init

From: Sukadev Bhattiprolu <sukadev-r/[email protected]>
Subject: [PATCH] Fix capability.c to work with threaded init

Callers of is_container_init() should pass in task->group_leader to ensure they work with threaded-init.

---
 kernel/capability.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/capability.c +1 -1
Index: lx26-23-rc1-mm1/kernel/capability.c
===================================================================
@@ -137,7 +137,7 @@ static inline int cap_set_all(kernel_cap
      int found = 0;
 
      do_each_thread(g, target) {
-             if (target == current || is_container_init(target))
+             if (target == current || is_container_init(target->group_leader))
                      continue;
              found = 1;
 	     if (security_capset_check(target, effective, inheritable,
#3 lore raw
Quoted 8 lines · Dave Hansen
Quoted 3 lines · On Thu, 2007-08-02 at 23:26 -0700, sukadev-r/[email protected].…

Callers of is_container_init() should pass in task->group_leader to ensure they work with threaded-init.

Can you explain this in a little more detail? That's a pretty sparse changelog.

Without this change cap_set_all() skips only the main thread of /sbin/init, but we should skip the entire process as the comment states.

Oleg.

#5 lore raw
In reply to a message not in the archive

Oleg Nesterov [[email protected]] wrote:

| On 08/03, Dave Hansen wrote:
| >
| > On Thu, 2007-08-02 at 23:26 -0700, sukadev-r/[email protected] wrote:
| > > 
| > > Callers of is_container_init() should pass in task->group_leader
| > > to ensure they work with threaded-init.
| > 
| > Can you explain this in a little more detail?  That's a pretty sparse
| > changelog.
|

You are right. The changelog could be better. How about this:

| 
| Without this change cap_set_all() skips only the main thread of /sbin/init,
| but we should skip the entire process as the comment states.
| 
| Oleg.

---

From: Sukadev Bhattiprolu <sukadev-r/[email protected]>
Subject: [PATCH] cap_set_all() must skip all threads of init

When setting capabilities, cap_set_all() must skip all threads of the container_init process - not just the main thread.

---
 kernel/capability.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/capability.c +1 -1
Index: lx26-23-rc1-mm1/kernel/capability.c
===================================================================
@@ -137,7 +137,7 @@ static inline int cap_set_all(kernel_cap
      int found = 0;
 
      do_each_thread(g, target) {
-             if (target == current || is_container_init(target))
+             if (target == current || is_container_init(target->group_leader))
                      continue;
              found = 1;
 	     if (security_capset_check(target, effective, inheritable,