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: <20250806121625.00001556@huawei.com>
Date: Wed, 6 Aug 2025 12:16:25 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: <dan.j.williams@...el.com>
CC: <linux-coco@...ts.linux.dev>, <linux-pci@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <bhelgaas@...gle.com>, <aik@....com>,
	<lukas@...ner.de>, Samuel Ortiz <sameo@...osinc.com>, Xu Yilun
	<yilun.xu@...ux.intel.com>, Gerd Hoffmann <kraxel@...hat.com>
Subject: Re: [PATCH v4 05/10] samples/devsec: Introduce a PCI
 device-security bus + endpoint sample


+CC Gerd, of off chance we can use a Redhat PCI device ID for kernel
emulation similar to those they let Qemu use.

> 
> > > +	for (int i = 0; i < ARRAY_SIZE(devsec->devsec_devs); i++) {
> > > +		struct devsec_dev *devsec_dev = devsec_dev_alloc(devsec);
> > > +		int rc;
> > > +
> > > +		if (IS_ERR(devsec_dev))
> > > +			return PTR_ERR(devsec_dev);
> > > +		rc = devm_add_action_or_reset(dev, destroy_devsec_dev,
> > > +					      devsec_dev);
> > > +		if (rc)
> > > +			return rc;
> > > +		devsec->devsec_devs[i] = devsec_dev;
> > > +	}
> > > +
> > > +	return 0;
> > > +}  
> > 
> >   
> > > +static int init_port(struct devsec_port *devsec_port)
> > > +{
> > > +	struct pci_bridge_emul *bridge = &devsec_port->bridge;
> > > +
> > > +	*bridge = (struct pci_bridge_emul) {
> > > +		.conf = {
> > > +			.vendor = cpu_to_le16(0x8086),
> > > +			.device = cpu_to_le16(0x7075),  
> > 
> > Emulating something real?  If not maybe we should get an ID from another space
> > (or reserve this one ;)  
> 
> I am happy to switch to something else, but no, I do not have time to
> chase this through PCI SIG. I do not expect this id to cause conflicts,
> but no guarantees.

Nothing to do with the SIG - you definitely don't want to try talking them
into giving a Vendor ID for the kernel.  That's an Intel ID so you need to find
the owner of whatever tracker Intel uses for these.  Or maybe we can ask for
one of the Redhat ones (maintained by Gerd).

> 
> > > +			.class_revision = cpu_to_le32(0x1),
> > > +			.pref_mem_base = cpu_to_le16(PCI_PREF_RANGE_TYPE_64),
> > > +			.pref_mem_limit = cpu_to_le16(PCI_PREF_RANGE_TYPE_64),
> > > +		},  
> > 
> >   

...
> > > +static int __init devsec_tsm_init(void)
> > > +{
> > > +	__devsec_pci_ops = &devsec_pci_ops;  
> > 
> > I'm not immediately grasping why this global is needed.
> > You never check if it's set, so why not just move definition of devsec_pci_ops
> > early enough that can be directly used everywhere.  
> 
> Because devsec_pci_ops is used inside the ops it declares. So either
> forward declare all those ops, or do this pointer assigment dance. I
> opted for the latter as it is smaller.
Ok. I guess in emulation that's a reasonable compromise.  Maybe leave
a comment somewhere to avoid repeat of this feedback.

Jonathan

> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ