linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: "Pekka Enberg" <penberg@cs.helsinki.fi>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"Chase Venters" <chase.venters@clientec.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	akpm@osdl.org, viro@zeniv.linux.org.uk, tytso@mit.edu,
	tigran@veritas.com
Subject: Re: [RFC/PATCH] revoke/frevoke system calls V2
Date: Wed, 9 Aug 2006 23:29:39 +0200	[thread overview]
Message-ID: <20060809232939.13f1f8e9.froese@gmx.de> (raw)
In-Reply-To: <84144f020608091213u4bbb1d07xe8486a4549208016@mail.gmail.com>

Pekka Enberg wrote:
>
> I'll put them on my todo and in the meanwhile, you can find the latest
> patches here:
>   http://www.kernel.org/pub/linux/kernel/people/penberg/patches/revoke/
> 
> Thanks for taking the time to review the patch!

+		err = close_files(this);
+
+		put_task_struct(this->owner);
+		if (err)
+			break;
+	}
+	if (err)
+		restore_files(&to_cleanup[i], nr_fds-i);

I think, the error path is wrong as it tries to restore "this"
which means the now invalid filp (close always closes, even in
case of errors) is put back into the fd-table; and, the task
struct is put twice.  I think, you should ignore errors on close.
(But I guess, this part of revoke gets rewritten anyway to match
BSD behaviour.)  I wonder, if revoke should really abort when
there's an error from one fd or better continue and try its best.

restore_files:
+			spin_lock(&files->file_lock);
+			fdt = files_fdtable(files);
+			rcu_assign_pointer(fdt->fd[this->fd], this->file);
+			FD_SET(this->fd, fdt->close_on_exec);
+			spin_unlock(&files->file_lock);
+			put_files_struct(files);
+		}
+
+		put_task_struct(this->owner);

This sets close_on_exec unconditionally, even if it wasn't set
before.  Hm..., if a cloned thread is able to exec, it seems a
little bit dangerous to restore the fd-table with filps that
were valid some time ago - the fd-table may have changed in the
meantime...  But maybe I simply missed something...

Ciao, ET.

  parent reply	other threads:[~2006-08-09 21:29 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 14:25 [RFC/PATCH] revoke/frevoke system calls V2 Pekka J Enberg
2006-07-27 15:07 ` Alan Cox
2006-07-27 15:33   ` Pekka Enberg
2006-07-27 16:09     ` Alan Cox
2006-07-27 16:01       ` Pekka J Enberg
2006-07-27 16:30         ` Alan Cox
2006-07-27 17:07           ` Pekka J Enberg
2006-07-27 18:27           ` Pekka Enberg
2006-07-27 16:41 ` Ulrich Drepper
2006-07-27 17:05   ` Pekka J Enberg
2006-07-27 17:13     ` Ulrich Drepper
2006-07-27 17:33       ` H. Peter Anvin
2006-07-27 17:44         ` Ulrich Drepper
2006-07-27 18:00           ` H. Peter Anvin
2006-07-27 17:33     ` Alan Cox
2006-07-27 17:33       ` O_CAREFUL flag to disable open() side effects H. Peter Anvin
2006-07-27 17:43         ` Russell King
2006-07-27 17:50         ` Ulrich Drepper
2006-07-27 18:05         ` Alan Cox
2006-07-27 18:03           ` H. Peter Anvin
2006-08-05 21:05       ` [RFC/PATCH] revoke/frevoke system calls V2 Pavel Machek
2006-07-27 18:06 ` Petr Baudis
2006-07-27 18:10   ` Pekka Enberg
2006-07-27 19:30     ` Horst H. von Brand
2006-07-28  3:40       ` Pekka J Enberg
2006-07-27 18:34   ` Alan Cox
2006-08-05 12:29 ` Pavel Machek
2006-08-07  5:42   ` Pekka J Enberg
2006-08-07  8:17   ` Edgar Toernig
2006-08-07  9:51     ` Pekka Enberg
2006-08-07 20:41       ` Edgar Toernig
2006-08-07 22:24         ` Chase Venters
2006-08-08 12:15           ` Alan Cox
2006-08-09  8:41             ` Edgar Toernig
2006-08-09 10:39               ` Alan Cox
2006-08-09 18:00                 ` Edgar Toernig
2006-08-09 18:36                   ` Alan Cox
2006-08-09 19:13                     ` Pekka Enberg
2006-08-09 20:08                       ` Edgar Toernig
2006-08-09 21:29                       ` Edgar Toernig [this message]
2006-08-11  7:52                   ` Helge Hafting
2006-08-08 12:29         ` Alan Cox
2006-08-08 12:31           ` Pekka Enberg
2006-08-08 12:57           ` Pavel Machek
2006-08-08 14:14             ` Alan Cox
2006-08-08 13:57               ` Pavel Machek
2006-08-09  8:41           ` Edgar Toernig
2006-08-09 10:42             ` Alan Cox
2006-08-09 18:00               ` Edgar Toernig
2006-08-09 18:35                 ` Alan Cox
2006-08-09 19:14                   ` Pekka Enberg

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=20060809232939.13f1f8e9.froese@gmx.de \
    --to=froese@gmx.de \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=chase.venters@clientec.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=penberg@cs.helsinki.fi \
    --cc=tigran@veritas.com \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).