From: Xi Ruoyao Date: Thu, 15 Jan 2026 08:24:57 +0000 (+0800) Subject: Linux: fix tst-copy_file_range-large failure in 32-bit glibc build on 64-bit kernel... X-Git-Tag: glibc-2.43~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe341ae0ee945bdc0c3fd5fb6fd0196025647af;p=thirdparty%2Fglibc.git Linux: fix tst-copy_file_range-large failure in 32-bit glibc build on 64-bit kernel [BZ 33790] Reported-by: H. J. Lu Signed-off-by: Xi Ruoyao Reviewed-by: Florian Weimer Tested-by: Adhemerval Zanella --- diff --git a/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c b/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c index 4a323df539..6c44eed23a 100644 --- a/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c +++ b/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c @@ -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: + , + , and + . */ + 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: - . - 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);