lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 27 Jun 2013 01:28:45 +0200
From:	Paolo Bonzini <pbonzini@...hat.com>
To:	Matthew Wilcox <willy@...ux.intel.com>
CC:	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-scsi <linux-scsi@...r.kernel.org>,
	Vishal Verma <vishal.l.verma@...el.com>
Subject: Re: NVMe: Add nvme-scsi.c (was Re: [PULL REQUEST] NVMe driver updates)

Il 09/05/2013 22:20, Matthew Wilcox ha scritto:
>       NVMe: Add nvme-scsi.c

I couldn't find the original patch on LKML, so I'll just quote the
relevant piece of code.

> +int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr)
> +{
> +	struct sg_io_hdr hdr;
> +	int retcode;
> +
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EACCES;

This should be EPERM, and also it should use the same checks as other
implementations of SG_IO, including:

- checking if it's operating on a partition, and requiring CAP_SYS_RAWIO
if so;

- allowing a limited number of commands even for !capable(CAP_SYS_RAWIO).

All this is done by scsi_cmd_blk_ioctl.

Paolo

> +	if (copy_from_user(&hdr, u_hdr, sizeof(hdr)))
> +		return -EFAULT;
> +	if (hdr.interface_id != 'S')
> +		return -EINVAL;
> +	if (hdr.cmd_len > BLK_MAX_CDB)
> +		return -EINVAL;
> +
> +	retcode = nvme_scsi_translate(ns, &hdr);
> +	if (retcode < 0)
> +		return retcode;
> +	if (retcode > 0)
> +		retcode = SNTI_TRANSLATION_SUCCESS;
> +	if (copy_to_user(__user u_hdr, &hdr, sizeof(sg_io_hdr_t)) > 0)
> +		return -EFAULT;
> +
> +	return retcode;
> +}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ