[LTP] [PATCH v2 11/11] Add landlock06 test

Petr Vorel pvorel@suse.cz
Thu Jul 11 10:45:20 CEST 2024


Hi Andrea,

...
> +static void run(void)
> +{
> +	if (!SAFE_FORK()) {
> +		int flag;
> +		size_t sz = 0;
> +
> +		TST_EXP_PASS(ioctl(file_fd, FIONREAD, &sz));
> +
> +		/* check unrestrictable commands */
> +		TST_EXP_PASS(ioctl(dev_fd, FIOCLEX));
> +		TST_EXP_PASS(ioctl(dev_fd, FIONCLEX));
> +		TST_EXP_PASS(ioctl(dev_fd, FIONBIO, &flag));
> +		TST_EXP_PASS(ioctl(dev_fd, FIOASYNC, &flag));
> +
> +		_exit(0);
> +	}
nit: I would avoid indentation with return:

	if (SAFE_FORK())
		return;

	int flag;
	size_t sz = 0;

	TST_EXP_PASS(ioctl(file_fd, FIONREAD, &sz));

	/* check unrestrictable commands */
	TST_EXP_PASS(ioctl(dev_fd, FIOCLEX));
	TST_EXP_PASS(ioctl(dev_fd, FIONCLEX));
	TST_EXP_PASS(ioctl(dev_fd, FIONBIO, &flag));
	TST_EXP_PASS(ioctl(dev_fd, FIOASYNC, &flag));

	_exit(0);

(minor detail, I can change it during merge)

...
> +	.format_device = 1,
> +	.mount_device = 1,
> +	.mntpoint = MNTPOINT,
> +	.all_filesystems = 1,
> +	.skip_filesystems = (const char *[]) {
> +		"vfat",
Unfortunately also exfat needs to be skipped (can be done during merge).
> +		NULL

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Thanks!

Kind regards,
Petr


More information about the ltp mailing list