linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Inconsistent credential checking in prlimit() syscall
@ 2010-11-07  8:04 Michael Kerrisk
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk @ 2010-11-07  8:04 UTC (permalink / raw)
  To: Neil Horman, Jiri Slaby
  Cc: marcin.slusarz, tglx, mingo, hpa, lkml, Andrew Morton,
	James Morris, Heiko Carstens, Michael Kerrisk, Linux API

Hello Neil, Jiri,

I  started documenting the prlimit() system call added in 2.6.36, and
found the permission checks to be rather inconsistent with any other
kernel-userspace API. They are:

CAP_SYS_RESOURCE ||
(c-uid == t-uid && c0uid == t-euid && c-uid == t-suid) &&
(c-gid == t-gid && c-gid == t-guid && c-gid == t-sgid)

(uid == real UID; euid == effective UID; suid == save set-user-ID; and
analogously for GIDs; c- == caller's ID, and t- == target process's
ID)

In other words, for an unprivileged user, all UIDs of the target
process must match the calling process's real UID *and* all GIDs of
the target process must match the calling process's real GID.

What is the reason that the checks for prlimit() aren't similar to say
setpriority(), whose checks are the much simpler, and make no mention
of GIDs:

c-euid == t-uid || c-euid == t-euid

?

Thanks,

Michael

PS see also http://linux-man-pages.blogspot.com/2010/11/system-call-credential-checking-tale-of.html

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-07  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-07  8:04 Inconsistent credential checking in prlimit() syscall Michael Kerrisk

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).