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: <20130726151621.GA5037@linux.vnet.ibm.com>
Date:	Fri, 26 Jul 2013 10:16:21 -0500
From:	Robert Jennings <rcj@...ux.vnet.ibm.com>
To:	Dave Hansen <dave@...1.net>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org, Alexander Viro <viro@...iv.linux.org.uk>,
	Rik van Riel <riel@...hat.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Matt Helsley <matt.helsley@...il.com>,
	Anthony Liguori <aliguori@...ibm.com>,
	Michael Roth <mdroth@...ux.vnet.ibm.com>,
	Lei Li <lilei@...ux.vnet.ibm.com>,
	Leonardo Garcia <lagarcia@...ux.vnet.ibm.com>
Subject: Re: [RFC PATCH 1/2] vmsplice unmap gifted pages for recipient

* Dave Hansen (dave@...1.net) wrote:
> On 07/25/2013 10:21 AM, Robert Jennings wrote:
> > +static void zap_buf_page(unsigned long useraddr)
> > +{
> > +	struct vm_area_struct *vma;
> > +
> > +	down_read(&current->mm->mmap_sem);
> > +	vma = find_vma_intersection(current->mm, useraddr,
> > +			useraddr + PAGE_SIZE);
> > +	if (!IS_ERR_OR_NULL(vma))
> > +		zap_page_range(vma, useraddr, PAGE_SIZE, NULL);
> > +	up_read(&current->mm->mmap_sem);
> > +}
> > +
> >  /**
> >   * splice_to_pipe - fill passed data into a pipe
> >   * @pipe:	pipe to fill
> > @@ -212,8 +224,16 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
> >  			buf->len = spd->partial[page_nr].len;
> >  			buf->private = spd->partial[page_nr].private;
> >  			buf->ops = spd->ops;
> > -			if (spd->flags & SPLICE_F_GIFT)
> > +			if (spd->flags & SPLICE_F_GIFT) {
> > +				unsigned long useraddr =
> > +						spd->partial[page_nr].useraddr;
> > +
> > +				if ((spd->flags & SPLICE_F_MOVE) &&
> > +				    !buf->offset && (buf->len == PAGE_SIZE))
> > +					/* Can move page aligned buf */
> > +					zap_buf_page(useraddr);
> >  				buf->flags |= PIPE_BUF_FLAG_GIFT;
> > +			}
> 
> There isn't quite enough context here, but is it going to do this
> zap_buf_page() very often?  Seems a bit wasteful to do the up/down and
> find_vma() every trip through the loop.

The call to zap_buf_page() is in a loop where each pipe buffer is being
processed, but in that loop we have a pipe_wait() where we schedule().
So as things are structured I don't have the ability to hold mmap_sem
for multiple find_vma() calls.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ