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]
Date: Tue, 6 Feb 2024 14:21:19 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Alex Williamson <alex.williamson@...hat.com>
CC: <jgg@...dia.com>, <yishaih@...dia.com>,
	<shameerali.kolothum.thodi@...wei.com>, <kevin.tian@...el.com>,
	<kvm@...r.kernel.org>, <dave.jiang@...el.com>, <ashok.raj@...el.com>,
	<linux-kernel@...r.kernel.org>, <patches@...ts.linux.dev>
Subject: Re: [PATCH 07/17] vfio/pci: Preserve per-interrupt contexts

Hi Alex,

On 2/6/2024 2:03 PM, Alex Williamson wrote:
> On Tue, 6 Feb 2024 13:45:22 -0800
> Reinette Chatre <reinette.chatre@...el.com> wrote:
>> On 2/5/2024 2:35 PM, Alex Williamson wrote:
>>> On Thu,  1 Feb 2024 20:57:01 -0800
>>> Reinette Chatre <reinette.chatre@...el.com> wrote:  
>>
>> ..
>>
>>>> diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
>>>> index 31f73c70fcd2..7ca2b983b66e 100644
>>>> --- a/drivers/vfio/pci/vfio_pci_intrs.c
>>>> +++ b/drivers/vfio/pci/vfio_pci_intrs.c
>>>> @@ -427,7 +427,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev,
>>>>  
>>>>  	ctx = vfio_irq_ctx_get(vdev, vector);
>>>>  
>>>> -	if (ctx) {
>>>> +	if (ctx && ctx->trigger) {
>>>>  		irq_bypass_unregister_producer(&ctx->producer);
>>>>  		irq = pci_irq_vector(pdev, vector);
>>>>  		cmd = vfio_pci_memory_lock_and_enable(vdev);
>>>> @@ -435,8 +435,9 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev,
>>>>  		vfio_pci_memory_unlock_and_restore(vdev, cmd);
>>>>  		/* Interrupt stays allocated, will be freed at MSI-X disable. */
>>>>  		kfree(ctx->name);
>>>> +		ctx->name = NULL;  
>>>
>>> Setting ctx->name = NULL is not strictly necessary and does not match
>>> the INTx code that we're claiming to try to emulate.  ctx->name is only
>>> tested immediately after allocation below, otherwise it can be inferred
>>> from ctx->trigger.  Thanks,  
>>
>> This all matches my understanding. I added ctx->name = NULL after every kfree(ctx->name)
>> (see below for confirmation of other instance). You are correct that the flow
>> infers validity of ctx->name from ctx->trigger. My motivation for
>> adding ctx->name = NULL is that, since the interrupt context persists, this
>> change ensures that there will be no pointer that points to freed memory. I
>> am not comfortable leaving pointers to freed memory around.
> 
> Fair enough.  Maybe note the change in the commit log.  Thanks,
> 

Will do. Thank you.

Reinette


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ