lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <bug-205571-13602@https.bugzilla.kernel.org/>
Date:   Mon, 18 Nov 2019 22:23:08 +0000
From:   bugzilla-daemon@...zilla.kernel.org
To:     linux-ext4@...r.kernel.org
Subject: [Bug 205571] New: potential data race on ext4_setattr around
 inode->i_mtime with ftruncate and readv

https://bugzilla.kernel.org/show_bug.cgi?id=205571

            Bug ID: 205571
           Summary: potential data race on ext4_setattr around
                    inode->i_mtime with ftruncate and readv
           Product: File System
           Version: 2.5
    Kernel Version: 5.4-rc5
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: ext4
          Assignee: fs_ext4@...nel-bugs.osdl.org
          Reporter: mengxu.gatech@...il.com
        Regression: No

I am bringing up the visibility of a potential data race on ext4_setattr around
inode->i_mtime when one thread is doing ftruncate and the other readv.

[Setup]
creat(file_bar, 0777, ) = 4;
dup2(4, 198) = 198;
link(file_bar, link_bar) = 0;
open(link_bar, 0x2, 0777) = 6;
dup2(6, 196) = 196;


[Thread 1] ftruncate(198, 21009);
[Thread 2] readv(196, [{iov_base=0x0x7fa652a1fa07, iov_len=1641}, ,..], 6);

The function call trace is shown below:

[Thread 1: SYS_ftruncate]
__do_sys_ftruncate
  do_sys_ftruncate
    do_truncate
      ext4_setattr
        [WRITE] inode->i_mtime = current_time(inode);

[Thread 2: SYS_readv]
__do_sys_readv
  do_readv
    vfs_readv
      do_iter_read
        do_iter_readv_writev
          call_read_iter
            ext4_file_read_iter
              generic_file_read_iter
                generic_file_buffered_read
                  file_accessed
                    atime_needs_update
                      relatime_need_update
                        [READ] if (timespec64_compare(&inode->i_mtime,
&inode->i_atime) >= 0)


I could confirm that the WRITE may happen before and after the READ operation
by controlling the timing of the two threads, i.e., by setting breakpoints
before the WRITE statement.

However, I am not very sure about the implication of such a data race (e.g.,
causing violations of assumptions). I would appreciate if you could help check
on this potential bug and advise whether this is a harmful data race or it
is intended. Thank you!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ