[Bug 45935] New: Race condition in implementation of MoveFile, MoveFileEx, MoveFileWithProgress

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Oct 4 14:42:05 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=45935

            Bug ID: 45935
           Summary: Race condition in implementation of MoveFile,
                    MoveFileEx, MoveFileWithProgress
           Product: Wine
           Version: 3.0.3
          Hardware: x86-64
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
          Assignee: wine-bugs at winehq.org
          Reporter: joshudson at gmail.com
      Distribution: ---

When using MoveFile (or any of its variants) to make unique file names, there
is a race condition when two threads do so in the same directory.

We have commercial software that tries to do this.

path.c, line 1373 reads

    if (rename( source_unix.Buffer, dest_unix.Buffer ) == -1)

Correct code:

    if (renameat2( AT_FDCWD, source_unix.Buffer, AT_FDCWD, dest_unix.Buffer,
(flag & MOVEFILE_REPLACE_EXISTING) ? 0 : RENAME_NOREPLACE ) == -1)

but you'll have to do a feature test for renameat2.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list