* utimes() with vfat is problematic
@ 2007-07-10 9:47 Jan Engelhardt
2007-07-10 10:18 ` Pawel Dziepak
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-07-10 9:47 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Linux Kernel Mailing List, hirofumi
Hi,
vfat does not know about ownership, hence the files are always owned by the
vfat mounter (or whatever the uid= option specified). Which brings
a problem to userspace programs trying to utime() but which do not
run as the same user as the vfat mounter, because:
fs/attr.c:53
ret = -EPERM;
[...]
/* Check for setting the inode time. */
if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
goto error;
}
To trigger the problem:
# mount /somevfat -o umask=0,uid=root
$ touch -d "2005-05-05" /somevfat/myfile
I am not sure how this could be dealt with besides passing -o quiet to
mount.vfat. Any ideas?
Jan
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: utimes() with vfat is problematic
2007-07-10 9:47 utimes() with vfat is problematic Jan Engelhardt
@ 2007-07-10 10:18 ` Pawel Dziepak
2007-07-10 16:38 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Pawel Dziepak @ 2007-07-10 10:18 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-fsdevel, Linux Kernel Mailing List, hirofumi
2007/7/10, Jan Engelhardt <jengelh@computergmbh.de>:
> I am not sure how this could be dealt with besides passing -o quiet to
> mount.vfat. Any ideas?
The problem is in the function utimes. I have mounted vfat partition
as a root, then changed permissions to 777 for all files. However, I
wasn't be able to touch any file (changing date to the past) as a
normal user. utimes() should check write permission instead of uid/
I didn't read 'touch' source code and it is probably caused by it's
procedures that I was able to change modification date to the current
date.
Single UNIX Specification says crealy that to do utimes on a file user
have to had write permissions or be a file owner.
Pawel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: utimes() with vfat is problematic
2007-07-10 10:18 ` Pawel Dziepak
@ 2007-07-10 16:38 ` Jan Engelhardt
2007-07-10 16:54 ` Pawel Dziepak
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-07-10 16:38 UTC (permalink / raw)
To: Pawel Dziepak; +Cc: linux-fsdevel, Linux Kernel Mailing List, hirofumi
On Jul 10 2007 12:18, Pawel Dziepak wrote:
>
> Single UNIX Specification says crealy that to do utimes on a file user
> have to had write permissions or be a file owner.
Linux does check for write permission, but _only_ for time=NULL.
Hence it would be helpful if someone knows the exact SUS text,
or whether this is not explicitly specified in SUS, leaving room
for interpretation.
Jan
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: utimes() with vfat is problematic
2007-07-10 16:38 ` Jan Engelhardt
@ 2007-07-10 16:54 ` Pawel Dziepak
0 siblings, 0 replies; 5+ messages in thread
From: Pawel Dziepak @ 2007-07-10 16:54 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-fsdevel, Linux Kernel Mailing List, hirofumi
On 7/10/07, Jan Engelhardt <jengelh@computergmbh.de> wrote:
> Linux does check for write permission, but _only_ for time=NULL.
> Hence it would be helpful if someone knows the exact SUS text,
> or whether this is not explicitly specified in SUS, leaving room
> for interpretation.
I have already checked it strictly. This "problem" occurs not only on
vfat partitions. You can *not* do uptime() for time!=NULL if you are
not a file owner. So, everything in Linux is correct.
It is not possible to solve your problem without changing SUS, it is
not even a problem...
I made mistake in my first post, because I was too implied by piece of
code that you've quoted.
Pawel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: utimes() with vfat is problematic
[not found] <8Fkwa-6BT-29@gated-at.bofh.it>
@ 2007-07-11 11:49 ` Bodo Eggert
0 siblings, 0 replies; 5+ messages in thread
From: Bodo Eggert @ 2007-07-11 11:49 UTC (permalink / raw)
To: Jan Engelhardt, Linux Kernel Mailing List, hirofumi,
linux-fsdevel
Jan Engelhardt <jengelh@computergmbh.de> wrote:
> vfat does not know about ownership, hence the files are always owned by the
> vfat mounter (or whatever the uid= option specified). Which brings
> a problem to userspace programs trying to utime() but which do not
> run as the same user as the vfat mounter, because:
>
>
> fs/attr.c:53
> ret = -EPERM;
> [...]
>
> /* Check for setting the inode time. */
> if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
> if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
> goto error;
> }
>
>
> To trigger the problem:
> # mount /somevfat -o umask=0,uid=root
> $ touch -d "2005-05-05" /somevfat/myfile
>
> I am not sure how this could be dealt with besides passing -o quiet to
> mount.vfat. Any ideas?
Would it be possible to allow any user to modify the fs by adding
"&& current->fsuid != -1"? I think it's commonly the desired behaviour.
Off cause the default behaviour should stay the same.
--
Those who hesitate under fire usually do not end up KIA or WIA.
Friß, Spammer: pof@7o.7eggert.dyndns.org jhojzbk@I.7eggert.dyndns.org
ysoMi@qRIeghz.7eggert.dyndns.org a-r@s.7eggert.dyndns.org
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-11 11:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 9:47 utimes() with vfat is problematic Jan Engelhardt
2007-07-10 10:18 ` Pawel Dziepak
2007-07-10 16:38 ` Jan Engelhardt
2007-07-10 16:54 ` Pawel Dziepak
[not found] <8Fkwa-6BT-29@gated-at.bofh.it>
2007-07-11 11:49 ` Bodo Eggert
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).