[LTP] [PATCH v4 3/5] Add landlock04 test

Petr Vorel pvorel@suse.cz
Fri Jul 26 18:31:06 CEST 2024


Hi all,

...
> +static void tester_run_fs_rules(const int rules, const int result)
> +{
> +	if (rules & LANDLOCK_ACCESS_FS_EXECUTE)
> +		_test_exec(result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_WRITE_FILE)
> +		_test_write(result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_READ_FILE)
> +		_test_read(result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_READ_DIR)
> +		_test_readdir(result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_REMOVE_DIR)
> +		_test_rmdir(result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_REMOVE_FILE)
> +		_test_rmfile(result);
> +

> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_CHAR)
> +		_test_make(DEV_CHAR0, S_IFCHR, dev_chr, result);
FYI no need to skip vfat and exfat (.skip_filesystems), just certain tests. This
one above would need to be skipped.

> +
> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_BLOCK)
> +		_test_make(DEV_BLK0, S_IFBLK, dev_blk, result);
and this...

> +
> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_REG)
> +		_test_make(FILE_REGULAR, S_IFREG, 0, result);
> +
> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_SOCK)
> +		_test_make(FILE_SOCKET, S_IFSOCK, 0, result);
and this...

> +
> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_FIFO)
> +		_test_make(FILE_FIFO, S_IFIFO, 0, result);
and this...

> +
> +	if (rules & LANDLOCK_ACCESS_FS_MAKE_SYM)
> +		_test_symbolic(result);
and this.

Kind regards,
Petr


> +
> +	if (rules & LANDLOCK_ACCESS_FS_TRUNCATE) {
> +		if ((tst_kvercmp(6, 2, 0)) < 0) {
> +			tst_res(TINFO, "Skip truncate test. Minimum kernel version is 6.2");
> +			return;
> +		}
> +
> +		_test_truncate(result);
> +	}
> +}


More information about the ltp mailing list