Skip to contentSkip to conversation

cap_bound: should to TBROK if f != CAP_SET in exec_without_inh.c

PATCH In review Shi Weihua 3 participants 5 messages Feb 8, 2010 – Feb 9, 2010

lore
Share & tools
lore

Shi Weihua

author
#0 lore raw

PATCH 1/1 cap_bound: should to TBROK if f != CAP_SET in exec_without_inh.c

An error occured on my i386 box.
(OS: Fedora8, Kernel: 2.6.33-rc6, libcap: libcap-2.16)
-------------

exec_without_inh    1  TFAIL  :  Failed to drop CAP_SYS_ADMIN from bounding set.
exec_without_inh    0  TINFO  :  (ret=-1, errno 38)

-------------
If the macro HAVE_DECL_CAP_BSET_DROP is 0, this error will occurs. But the program should to be broken when f != CAP_SET, like the similar code "if (ret || f != CAP_SET) {" in exec_with_inh.c.

The TBROK message will be outputted if my patch merged.
-------------
exec_without_inh 1 TBROK : Failed to add CAP_SYS_ADMIN to pI
-------------

---

kernel/security/cap_bound/exec_without_inh.c renamed from kernel/security/cap_bound/exec_without_inh.c.orig +5 -0
@@ -80,6 +80,11 @@ int main(int argc, char *argv[])
 			tst_exit();
 		}
 	}
+	else if (ret) {
+		tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
+		tst_exit();
+	}
+
 #if HAVE_DECL_CAP_FREE
 	cap_free(cur);
 #endif

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Shi Weihua

An error occured on my i386 box.
(OS: Fedora8, Kernel: 2.6.33-rc6, libcap: libcap-2.16)
-------------

exec_without_inh    1  TFAIL  :  Failed to drop CAP_SYS_ADMIN from bounding set.
exec_without_inh    0  TINFO  :  (ret=-1, errno 38)
Quoted 9 lines

-------------
If the macro HAVE_DECL_CAP_BSET_DROP is 0, this error will occurs. But the program should to be broken when f != CAP_SET, like the similar code "if (ret || f != CAP_SET) {" in exec_with_inh.c.

The TBROK message will be outputted if my patch merged.
-------------
exec_without_inh 1 TBROK : Failed to add CAP_SYS_ADMIN to pI

Looks good. I will include if others are not having any comment.

Thanks
Rishi

Quoted 21 lines

-------------

---

kernel/security/cap_bound/exec_without_inh.c renamed from kernel/security/cap_bound/exec_without_inh.c.orig +5 -1
@@ -80,6 +80,11 @@ int main(int argc, char *argv[])
  			tst_exit();
  		}
  	}
+	else if (ret) {
+		tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
+		tst_exit();
+	}
+
  #if HAVE_DECL_CAP_FREE
  	cap_free(cur);
  #endif
 
------------------------------------------------------------------------------

The Planet: dedicated and managed hosting, cloud storage, colocation

Quoted 9 lines

Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 24 lines · Rishikesh
Quoted 10 lines · Shi Weihua

An error occured on my i386 box.
  (OS: Fedora8, Kernel: 2.6.33-rc6, libcap: libcap-2.16)
-------------
exec_without_inh    1  TFAIL  :  Failed to drop CAP_SYS_ADMIN from bounding set. exec_without_inh    0  TINFO  :  (ret=-1, errno 38)
-------------
If the macro HAVE_DECL_CAP_BSET_DROP is 0, this error will occurs. But the program should to be broken when f != CAP_SET, like the similar code "if (ret || f != CAP_SET) {" in exec_with_inh.c.

Quoted 4 lines

The TBROK message will be outputted if my patch merged.
-------------
exec_without_inh    1  TBROK  :  Failed to add CAP_SYS_ADMIN to pI

Looks good. I will include if others are not having any comment.

Thanks
Rishi

Quoted 2 lines

-------------

Quoted 16 lines
Quoted 6 lines

---

kernel/security/cap_bound/exec_without_inh.c    2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig       2010-02-08 11:54:22.000000000 -0500 +0 -0
@@ -80,6 +80,11 @@ int main(int argc, char *argv[])
                       tst_exit();

kernel/security/cap_bound/exec_without_inh.c    2010-02-08 11:55:00.000000000 -0500 int main(int argc, char *argv[]) · line 90

Quoted 10 lines
kernel/security/cap_bound/exec_without_inh.c    2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig       2010-02-08 11:54:22.000000000 -0500 +5 -0
               }
       }
+     else if (ret) {
+             tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
+             tst_exit();
+     }
+
   #if HAVE_DECL_CAP_FREE
       cap_free(cur);
   #endif

Wow -- I really made a mess of that test a few months back... please do...

else if (ret) {
tst_brkm(TBROK | TERRNO, tst_exit, "Failed to add

CAP_SYS_ADMIN to pI");
       }

... instead.
Thanks for catching that one failure point ;)...!
-Garrett

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#3 lore raw
Quoted 44 lines · Garrett Cooper
Quoted 24 lines · Rishikesh
Quoted 5 lines · Shi Weihua

An error occured on my i386 box.
(OS: Fedora8, Kernel: 2.6.33-rc6, libcap: libcap-2.16)
-------------

exec_without_inh    1  TFAIL  :  Failed to drop CAP_SYS_ADMIN from bounding set.
exec_without_inh    0  TINFO  :  (ret=-1, errno 38)
Quoted 9 lines

-------------
If the macro HAVE_DECL_CAP_BSET_DROP is 0, this error will occurs. But the program should to be broken when f != CAP_SET, like the similar code "if (ret || f != CAP_SET) {" in exec_with_inh.c.

The TBROK message will be outputted if my patch merged.
-------------
exec_without_inh 1 TBROK : Failed to add CAP_SYS_ADMIN to pI

Looks good. I will include if others are not having any comment.

Thanks
Rishi

Quoted 2 lines

-------------

Quoted 16 lines
Quoted 6 lines

---

kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig 2010-02-08 11:54:22.000000000 -0500 +0 -0
@@ -80,6 +80,11 @@ int main(int argc, char *argv[])
                      tst_exit();

kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 int main(int argc, char *argv[]) · line 90

Quoted 10 lines
kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig 2010-02-08 11:54:22.000000000 -0500 +5 -0
              }
      }
+     else if (ret) {
+             tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
+             tst_exit();
+     }
+
  #if HAVE_DECL_CAP_FREE
      cap_free(cur);
  #endif

Wow -- I really made a mess of that test a few months back... please do...

Quoted 6 lines

else if (ret) {
tst_brkm(TBROK | TERRNO, tst_exit, "Failed to add

CAP_SYS_ADMIN to pI");
       }

... instead.

ok. I fixed it based on your advice.

---

kernel/security/cap_bound/exec_without_inh.c renamed from kernel/security/cap_bound/exec_without_inh.c.orig +4 -0
@@ -80,6 +80,10 @@ int main(int argc, char *argv[])
 			tst_exit();
 		}
 	}
+	else if (ret) {
+		tst_brkm(TBROK | TERRNO, tst_exit, "Failed to add \
+			CAP_SYS_ADMIN to pI");
+	}
 #if HAVE_DECL_CAP_FREE
 	cap_free(cur);
 #endif
Quoted 4 lines

Thanks for catching that one failure point ;)...!
-Garrett

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 70 lines · Shi Weihua
Quoted 44 lines · Garrett Cooper
Quoted 24 lines · Rishikesh
Quoted 5 lines · Shi Weihua

An error occured on my i386 box.
(OS: Fedora8, Kernel: 2.6.33-rc6, libcap: libcap-2.16)
-------------

exec_without_inh    1  TFAIL  :  Failed to drop CAP_SYS_ADMIN from bounding set.
exec_without_inh    0  TINFO  :  (ret=-1, errno 38)
Quoted 9 lines

-------------
If the macro HAVE_DECL_CAP_BSET_DROP is 0, this error will occurs. But the program should to be broken when f != CAP_SET, like the similar code "if (ret || f != CAP_SET) {" in exec_with_inh.c.

The TBROK message will be outputted if my patch merged.
-------------
exec_without_inh 1 TBROK : Failed to add CAP_SYS_ADMIN to pI

Looks good. I will include if others are not having any comment.

Thanks
Rishi

Quoted 2 lines

-------------

Quoted 16 lines
Quoted 6 lines

---

kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig 2010-02-08 11:54:22.000000000 -0500 +0 -0
@@ -80,6 +80,11 @@ int main(int argc, char *argv[])
                     tst_exit();

kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 int main(int argc, char *argv[]) · line 90

Quoted 10 lines
kernel/security/cap_bound/exec_without_inh.c 2010-02-08 11:55:00.000000000 -0500 renamed from kernel/security/cap_bound/exec_without_inh.c.orig 2010-02-08 11:54:22.000000000 -0500 +5 -0
             }
     }
+     else if (ret) {
+             tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
+             tst_exit();
+     }
+
 #if HAVE_DECL_CAP_FREE
     cap_free(cur);
 #endif

Wow -- I really made a mess of that test a few months back... please do...

Quoted 6 lines

else if (ret) {
tst_brkm(TBROK | TERRNO, tst_exit, "Failed to add

CAP_SYS_ADMIN to pI");
      }

... instead.

ok. I fixed it based on your advice.

---

kernel/security/cap_bound/exec_without_inh.c renamed from kernel/security/cap_bound/exec_without_inh.c.orig +4 -0
@@ -80,6 +80,10 @@ int main(int argc, char *argv[])
 			tst_exit();
 		}
 	}
+	else if (ret) {
+		tst_brkm(TBROK | TERRNO, tst_exit, "Failed to add \
+			CAP_SYS_ADMIN to pI");
+	}
 #if HAVE_DECL_CAP_FREE
 	cap_free(cur);
 #endif
Quoted 2 lines
Quoted 2 lines

Thanks for catching that one failure point ;)...!
-Garrett

Committed -- thanks!
-Garrett
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list