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: <1215634012.18506.21.camel@localhost.localdomain>
Date:	Wed, 09 Jul 2008 22:06:52 +0200
From:	Miquel van Smoorenburg <miquels@...tron.nl>
To:	James Bottomley <James.Bottomley@...senPartnership.com>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>,
	David Howells <dhowells@...hat.com>, akpm@...ux-foundation.org,
	alan@...hat.com, Markus.Lidel@...dowconnect.com, vvs@...ru,
	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: [PATCH] Mark i2o config broken on 64-bit platforms.

On Wed, 2008-07-09 at 14:59 -0500, James Bottomley wrote:
> On Wed, 2008-07-09 at 21:22 +0200, Miquel van Smoorenburg wrote:
> > On Wed, 2008-07-09 at 14:13 -0500, James Bottomley wrote:
> > > On Wed, 2008-07-09 at 21:06 +0200, Miquel van Smoorenburg wrote:
> > > > On Wed, 2008-07-09 at 16:49 +0100, Alan Cox wrote:
> > > > > On Wed, 09 Jul 2008 15:15:14 +0100
> > > > > David Howells <dhowells@...hat.com> wrote:
> > > > > 
> > > > > > Miquel van Smoorenburg <miquels@...tron.nl> wrote:
> > > > > > Maybe, but have you looked at i2o_cfg_passthru()?  Take this, for example:
> > > > > > 
> > > > > > 			/* Allocate memory for the transfer */
> > > > > > 			p = kmalloc(sg_size, GFP_KERNEL);
> > > > > > 			...
> > > > > > 			//TODO 64bit fix
> > > > > > 			sg[i].addr_bus = virt_to_bus(p);
> > > > > > 
> > > > > > That looks distinctly dodgy.  virt_to_bus() returns a 64-bit address, and as
> > > > > 
> > > > > Agreed - stick | GFP_DMA32 on the end then ;)
> > > > 
> > > > GFP_DMA32 doesn't work with kmalloc(), you need dma_alloc_coherent() or
> > > > pci_alloc_consistent() [here, i2o_dma_alloc() ]
> > > 
> > > Yes it does ... it was specifically designed for it.  GFP_DMA32 was
> > > introduced to allow this type of thing to happen (in the old days most
> > > drivers were allowed to assume kmalloc would return memory whose
> > > physical address was < 4GB; GFP_DMA32 allows that to continue while
> > > allowing kmalloc to stray beyond 4GB physical).
> > 
> > If you use alloc_pages(), yes. But not for kmalloc(). There are no
> > general GFP_DMA32 slabs.
> 
> No ... it's platform specific.  Platforms whose ZONE_NORMAL covers only
> up to 4GB need do nothing.  However, x86_64 definitely implements
> ZONE_DMA32 for precisely this.  Several other platforms (like ia64)
> should but don't.

I tried  using it before (for dpt_i2o.c) and it didn't work.

I re-read quite a bit of kernel code before I posted this, and I could
not find GFP_DMA32 slabs. There are also no calls to kmalloc(size,
GFP_...|GFP_DMA32) in the recent kernels I checked. And google tells me
things like
http://lkml.org/lkml/2007/5/17/267

So I don't think GFP_DMA32 works with kmalloc. GFP_DMA does though.

Mike.

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