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, 15 Sep 2010 08:32:50 +0200
From:	Miklos Szeredi <miklos@...redi.hu>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	JBeulich@...ell.com, linux-kernel@...r.kernel.org, rjw@...k.pl,
	miklos@...redi.hu
Subject: Re: [PATCH] use clear_page()/copy_page() in favor of
 memset()/memcpy() on whole pages

On Tue, 14 Sep 2010, Andrew Morton wrote:
> On Thu, 02 Sep 2010 13:30:37 +0100
> "Jan Beulich" <JBeulich@...ell.com> wrote:
> 
> > After all that's what they are intended for.
> > 
> > ...
> >
> > --- linux-2.6.36-rc3/fs/fuse/dev.c
> > +++ 2.6.36-rc3-use-clear_page/fs/fuse/dev.c
> > @@ -811,7 +811,7 @@ static int fuse_copy_page(struct fuse_co
> >  
> >  	if (page && zeroing && count < PAGE_SIZE) {
> >  		void *mapaddr = kmap_atomic(page, KM_USER1);
> > -		memset(mapaddr, 0, PAGE_SIZE);
> > +		clear_page(mapaddr);
> >  		kunmap_atomic(mapaddr, KM_USER1);
> >  	}
> >  	while (count) {
> 
> fuse wanted to use clear_highpage() here.  But clear_highpage() uses
> KM_USER0.  I don't immediately see why fuse uses KM_USER1 here?

There used to be KM_USER0 kmaps in there, but now they've been
replaced with plain kmaps.  So switching to clear_highpage() should be
fine.

Incremental patch appended.

Thanks,
Miklos
----

Subject: fuse: use clear_highpage() and  KM_USER0 instead of KM_USER1
From: Miklos Szeredi <mszeredi@...e.cz>

Commit 7909b1c640 (fuse: don't use atomic kmap) removed KM_USER0 usage
from fuse/dev.c.  Switch KM_USER1 uses to KM_USER0 for clarity.  Also
replace open coded clear_highpage().

Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
---
 fs/fuse/dev.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6/fs/fuse/dev.c
===================================================================
--- linux-2.6.orig/fs/fuse/dev.c	2010-09-15 08:22:34.000000000 +0200
+++ linux-2.6/fs/fuse/dev.c	2010-09-15 08:24:30.000000000 +0200
@@ -809,11 +809,9 @@ static int fuse_copy_page(struct fuse_co
 	int err;
 	struct page *page = *pagep;
 
-	if (page && zeroing && count < PAGE_SIZE) {
-		void *mapaddr = kmap_atomic(page, KM_USER1);
-		clear_page(mapaddr);
-		kunmap_atomic(mapaddr, KM_USER1);
-	}
+	if (page && zeroing && count < PAGE_SIZE)
+		clear_highpage(page);
+
 	while (count) {
 		if (cs->write && cs->pipebufs && page) {
 			return fuse_ref_page(cs, page, offset, count);
@@ -830,10 +828,10 @@ static int fuse_copy_page(struct fuse_co
 			}
 		}
 		if (page) {
-			void *mapaddr = kmap_atomic(page, KM_USER1);
+			void *mapaddr = kmap_atomic(page, KM_USER0);
 			void *buf = mapaddr + offset;
 			offset += fuse_copy_do(cs, &buf, &count);
-			kunmap_atomic(mapaddr, KM_USER1);
+			kunmap_atomic(mapaddr, KM_USER0);
 		} else
 			offset += fuse_copy_do(cs, NULL, &count);
 	}
--
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