linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is CAP_SYS_ADMIN checked by every program !?
@ 2004-12-29  4:47 Tetsuo Handa
  2004-12-30  3:52 ` Walter Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tetsuo Handa @ 2004-12-29  4:47 UTC (permalink / raw)
  To: linux-kernel

  Hello.

I found a strange behavior with kernel 2.6.9 and later. ( I haven't tested for 2.6.8 and earlier. )
It seems to me that every program calls capable(CAP_SYS_ADMIN),
even for programs such as cat(1) sed(1) ls(1).
My environment is Fedora Core 3.

The following is the patch for checking.

----- Start of Patch -----
*** sched.h.org Sat Dec 25 06:33:59 2004
--- sched.h     Wed Dec 29 13:00:53 2004
***************
*** 870,875 ****
--- 870,882 ----
  #else
  static inline int capable(int cap)
  {
+       if (cap == CAP_SYS_ADMIN) {
+               static pid_t last_pid = 0;
+               if (current->pid != last_pid) {
+                       printk("euid=%d uid=%d %s %s\n", current->euid, current->uid, cap_raised(current->cap_effective, CAP_SYS_ADMIN) ? "true" : "fa
lse", current->comm);
+                       last_pid = current->pid;
+               }
+       }
        if (cap_raised(current->cap_effective, cap)) {
                current->flags |= PF_SUPERPRIV;
                return 1;
----- End of Patch -----

Programs run as root always show "true", and run as non-root always show "false",
but it's will be OK.
I can't understand why every program checks for CAP_SYS_ADMIN .
With 2.4.28 and RedHat 9, no such behavior happens.

Is this normal behavior for 2.6 ?



I located .config at http://hp.vector.co.jp/authors/VA022513/tmp/config-2.6.10 .
(By the way, why not prepare ".config file keeper" like pgp.mit.edu ? I think it can save ML traffic. )



Regards.

-------
  Tetsuo Handa

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-01-03 13:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-29  4:47 Is CAP_SYS_ADMIN checked by every program !? Tetsuo Handa
2004-12-30  3:52 ` Walter Liu
2004-12-30  4:45 ` Bernd Eckenfels
2004-12-30  5:35 ` Kyle Moffett
2004-12-30  5:46   ` Valdis.Kletnieks
2004-12-30  6:13     ` Bernd Eckenfels
2004-12-30  7:40   ` Tetsuo Handa
2004-12-30  8:24     ` Bernd Eckenfels
2005-01-03 13:52     ` Stephen Smalley
2004-12-30 13:37 ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).