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] [day] [month] [year] [list]
Message-ID: <20250912164957.GCaMRPNf7P60wqBud9@fat_crate.local>
Date: Fri, 12 Sep 2025 18:49:57 +0200
From: Borislav Petkov <bp@...en8.de>
To: Alexey Kardashevskiy <aik@....com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	David Woodhouse <dwmw@...zon.co.uk>,
	Kai-Heng Feng <kai.heng.feng@...onical.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Sean Christopherson <seanjc@...gle.com>,
	Santosh Shukla <santosh.shukla@....com>,
	"Nikunj A. Dadhania" <nikunj@....com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [RFC PATCH] PCI: Add quirk to always map ivshmem as write-back

On Thu, Jun 12, 2025 at 06:22:33PM +1000, Alexey Kardashevskiy wrote:
> QEMU Inter-VM Shared Memory (ivshmem) is designed to share a memory
> region between guest and host. The host creates a file, passes it to QEMU
> which it presents to the guest via PCI BAR#2. The guest userspace
> can map /sys/bus/pci/devices/0000:01:02.3/resource2(_wc) to use the region
> without having the guest driver for the device at all.
> 
> The problem with this, since it is a PCI resource, the PCI sysfs
> reasonably enforces:

Ok, so I read it up until now and can't continue because all I hear is a big
honking HACK alarm here!

Shared memory which is presented to a guest via PCI BAR?!?

Can it get any more ugly than this?

I hope I'm missing an important aspect here...

> diff --git a/drivers/pci/mmap.c b/drivers/pci/mmap.c
> index 8da3347a95c4..8495bee08fae 100644
> --- a/drivers/pci/mmap.c
> +++ b/drivers/pci/mmap.c
> @@ -35,6 +35,7 @@ int pci_mmap_resource_range(struct pci_dev *pdev, int bar,
>  	if (write_combine)
>  		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
>  	else
> +	else if (!(pci_resource_flags(pdev, bar) & IORESOURCE_CACHEABLE))
	^^^^^^

This can't build.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ