From: "George Spelvin" <linux@horizon.com>
To: akpm@linux-foundation.org, dan.j.rosenberg@gmail.com,
eldad@fogrefinery.com, jkosina@suse.cz,
linux-kernel@vger.kernel.org, linux@horizon.com,
rmallon@gmail.com
Subject: Re: [PATCH] printk: Check real user/group id for %pK
Date: 29 Sep 2013 19:15:31 -0400 [thread overview]
Message-ID: <20130929231531.12932.qmail@science.horizon.com> (raw)
In-Reply-To: <5248AB37.7000100@gmail.com>
The basic idea is good, but I'm not sure if this is the correct permission
check to use.
After all, a setuid program might also want to give filtered access to
a /proc file with some %pK values.
The fundamental problem is that %pK is using permissions at the time
of the read(), while the general Unix rule that setuid programs expect
is that permission is checked at open() time. pppd is an example; its
options_fom_file() function (pppd/options.c:391 in the 2.4.5 release)
does:
euid = geteuid();
if (check_prot && seteuid(getuid()) == -1) {
option_error("unable to drop privileges to open %s: %m", filename);
return 0;
}
f = fopen(filename, "r");
err = errno;
if (check_prot && seteuid(euid) == -1)
fatal("unable to regain privileges");
Now the whole struct cred and capability system is something I don't
really understand, but it is clear from a brief look at the code
that getting the appropriate credential through the seq_file to
lib/vsprintf.c:pointer() would be tricky.
But it also seems like the Right Thing to do; other fixes seem like
ineffective kludges.
next prev parent reply other threads:[~2013-09-29 23:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-29 22:35 [PATCH] printk: Check real user/group id for %pK Ryan Mallon
2013-09-29 23:15 ` George Spelvin [this message]
2013-09-29 23:26 ` Ryan Mallon
2013-09-29 23:41 ` George Spelvin
2013-09-30 0:41 ` Dan Rosenberg
2013-09-30 0:56 ` Ryan Mallon
2013-09-30 0:59 ` Dan Rosenberg
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=20130929231531.12932.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.rosenberg@gmail.com \
--cc=eldad@fogrefinery.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=rmallon@gmail.com \
/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