Bug 3897 - Race when running mkdir with setuids (owner/group set too late)
Summary: Race when running mkdir with setuids (owner/group set too late)
Status: RESOLVED FIXED
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: x86 Linux
: P3 major
Target Milestone: ---
Assignee: Jeff Layton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 03:21 UTC by Alexander Geraldy
Modified: 2009-07-26 08:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Geraldy 2006-06-29 03:21:06 UTC
On cifs client (rns4) we mount /home using this fstab entry:
//rns3/home /home cifs user_xattr,acl,setuids,credentials=/etc/auth.rns

When a normal user (geraldy) calls "mkdir test; stat test" within /home on rns4, we get

  File: ,,test"
  Size: 0               Blocks: 0          IO Block: 16384  Verzeichnis
Device: 14h/20d Inode: 251941      Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2006-06-29 10:00:53.000000000 +0200
Modify: 2006-06-29 10:00:53.000000000 +0200
Change: 2006-06-29 10:00:53.000000000 +0200

which means, that the correct user is not set "fast enough". After sleeping one second, stat returns:

  File: ,,test"
  Size: 0               Blocks: 0          IO Block: 16384  Verzeichnis
Device: 14h/20d Inode: 251941      Links: 2
Access: (0755/drwxr-xr-x)  Uid: (10002/ geraldy)   Gid: ( 1001/   staff)
Access: 2006-06-29 10:00:53.000000000 +0200
Modify: 2006-06-29 10:00:53.000000000 +0200
Change: 2006-06-29 10:00:53.000000000 +0200

This problem is preventing cp -R from working, since files can't be copied to the newly created directory (owner is still root), output is "permission denied".

The client system is: Mandriva Linux, Kernel 2.6.12-22mdksmp.
Server uses samba-server-3.0.20-3mdk.

Remark: When creating a new file("echo x>test" or "touch test"), the owner and group are set immediately.
Comment 1 shirishpargaonkar@gmail.com 2009-07-15 13:12:17 UTC
What server is this?  If this is Samba server, with new posix open,
a set_path_info/smb_posix_open should take care of this problem.

Comment 2 Jeff Layton 2009-07-26 08:11:11 UTC
Actually, I think all of the dynperm changes that went in should have fixed this. I'll go ahead and close this as FIXED. Please reopen if it's still an issue on more recent kernels.
Comment 3 Jeff Layton 2009-07-26 08:11:53 UTC
Closing as FIXED. Please reopen if it's still not working for you and we'll have a closer look.