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: <b90e8435-651c-e901-8be3-b0dac6eaac22@redhat.com>
Date:   Sun, 6 Sep 2020 10:14:16 -0700
From:   Tom Rix <trix@...hat.com>
To:     Russ Weight <russell.h.weight@...el.com>, mdf@...nel.org,
        lee.jones@...aro.org, linux-fpga@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     lgoncalv@...hat.com, yilun.xu@...el.com, hao.wu@...el.com,
        matthew.gerlach@...el.com
Subject: Re: [PATCH v1 12/12] fpga: add max10 get_hw_errinfo callback func


On 9/4/20 4:53 PM, Russ Weight wrote:
> Extend the MAX10 BMC Security Engine driver to include
> a function that returns 64 bits of additional HW specific
> data for errors that require additional information.
> This callback function enables the hw_errinfo sysfs
> node in the Intel Security Manager class driver.
>
> Signed-off-by: Russ Weight <russell.h.weight@...el.com>
> Reviewed-by: Wu Hao <hao.wu@...el.com>
> ---
>  drivers/fpga/intel-m10-bmc-secure.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/intel-m10-bmc-secure.c b/drivers/fpga/intel-m10-bmc-secure.c
> index 4a66c2d448eb..7fb1c805f654 100644
> --- a/drivers/fpga/intel-m10-bmc-secure.c
> +++ b/drivers/fpga/intel-m10-bmc-secure.c
> @@ -450,6 +450,30 @@ static enum ifpga_sec_err m10bmc_sec_cancel(struct ifpga_sec_mgr *imgr)
>  	return ret ? IFPGA_SEC_ERR_RW_ERROR : IFPGA_SEC_ERR_NONE;
>  }
>  
> +static u64 m10bmc_sec_hw_errinfo(struct ifpga_sec_mgr *imgr)
> +{
> +	struct m10bmc_sec *sec = imgr->priv;
> +	u32 doorbell = 0, auth_result = 0;
> +	u64 hw_errinfo = 0;

hw_errinfo should be initialized to some poison value like -1

to cover the case if either of sys_read's fail.

Tom

> +
> +	switch (imgr->err_code) {
> +	case IFPGA_SEC_ERR_HW_ERROR:
> +	case IFPGA_SEC_ERR_TIMEOUT:
> +	case IFPGA_SEC_ERR_BUSY:
> +	case IFPGA_SEC_ERR_WEAROUT:
> +		if (!m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell))
> +			hw_errinfo = (u64)doorbell << 32;
> +
> +		if (!m10bmc_sys_read(sec->m10bmc, M10BMC_AUTH_RESULT,
> +				     &auth_result))
> +			hw_errinfo |= (u64)auth_result;
> +
> +		return hw_errinfo;
> +	default:
> +		return 0;
> +	}
> +}
> +
>  static const struct ifpga_sec_mgr_ops m10bmc_iops = {
>  	.user_flash_count = get_qspi_flash_count,
>  	.bmc_root_entry_hash = get_bmc_root_entry_hash,
> @@ -467,7 +491,8 @@ static const struct ifpga_sec_mgr_ops m10bmc_iops = {
>  	.prepare = m10bmc_sec_prepare,
>  	.write_blk = m10bmc_sec_write_blk,
>  	.poll_complete = m10bmc_sec_poll_complete,
> -	.cancel = m10bmc_sec_cancel
> +	.cancel = m10bmc_sec_cancel,
> +	.get_hw_errinfo = m10bmc_sec_hw_errinfo
>  };
>  
>  static void ifpga_sec_mgr_uinit(struct m10bmc_sec *sec)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ