Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] target: fileio: missing file_is_pseudo() check in
  fd_init_prot()
--

commit 4e15db58376b542897dd4203d7acdfd99df1aec4
Author: Christian Brauner <[email protected]>

target: fileio: refuse files on pseudo filesystems as backing files

This commit rejects files on pseudo filesystems in fd_configure_device() so
that SCSI initiators cannot read or write kernel interfaces such as procfs
or sysfs with kernel credentials.

> diff --git a/drivers/target/target_core_file.c 
> b/drivers/target/target_core_file.c
> index a5391e57e9aa5..7a3cf63dc979b 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -152,6 +152,13 @@ static int fd_configure_device(struct se_device *dev)
>               goto fail;
>       }
>  
> +     if (file_is_pseudo(file)) {
> +             pr_err("FILEIO: %s is on a pseudo filesystem\n",
> +                    fd_dev->fd_dev_name);
> +             ret = -EINVAL;
> +             goto fail;
> +     }

[Severity: Medium]
Should fd_init_prot() also check file_is_pseudo() (and ->read_iter /
->write_iter) when opening fd_dev->fd_prot_file?

When DIF protection is enabled via pi_prot_type_store(), fd_init_prot()
opens "%s.protection" by pathname without these checks.  If that path is a
symlink or bind mount to a procfs or sysfs file, fd_execute_rw_buffered() ->
fd_do_rw() will still read and write it with kernel worker credentials.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=37

Reply via email to