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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52DBBA69.4040800@dev.mellanox.co.il>
Date:	Sun, 19 Jan 2014 13:43:37 +0200
From:	Sagi Grimberg <sagig@....mellanox.co.il>
To:	"Nicholas A. Bellinger" <nab@...erainc.com>,
	target-devel <target-devel@...r.kernel.org>
CC:	linux-scsi <linux-scsi@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"Martin K. Petersen" <martin.petersen@...cle.com>,
	Christoph Hellwig <hch@....de>, Hannes Reinecke <hare@...e.de>,
	Sagi Grimberg <sagig@...lanox.com>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Roland Dreier <roland@...nel.org>,
	Nicholas Bellinger <nab@...ux-iscsi.org>
Subject: Re: [PATCH-v2 03/17] target/sbc: Add DIF setup in sbc_check_prot
 + sbc_parse_cdb

On 1/19/2014 4:44 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@...ux-iscsi.org>
>
> This patch adds sbc_check_prot() for performing various DIF
> related CDB sanity checks, along with setting cmd->prot_type
> once sanity checks have passed.
>
> Also, add calls in sbc_parse_cdb() for READ_[10,12,16] +
> WRITE_[10,12,16] to perform DIF sanity checking.
>
> v2 changes:
>    - Make sbc_check_prot defined as static (Fengguang + Wei)
>    - Remove unprotected READ/WRITE warning (mkp)
>    - Populate cmd->prot_type + friends (Sagi)
>    - Drop SCF_PROT usage
>
> Cc: Martin K. Petersen <martin.petersen@...cle.com>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Hannes Reinecke <hare@...e.de>
> Cc: Sagi Grimberg <sagig@...lanox.com>
> Cc: Or Gerlitz <ogerlitz@...lanox.com>
> Signed-off-by: Nicholas Bellinger <nab@...ux-iscsi.org>
> ---
>   drivers/target/target_core_sbc.c |   62 ++++++++++++++++++++++++++++++++++++++
>   1 file changed, 62 insertions(+)
>
> diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
> index 6863dbe..91a92f3 100644
> --- a/drivers/target/target_core_sbc.c
> +++ b/drivers/target/target_core_sbc.c
> @@ -563,6 +563,44 @@ sbc_compare_and_write(struct se_cmd *cmd)
>   	return TCM_NO_SENSE;
>   }
>   
> +static bool
> +sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
> +	       u32 sectors)
> +{
> +	if (!cmd->t_prot_sg || !cmd->t_prot_nents)
> +		return true;
> +
> +	switch (dev->dev_attrib.pi_prot_type) {
> +	case TARGET_DIF_TYPE3_PROT:
> +		if (!(cdb[1] & 0xe0))
> +			return true;
> +
> +		cmd->reftag_seed = 0xffffffff;
> +		break;
> +	case TARGET_DIF_TYPE2_PROT:
> +		if (cdb[1] & 0xe0)
> +			return false;
> +
> +		cmd->reftag_seed = cmd->t_task_lba;
> +		break;
> +	case TARGET_DIF_TYPE1_PROT:
> +		if (!(cdb[1] & 0xe0))
> +			return true;
> +
> +		cmd->reftag_seed = cmd->t_task_lba;
> +		break;
> +	case TARGET_DIF_TYPE0_PROT:
> +	default:
> +		return true;
> +	}
> +
> +	cmd->prot_type = dev->dev_attrib.pi_prot_type;
> +	cmd->prot_length = dev->prot_length * sectors;
> +	cmd->prot_handover = PROT_SEPERATED;

I know that we are not planning to support interleaved mode at the 
moment, But I think
that the protection handover type is the backstore preference and should 
be taken from se_dev.
But it is not that important for now...

Sagi.
--
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