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] [thread-next>] [day] [month] [year] [list]
Message-ID: <becbf34c-e22e-3c48-41df-f23fee2da658@grimberg.me>
Date:   Wed, 26 Feb 2020 15:28:09 -0800
From:   Sagi Grimberg <sagi@...mberg.me>
To:     Logan Gunthorpe <logang@...tatee.com>,
        linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org
Cc:     Christoph Hellwig <hch@....de>, Keith Busch <kbusch@...nel.org>,
        Jens Axboe <axboe@...com>,
        Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>,
        Max Gurtovoy <maxg@...lanox.com>,
        Stephen Bates <sbates@...thlin.com>
Subject: Re: [PATCH v11 7/9] nvmet-passthru: Add passthru code to process
 commands


> +u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
> +{
> +	/*
> +	 * Passthru all vendor specific commands
> +	 */
> +	if (req->cmd->common.opcode >= nvme_admin_vendor_start)
> +		return nvmet_setup_passthru_command(req);
> +
> +	switch (req->cmd->common.opcode) {
> +	case nvme_admin_async_event:
> +		req->execute = nvmet_execute_async_event;
> +		return NVME_SC_SUCCESS;
> +	case nvme_admin_keep_alive:
> +		/*
> +		 * Most PCIe ctrls don't support keep alive cmd, we route keep
> +		 * alive to the non-passthru mode. In future please change this
> +		 * code when PCIe ctrls with keep alive support available.
> +		 */
> +		req->execute = nvmet_execute_keep_alive;
> +		return NVME_SC_SUCCESS;
> +	case nvme_admin_set_features:
> +		switch (le32_to_cpu(req->cmd->features.fid)) {
> +		case NVME_FEAT_ASYNC_EVENT:
> +		case NVME_FEAT_KATO:
> +		case NVME_FEAT_NUM_QUEUES:
> +			req->execute = nvmet_execute_set_features;
> +			return NVME_SC_SUCCESS;
> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

This looks questionable... There are tons of features that doesn't
make sense here like hmb, temperature stuff, irq stuff, timestamps,
reservations etc... passing-through these will have confusing
semantics.. Maybe white-list what actually makes sense to passthru?

> +		break;
> +	case nvme_admin_get_features:
> +		switch (le32_to_cpu(req->cmd->features.fid)) {
> +		case NVME_FEAT_ASYNC_EVENT:
> +		case NVME_FEAT_KATO:
> +		case NVME_FEAT_NUM_QUEUES:
> +			req->execute = nvmet_execute_get_features;
> +			return NVME_SC_SUCCESS;
> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

Same here.

> +		break;
> +	case nvme_admin_identify:
> +		switch (req->cmd->identify.cns) {
> +		case NVME_ID_CNS_CTRL:
> +			req->execute = nvmet_passthru_execute_cmd;
> +			req->p.end_req = nvmet_passthru_override_id_ctrl;
> +			return NVME_SC_SUCCESS;
> +		case NVME_ID_CNS_NS:
> +			req->execute = nvmet_passthru_execute_cmd;
> +			req->p.end_req = nvmet_passthru_override_id_ns;
> +			return NVME_SC_SUCCESS;

Aren't you missing NVME_ID_CNS_NS_DESC_LIST? and
NVME_ID_CNS_NS_ACTIVE_LIST?

> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

Also here, all the namespace management stuff has questionable
semantics in my mind...

> +	case nvme_admin_get_log_page:
> +		return nvmet_setup_passthru_command(req);
> +	default:
> +		/* By default, blacklist all admin commands */
> +		return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
> +	}
> +}
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 3d5189f46cb1..e29f4b8145fa 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -858,6 +858,7 @@ enum nvme_admin_opcode {
>   	nvme_admin_security_recv	= 0x82,
>   	nvme_admin_sanitize_nvm		= 0x84,
>   	nvme_admin_get_lba_status	= 0x86,
> +	nvme_admin_vendor_start		= 0xC0,
>   };
>   
>   #define nvme_admin_opcode_name(opcode)	{ opcode, #opcode }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ