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:	Mon, 17 Nov 2008 19:07:38 +0100
From:	Jens Axboe <jens.axboe@...cle.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Jeremy Fitzhardinge <jeremy@...p.org>, Ingo Molnar <mingo@...e.hu>,
	Tejun Heo <htejun@...il.com>,
	Arjan van de Ven <arjan@...radead.org>,
	Hugh Dickins <hugh@...itas.com>, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org
Subject: Re: [PATCH] Fix kunmap() argument in sg_miter_stop

On Mon, Nov 17 2008, Linus Torvalds wrote:
> 
> 
> On Mon, 17 Nov 2008, Jeremy Fitzhardinge wrote:
> 
> > Pass the struct page * to kunmap, not the vaddr of the mapping itself.
> > 
> > Pointed out by Jens Axboe <jens.axboe@...cle.com>
> > 
> > Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> > ---
> > drivers/xen/balloon.c |    2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > ===================================================================
> > --- a/drivers/xen/balloon.c
> > +++ b/drivers/xen/balloon.c
> > @@ -120,7 +120,7 @@
> > 	if (PageHighMem(page)) {
> > 		void *v = kmap(page);
> > 		clear_page(v);
> > -		kunmap(v);
> > +		kunmap(page);
> > 	} else {
> > 		void *v = page_address(page);
> > 		clear_page(v);
> 
> Well, quite frankly, the whole thing looks like crud.
> 
> First off, 'kmap/kunmap' work on regular pages too. So if you're highmem 
> aware, you should just do
> 
> 	void *v = kmap(page);
> 	clear_page(v);
> 	kunmap(page);
> 
> and be done with it. 
> 
> Secondly, we actually have a function called "clear_highpage()" that does 
> this, except it uses kmap_atomic(page, KM_USER0). Which is _probably 
> better anyway, but I didn't check if there is some magical reason why it 
> wouldn't work.

Indeed, scrub_page() should just be eliminated.

Any opinions on the kunmap/kunmap_atomic pointer checking? It's a bit
ugly that we have to enforce a void * rule for kunmap_atomic(), but
it'll definitely catch bugs. So I think it's worth it, I'd like to hear
your opinion before I queue it for 2.6.29 though.

-- 
Jens Axboe

--
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