From: Chris Wright <chris@wirex.com>
To: carbonated beverage <ramune@net-ronin.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: capable open_port() check wrong for kmem
Date: Wed, 11 Dec 2002 16:43:48 -0800 [thread overview]
Message-ID: <20021211164348.A26790@figure1.int.wirex.com> (raw)
In-Reply-To: <20021210065159.GB17928@net-ronin.org>; from ramune@net-ronin.org on Mon, Dec 09, 2002 at 10:51:59PM -0800
* carbonated beverage (ramune@net-ronin.org) wrote:
>
> It's rather annoying and counter-intuitive to have:
>
> crw-r----- 1 root kmem 1, 2 Sep 8 21:56 /dev/kmem
>
> but to have the following code fragment give:
>
> int fd;
> fd = open("/dev/kmem", O_RDONLY);
> if(fd == -1) {
> fprintf(stderr, "Can't open /dev/kmem: %s\n", strerror(errno));
> exit(EXIT_FAILURE);
> }
>
> Can't open /dev/kmem: Operation not permitted
>
> with a user in the kmem group.
>
> Also, the utility I'm writing doesn't need write access, so why give it to
> the process in the first place?
Then open O_RDONLY (with CAP_SYS_RAWIO). Then the utility won't have
write access. If that's all you are worried about.
or.
If you have only one capability (CAP_SYS_RAWIO), you are not owner of
/dev/kmem, you are in group kmem, and /dev/kmem is 0640, then all you will
get is read-only access to /dev/kmem. This does not require kernel changes.
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
next prev parent reply other threads:[~2002-12-12 0:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-10 3:22 capable open_port() check wrong for kmem carbonated beverage
2002-12-10 5:45 ` David Wagner
2002-12-10 6:27 ` David Schwartz
[not found] ` <20021210064134.GA17928@net-ronin.org>
2002-12-10 6:51 ` carbonated beverage
2002-12-12 0:43 ` Chris Wright [this message]
2002-12-12 1:38 ` carbonated beverage
2002-12-12 2:11 ` Chris Wright
2002-12-10 11:33 ` Olaf Dietsche
2002-12-11 22:38 ` carbonated beverage
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=20021211164348.A26790@figure1.int.wirex.com \
--to=chris@wirex.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ramune@net-ronin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.