]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: fix tst-copy_file_range-large failure in 32-bit glibc build on 64-bit kernel...
authorXi Ruoyao <xry111@xry111.site>
Thu, 15 Jan 2026 08:24:57 +0000 (16:24 +0800)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 19 Jan 2026 14:40:05 +0000 (15:40 +0100)
Reported-by: H. J. Lu <hjl.tools@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Tested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/unix/sysv/linux/tst-copy_file_range-large.c

index 4a323df539211d9db71a12c27028261a16b3cc9e..6c44eed23a95e683197fb5f78a73c808b5b81a7c 100644 (file)
@@ -197,17 +197,22 @@ test_size (struct support_fuse *f, off64_t size)
       FAIL_UNSUPPORTED ("copy_file_range not supported");
     }
 
-  if (atomic_load (&fuse_has_copy_file_range_64))
+  /* To avoid the negative return value in Linux versions 6.18 the size is
+     silently clamped to UINT_MAX & PAGE_MASK for FUSE
+     (without COPY_FILE_RANGE_64) and for compat syscall on a 64-bit kernel.
+     The FUSE change also has been backported to stable kernel release
+     series.  So accept that return value if the kernel lacks
+     COPY_FILE_RANGE_64 and/or if we are building and testing a 32-bit glibc
+     (as maybe the test is running on a 64-bit kernel and invoking the
+     compat syscall).  See:
+     <https://git.kernel.org/torvalds/c/1e08938c3694>,
+     <https://git.kernel.org/torvalds/c/f8f59a2c05dc>, and
+     <https://lore.kernel.org/7b964b35e86d73816a395e72bac7e2e73ff8dd6d.camel@xry111.site/>.  */
+  if (__WORDSIZE >= 64 && atomic_load (&fuse_has_copy_file_range_64))
     TEST_COMPARE (copied, size);
 
-  /* To avoid the negative return value in Linux versions 6.18 the size is
-     silently clamped to UINT_MAX & PAGE_MASK and the change has been
-     backported to stable kernel release series.  Accept that return value
-     too.  See:
-     <https://git.kernel.org/torvalds/c/1e08938c3694>.
-     We must AND the expression with SSIZE_MAX for 32-bit platforms where
-     SSIZE_MAX is less than UINT_MAX.
-  */
+  /* We must AND the expression with SSIZE_MAX for 32-bit platforms where
+     SSIZE_MAX is less than UINT_MAX.  */
   if (copied != size)
     TEST_COMPARE (copied, (UINT_MAX & ~(getpagesize () - 1)) & SSIZE_MAX);