mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Lorenzo Allegrucci <l.allegrucci@tiscalinet.it>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Redundant syscalls?
Date: 15 Feb 2002 18:47:48 +0100	[thread overview]
Message-ID: <p73vgcyr60r.fsf@oldwotan.suse.de> (raw)
In-Reply-To: <02021517152700.01701@odyssey.suse.lists.linux.kernel>
In-Reply-To: Lorenzo Allegrucci's message of "15 Feb 2002 17:31:49 +0100"

Lorenzo Allegrucci <l.allegrucci@tiscalinet.it> writes:

> I was wondering why do we need fsetxattr(2), fgetxattr(2) etc when we 
> already have setxattr(2), getxattr(2) etc working on file names
> instead of file descriptors.
> truncate(2)/ftruncate(2) is another more traditional example.

The f* variant can be race free. For example you want to stat something
first to make sure it is what you expect it to be and not a symlink
to your /etc/passwd. When you use first stat() and then do random
operation on filename with name there is a small window where someone
could replace the name with something else. This could be security relevant.
fd = open(name, ...); fstat(fd, ..); check fsomething(fd, ...); close(fd);
guarantees that you're always working on the same object without any race 
windows.

-Andi

       reply	other threads:[~2002-02-15 17:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <02021517152700.01701@odyssey.suse.lists.linux.kernel>
2002-02-15 17:47 ` Andi Kleen [this message]
2002-02-15 16:24 Lorenzo Allegrucci
2002-02-15 17:00 ` Doug McNaught
2002-02-15 18:17 ` Jesse Pollard

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=p73vgcyr60r.fsf@oldwotan.suse.de \
    --to=ak@suse.de \
    --cc=l.allegrucci@tiscalinet.it \
    --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

all inboxes | Powered by JetHome®