From: Walter Liu <Walter.liu@126.com>
To: Tetsuo Handa <from-linux-kernel@i-love.sakura.ne.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Is CAP_SYS_ADMIN checked by every program !?
Date: Thu, 30 Dec 2004 11:52:27 +0800 [thread overview]
Message-ID: <41D37B7B.2010400@126.com> (raw)
In-Reply-To: <200412291347.JEH41956.OOtStPFFNMLJVGMYS@i-love.sakura.ne.jp>
Tetsuo Handa wrote:
> 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 ?
>
>
>
The POSIX capability mechanism is the OS privilege mechanism ,
like the privilege mechanism in VMS or NT .
I think that every process for any capability have to check them,
This is a must operation..
Regards
LWT
next prev parent reply other threads:[~2004-12-30 3:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-29 4:47 Is CAP_SYS_ADMIN checked by every program !? Tetsuo Handa
2004-12-30 3:52 ` Walter Liu [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41D37B7B.2010400@126.com \
--to=walter.liu@126.com \
--cc=from-linux-kernel@i-love.sakura.ne.jp \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox