selftests/mount_setattr: build with a 64-bit off_t
Subsystems (3)
PATCH 1/1 selftests/mount_setattr: build with a 64-bit off_t
With glibc on 32-bit architectures, off_t is 32 bits unless _FILE_OFFSET_BITS=64 is defined, so the 2 GB ftruncate() of the ext4 image gets a negative length and the test fails:
mount_setattr_test.c:1048:30: warning: implicit conversion from 'long long' to '__off_t' (aka 'long') changes value from 2147483648 to -2147483648 [-Wconstant-conversion]
Build the test with -D_FILE_OFFSET_BITS=64.
---
Found with 32-bit builds of the selftests (gcc 16 and clang 21 with -m32, with and without -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64); KernelCI's 32-bit arm builds show the same warnings. The changed files build without them now, and the x86_64 builds don't change.
tools/testing/selftests/mount_setattr/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mount_setattr/Makefile +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for mount selftests. -CFLAGS = -g $(KHDR_INCLUDES) -Wall -O2 -pthread +CFLAGS = -g $(KHDR_INCLUDES) -Wall -O2 -pthread -D_FILE_OFFSET_BITS=64 LOCAL_HDRS += ../filesystems/wrappers.h
Signature · 1 line
2.53.0
Quoted 9 lines · Sasha Levin
With glibc on 32-bit architectures,
off_tis 32 bits unless _FILE_OFFSET_BITS=64 is defined, so the 2 GBftruncate()of the ext4 image gets a negative length and the test fails:mount_setattr_test.c:1048:30: warning: implicit conversion from 'long long' to '
__off_t' (aka 'long') changes value from 2147483648 to -2147483648 [-Wconstant-conversion]Build the test with -D_FILE_OFFSET_BITS=64.
[...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] selftests/mount_setattr: build with a 64-bit off_t
https://git.kernel.org/vfs/vfs/c/8fa19db00bf3