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]
Date:   Wed, 23 Oct 2019 13:03:06 -0400
From:   Jerome Glisse <jglisse@...hat.com>
To:     Jean-Philippe Brucker <jean-philippe@...aro.org>
Cc:     "zhangfei.gao@...mail.com" <zhangfei.gao@...mail.com>,
        francois.ozog@...aro.org, Herbert Xu <herbert@...dor.apana.org.au>,
        Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Zaibo Xu <xuzaibo@...wei.com>, ilias.apalodimas@...aro.org,
        linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
        Wangzhou <wangzhou1@...ilicon.com>, grant.likely@....com,
        "haojian . zhuang" <haojian.zhuang@...aro.org>,
        Zhangfei Gao <zhangfei.gao@...aro.org>,
        Kenneth Lee <liguozhu@...ilicon.com>,
        linux-accelerators@...ts.ozlabs.org, kenneth-lee-2012@...mail.com
Subject: Re: [PATCH v6 2/3] uacce: add uacce driver

On Wed, Oct 23, 2019 at 09:42:27AM +0200, Jean-Philippe Brucker wrote:
> On Fri, Oct 18, 2019 at 08:01:44PM +0800, zhangfei.gao@...mail.com wrote:

[...]

> > > > +static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma)
> > > > +{
> > > > +	struct uacce_queue *q = filep->private_data;
> > > > +	struct uacce_device *uacce = q->uacce;
> > > > +	struct uacce_qfile_region *qfr;
> > > > +	enum uacce_qfrt type = 0;
> > > > +	unsigned int flags = 0;
> > > > +	int ret;
> > > > +
> > > > +	if (vma->vm_pgoff < UACCE_QFRT_MAX)
> > > > +		type = vma->vm_pgoff;
> > > > +
> > > > +	vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND;
> > > > +
> > > > +	mutex_lock(&uacce_mutex);
> 
> By the way, lockdep detects a possible unsafe locking scenario here,
> because we're taking the uacce_mutex even though mmap called us with the
> mmap_sem held for writing. Conversely uacce_fops_release() takes the
> mmap_sem for writing while holding the uacce_mutex. I think it can be
> fixed easily, if we simply remove the use of mmap_sem in
> uacce_fops_release(), since it's only taken to do some accounting which
> doesn't look right.

I think you need to remove the RLIMIT_DATA accounting altogether. Assume
it is not an issue for now and revisit latter when it becomes one as i
am not sure we want to add this queue memory accounting to RLIMIT_DATA
in the first place. Maybe a memory cgroup. In anycases it is safer to
delay this discussion to latter.

Cheers,
Jérôme

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ