public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] statx09: Set fs-verity blocksize to FS blocksize
@ 2023-07-14 11:42 Martin Doucha
  2023-07-14 13:15 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Doucha @ 2023-07-14 11:42 UTC (permalink / raw)
  To: Dai Shili, Eric Biggers, ltp

The kernel requires that fs-verity blocksize must be at most equal
to the filesystem blocksize. Testing on small loop device means that
mkfs.ext4 will very likely default to blocksize of 1024. Set fs-verity
blocksize to the filesystem blocksize to avoid errors.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

Setting filesystem blocksize to pagesize would require moving the mkfs
command to setup(). We can do that later to fix support for kernels
before v6.3 but let's fix the failure on latest kernel version first.

 testcases/kernel/syscalls/statx/statx09.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/statx/statx09.c b/testcases/kernel/syscalls/statx/statx09.c
index c03d2c91e..7211d8393 100644
--- a/testcases/kernel/syscalls/statx/statx09.c
+++ b/testcases/kernel/syscalls/statx/statx09.c
@@ -80,8 +80,10 @@ static void flag_setup(void)
 {
 	int fd, attr, ret;
 	struct fsverity_enable_arg enable;
+	struct stat statbuf;
 
 	fd = SAFE_OPEN(TESTFILE_FLAGGED, O_RDONLY, 0664);
+	SAFE_FSTAT(fd, &statbuf);
 
 	ret = ioctl(fd, FS_IOC_GETFLAGS, &attr);
 	if (ret < 0) {
@@ -94,7 +96,7 @@ static void flag_setup(void)
 	memset(&enable, 0, sizeof(enable));
 	enable.version = 1;
 	enable.hash_algorithm = hash_algorithms[0];
-	enable.block_size = 4096;
+	enable.block_size = statbuf.st_blksize;
 	enable.salt_size = 0;
 	enable.salt_ptr = (intptr_t)NULL;
 	enable.sig_size = 0;
-- 
2.41.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-14 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-14 11:42 [LTP] [PATCH v2] statx09: Set fs-verity blocksize to FS blocksize Martin Doucha
2023-07-14 13:15 ` Petr Vorel
2023-07-14 16:16   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox