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: <20150401181925.GA20550@obsidianresearch.com>
Date:	Wed, 1 Apr 2015 12:19:25 -0600
From:	Jason Gunthorpe <jgunthorpe@...idianresearch.com>
To:	Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc:	Peter Huewe <peterhuewe@....de>, Ashley Lai <ashley@...leylai.com>,
	Marcel Selhorst <tpmdd@...horst.net>,
	tpmdd-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
	christophe.ricard@...il.com, jason.gunthorpe@...idianresearch.com,
	stefanb@...ux.vnet.ibm.com
Subject: Re: [PATCH] tpm: unified PPI interface for TPM 1.x/2.0 devices

On Wed, Apr 01, 2015 at 03:28:52PM +0300, Jarkko Sakkinen wrote:
> Added PPI interface to the character device. PPI interface is also kept
> in the pdev for backwards compatibility.

Could you look at just completely moving the PPI interface to the char
dev and then adding a symlink from the pdev? That would be really
ideal.

symlinks have the advantage that they actually fully fix the lifetime
issues.

This seems doable, if we replace the ppi_attrs group with a bunch of
calls to sysfs_create_link it should work ?

> +static struct tpm_chip *ppi_dev_to_chip(struct device *dev)
> +{
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
> +
> +	if (chip == NULL)
> +		chip = to_tpm_chip(chip);
> +
> +	return chip;
> +}

If symlinks don't work out, we should probably just set the drvdata on
the tpm_chip itself to avoid this.

> +	if (!(chip->flags & TPM_CHIP_FLAG_PPI))
> +		return -EINVAL;

Hum, I don't think the PPI files should be created if there is no PPI
support..

> +void __init tpm_ppi_init(struct class *tpm_class)
> +{
> +	tpm_class->dev_groups = tpm_groups;
>  }

So this shouldn't be unconditional.

Also, ultimately PPI can't just claim the dev_groups, other parts of
the driver will need to add groups too.

I think it makes more sense to do

struct attribute_group *tpm_ppi_get_sysfs(struct tpm_chip *chip)
{
}

And take care of building the list in the caller.

And tpm_ppi_get_sysfs should be called after the driver is readied but
before adding the device.

Jason
--
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