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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210227134922.5706-1-alx.manpages@gmail.com>
Date:   Sat, 27 Feb 2021 14:49:23 +0100
From:   Alejandro Colomar <alx.manpages@...il.com>
To:     Amir Goldstein <amir73il@...il.com>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        linux-man@...r.kernel.org, Luis Henriques <lhenriques@...e.de>
Cc:     Alejandro Colomar <alx.manpages@...il.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Anna Schumaker <anna.schumaker@...app.com>,
        Jeff Layton <jlayton@...nel.org>,
        Steve French <sfrench@...ba.org>,
        Miklos Szeredi <miklos@...redi.hu>,
        Trond Myklebust <trond.myklebust@...merspace.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        "Darrick J. Wong" <darrick.wong@...cle.com>,
        Dave Chinner <dchinner@...hat.com>,
        Nicolas Boichat <drinkcat@...omium.org>,
        Ian Lance Taylor <iant@...gle.com>,
        Luis Lozano <llozano@...omium.org>,
        Andreas Dilger <adilger@...ger.ca>,
        Olga Kornievskaia <aglo@...ch.edu>,
        Christoph Hellwig <hch@...radead.org>,
        ceph-devel <ceph-devel@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        CIFS <linux-cifs@...r.kernel.org>,
        samba-technical <samba-technical@...ts.samba.org>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        Linux NFS Mailing List <linux-nfs@...r.kernel.org>,
        Walter Harms <wharms@....de>
Subject: [RFC v2] copy_file_range.2: Update cross-filesystem support for 5.12

Linux 5.12 fixes a regression.

Cross-filesystem copies (introduced in 5.3) were buggy.

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Reported-by: Luis Henriques <lhenriques@...e.de>
Reported-by: Amir Goldstein <amir73il@...il.com>
Related: <https://lwn.net/Articles/846403/>
Cc: Greg KH <gregkh@...uxfoundation.org>
Cc: Michael Kerrisk <mtk.manpages@...il.com>
Cc: Anna Schumaker <anna.schumaker@...app.com>
Cc: Jeff Layton <jlayton@...nel.org>
Cc: Steve French <sfrench@...ba.org>
Cc: Miklos Szeredi <miklos@...redi.hu>
Cc: Trond Myklebust <trond.myklebust@...merspace.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: Dave Chinner <dchinner@...hat.com>
Cc: Nicolas Boichat <drinkcat@...omium.org>
Cc: Ian Lance Taylor <iant@...gle.com>
Cc: Luis Lozano <llozano@...omium.org>
Cc: Andreas Dilger <adilger@...ger.ca>
Cc: Olga Kornievskaia <aglo@...ch.edu>
Cc: Christoph Hellwig <hch@...radead.org>
Cc: ceph-devel <ceph-devel@...r.kernel.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Cc: CIFS <linux-cifs@...r.kernel.org>
Cc: samba-technical <samba-technical@...ts.samba.org>
Cc: linux-fsdevel <linux-fsdevel@...r.kernel.org>
Cc: Linux NFS Mailing List <linux-nfs@...r.kernel.org>
Cc: Walter Harms <wharms@....de>
Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---

Hi all,

Please check that this is correct.
I wrote it as I understood copy_file_range() from the LWN article,
and the conversation on this thread,
but maybe someone with more experience on this syscall find bugs in my patch.

When kernels 5.3..5.11 fix this, some info could be compacted a bit more,
and maybe the BUGS section could be removed.

Also, I'd like to know which filesystems support cross-fs, and since when.

Amir, you said that it was only cifs and nfs (since when? 5.3? 5.12?).

Also, I'm a bit surprised that <5.3 could fail with EOPNOTSUPP
and it wasn't documented.  Is that for sure, Amir?

Thanks,

Alex

---
 man2/copy_file_range.2 | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2
index 611a39b80..93f54889d 100644
--- a/man2/copy_file_range.2
+++ b/man2/copy_file_range.2
@@ -169,6 +169,9 @@ Out of memory.
 .B ENOSPC
 There is not enough space on the target filesystem to complete the copy.
 .TP
+.BR EOPNOTSUPP " (before Linux 5.3; or since Linux 5.12)"
+The filesystem does not support this operation.
+.TP
 .B EOVERFLOW
 The requested source or destination range is too large to represent in the
 specified data types.
@@ -184,10 +187,17 @@ or
 .I fd_out
 refers to an active swap file.
 .TP
-.B EXDEV
+.BR EXDEV " (before Linux 5.3)"
 The files referred to by
 .IR fd_in " and " fd_out
-are not on the same mounted filesystem (pre Linux 5.3).
+are not on the same filesystem.
+.TP
+.BR EXDEV " (or since Linux 5.12)"
+The files referred to by
+.IR fd_in " and " fd_out
+are not on the same filesystem,
+and the source and target filesystems are not of the same type,
+or do not support cross-filesystem copy.
 .SH VERSIONS
 The
 .BR copy_file_range ()
@@ -195,13 +205,10 @@ system call first appeared in Linux 4.5, but glibc 2.27 provides a user-space
 emulation when it is not available.
 .\" https://sourceware.org/git/?p=glibc.git;a=commit;f=posix/unistd.h;h=bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f
 .PP
-A major rework of the kernel implementation occurred in 5.3.
-Areas of the API that weren't clearly defined were clarified and the API bounds
-are much more strictly checked than on earlier kernels.
-Applications should target the behaviour and requirements of 5.3 kernels.
-.PP
-First support for cross-filesystem copies was introduced in Linux 5.3.
-Older kernels will return -EXDEV when cross-filesystem copies are attempted.
+Since 5.12,
+cross-filesystem copies can be achieved
+when both filesystems are of the same type,
+and that filesystem implements support for it.
 .SH CONFORMING TO
 The
 .BR copy_file_range ()
@@ -226,6 +233,10 @@ gives filesystems an opportunity to implement "copy acceleration" techniques,
 such as the use of reflinks (i.e., two or more inodes that share
 pointers to the same copy-on-write disk blocks)
 or server-side-copy (in the case of NFS).
+.SH BUGS
+In Linux kernels 5.3 to 5.11, cross-filesystem copies were supported.
+However, on some virtual filesystems, the call failed to copy,
+eventhough it may have reported success.
 .SH EXAMPLES
 .EX
 #define _GNU_SOURCE
-- 
2.30.1.721.g45526154a5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ