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:   Thu, 3 Nov 2016 15:29:54 +1100
From:   Alexey Kardashevskiy <aik@...abs.ru>
To:     Kirti Wankhede <kwankhede@...dia.com>,
        Jike Song <jike.song@...el.com>
Cc:     alex.williamson@...hat.com, pbonzini@...hat.com, kraxel@...hat.com,
        cjia@...dia.com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        kevin.tian@...el.com, qemu-devel@...gnu.org,
        bjsdjshi@...ux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v9 04/12] vfio iommu: Add support for
 mediated devices

On 03/11/16 00:18, Kirti Wankhede wrote:
> 
> 
> On 11/2/2016 6:30 PM, Jike Song wrote:
>> On 11/02/2016 08:41 PM, Kirti Wankhede wrote:
>>> On 11/2/2016 5:51 PM, Jike Song wrote:
>>>> On 11/02/2016 12:09 PM, Alexey Kardashevskiy wrote:
>>>>> Or you could just reference and use @mm as KVM and others do. Or there is
>>>>> anything else you need from @current than just @mm?
>>>>>
>>>>
>>>> I agree. If @mm is the only thing needed, there is really no reason to
>>>> refer to the @task :-)
>>>>
>>>
>>> In vfio_lock_acct(), that is for page accounting, if mm->mmap_sem is
>>> already held then page accounting is deferred, where task structure is
>>> used to get mm and work is deferred only if mm exist:
>>> 	mm = get_task_mm(task);

get_task_mm() increments mm_users which is basically a number of userspaces
holding the reference to mm. As this case it is not a userspace, mm_count
needs to be incremented imho.


>>>
>>> That is where this module need task structure.
>>
>> Kirti,
>>
>> By calling get_task_mm you hold a ref on @mm and save it in iommu,
>> whenever you want to do something like vfio_lock_acct(), use that mm
>> (as you said, if mmap_sem not accessible then defer it to a work, but
>> still @mm is the whole information), and put it after the usage.
>>
>> I still can't see any reason that the @task have to be saved. It's
>> always the @mm all the time. Did I miss anything?
>>
> 
> If the process is terminated by SIGKILL, as Alexey mentioned in this
> mail thread earlier exit_mm() is called first and then all files are
> closed. From exit_mm(), task->mm is set to NULL. So from teardown path,
> we should call get_task_mm(task)

... which will return NULL, no?

> to get current status intsead of using
> stale pointer.

If you increment either mm_users or mm_count at the exact place where you
want to cache task pointer, why would mm pointer become stale until you do
mmdrop() or mmput()?


-- 
Alexey



Download attachment "signature.asc" of type "application/pgp-signature" (840 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ