public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Adrián <adrianbn@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Setreuid distinction about (uid_t)-1
Date: Tue, 17 Jul 2012 12:24:37 -0400	[thread overview]
Message-ID: <20120717162437.GA6049@thunk.org> (raw)
In-Reply-To: <CAFDTedowCyNgBtiPQUPVUv1XocMEhQJfyawjYxEkaXFX5E8H1A@mail.gmail.com>

On Tue, Jul 17, 2012 at 03:13:18PM +0100, Adrián wrote:
> 
> Thanks a lot Athanasius. What I still can't see is why is the -1
> exception there, as I assume that if you want to leave one of the ids
> unchaged you can call:
> 
> setreuid(0,geteuid());
> 
> If you want to leave euid unchanged, right? Is there a need or reason
> to be doing this differentiation in the setreuid code?

Unix systems for multiple decades have done things this way, and it's
ensrined in POSIX and the Single Unix Specification.  Changing it
would potentially open up security holes for programs which expect the
standard-specificed behavior.

(Note, BTW, that decades ago system calls weren't cheap, and CPU's
were much slower, and that may have driven the historical behavior.
Sometimes we get forget how spoiled we are that Linux's system call
overhead is as low as it is...)

					- Ted

  reply	other threads:[~2012-07-17 16:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17  9:27 Setreuid distinction about (uid_t)-1 Adrián
2012-07-17 13:52 ` Athanasius
2012-07-17 14:13   ` Adrián
2012-07-17 16:24     ` Theodore Ts'o [this message]
2012-07-17 16:56       ` Adrián

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=20120717162437.GA6049@thunk.org \
    --to=tytso@mit.edu \
    --cc=adrianbn@gmail.com \
    --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