mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: mtk.manpages@googlemail.com
Cc: miklos@szeredi.hu, drepper@redhat.com, viro@zeniv.linux.org.uk,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-man@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] utimensat() non-conformances and fixes [v3]
Date: Fri, 30 May 2008 21:22:30 +0200	[thread overview]
Message-ID: <E1K2ABK-0002ck-UT@pomaz-ex.szeredi.hu> (raw)
In-Reply-To: <cfd18e0f0805301124o5f217dden10726b268d05d81a@mail.gmail.com> (mtk.manpages@googlemail.com)

> >> Here's a further version of the patch, against 2.6.26rc2, with the
> >> 2008-05-19 git changes you sent me applied.  This patch is based on
> >> the draft patch you sent me.  I've tested this version of the patch,
> >> and it works as for all cases except the one mentioned below.  But
> >> note the following points:
> >>
> >> 1) I didn't make use of the code in notify_change() that checks
> >> IS_IMMUTABLE() and IS_APPEND() (i.e., I did not add
> >> ATTR_OWNER_CHECK to the mask in the controlling if statement).
> >> Doing this can't easily be made to work for the
> >> do_futimes() case without reworking the arguments passed to
> >> notify_change().  Actually, I'm inclined to doubt whether it
> >> is a good idea to try to roll that check into notify_change() --
> >> at least for utimensat() it seems simpler to not do so.
> >
> > Ugh...  Could we just omit this part (the if !times and write error
> > then check owner)?  I know it was my idea, but
> >
> >  a) my ideas are often stupid
> >  b) one patch should ideally do just one thing
> >
> > After we fixed the original issue, we can still think about this other
> > thing :)
> 
> Okay, by now quite a bit of my time has been wasted, and my patience
> is starting to get a little thin.

I understand your frustration, but actually I did say this the last
time as well:

  "Sorry, that was just an idea, but since it's not as simple as it
   should be, I guess we should leave that till later.  My main
   objection was against introducing more is_owner_or_cap() checks.
   Just doing the times == NULL case with ATTR_OWNER_CHECK should be
   fine."

Yeah, I may have been more explicit...

> The relevant interfaces here are:
> 
> utimensat()
> futimesat()
> utime()
> utimes()
> futimens() -- because implemented in glibc via utimensat() with path==NULL.
> 
> * utime() and utimes() can't be affected by this point: they don't use
> file descriptors.

OK, you're right.  I've overlooked this point.

So as long as we believe that nobody is using the futime*() interfaces
in the way you described, which is highly probable, then we can fix
that as well.  Which is actually a nice thing, because it means the
permission checking for the times == NULL case can move from both
do_utimes_name() and do_futimes() into utimes_common().

So let's make two patches, and let's forget about the write_error
thing for now:

1)
  - turn UTIME_NOW/UTIME_NOW into times = NULL
  - for times != NULL set ATTR_OWNER_CHECK

2)
  - move times == NULL permission check into utimes_common.

For 2) you can just use permission() instead of vfs_permission() which
is exactly the same in this case (and consolidated into a common
function later in the vfs-cleanups tree).

OK?

Thanks,
Miklos

  reply	other threads:[~2008-05-30 19:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16  8:31 [PATCH] utimensat() non-conformances and fixes -- version 2 Michael Kerrisk
2008-05-16  8:34 ` Michael Kerrisk
2008-05-16 16:59 ` Miklos Szeredi
2008-05-17 19:57   ` Michael Kerrisk
2008-05-19  9:50     ` Miklos Szeredi
2008-05-19 10:12       ` Miklos Szeredi
2008-05-19 12:24       ` Michael Kerrisk
2008-05-19 13:17         ` Miklos Szeredi
2008-05-30 15:34   ` [PATCH] utimensat() non-conformances and fixes [v3] Michael Kerrisk
2008-05-30 16:37     ` Miklos Szeredi
2008-05-30 18:24       ` Michael Kerrisk
2008-05-30 19:22         ` Miklos Szeredi [this message]
2008-05-30 19:32           ` Matthew Wilcox
2008-05-30 20:08             ` Miklos Szeredi
2008-05-30 19:43         ` Michael Kerrisk
2008-05-30 20:17           ` Miklos Szeredi
2008-05-31  5:28             ` Michael Kerrisk
2008-05-30 20:17         ` Andrew Morton
2008-05-31  5:44           ` Michael Kerrisk
2008-06-03 11:05     ` Michael Kerrisk
2008-06-03 11:13       ` Miklos Szeredi
2008-06-03 11:22         ` Al Viro
2008-06-03 11:27           ` Michael Kerrisk
2008-06-03 11:30             ` Jamie Lokier
2008-06-03 11:39               ` Michael Kerrisk
2008-06-03 11:49                 ` Al Viro
2008-06-03 11:58                   ` Al Viro
2008-06-03 12:01                   ` Jamie Lokier
2008-06-03 12:08                     ` Al Viro
2008-06-03 12:10                       ` Jamie Lokier
2008-06-03 12:16           ` Miklos Szeredi
2008-06-03 13:05             ` Al Viro
2008-06-03 11:52         ` Michael Kerrisk

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=E1K2ABK-0002ck-UT@pomaz-ex.szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --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

all inboxes | Powered by JetHome®