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:	Wed, 10 Dec 2008 22:23:01 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Gilad Ben-Yossef <gilad@...efidence.com>
Cc:	Laurent Pinchart <laurent.pinchart@...net.be>,
	LKML <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
Subject: Re: [PATCH] USB: use stack allocation for struct usb_ctrlrequest

On Wed, Dec 10, 2008 at 04:07:14PM +0200, Gilad Ben-Yossef wrote:
> Wu Fengguang wrote:
> 
> > Hi Laurent,
> >
> > On Wed, Dec 10, 2008 at 11:40:09AM +0200, Laurent Pinchart wrote:
> >   
> >> Hi Wu,
> >>
> >> On Wednesday 10 December 2008, Wu Fengguang wrote:
> >>     
> >>> sizeof(struct usb_ctrlrequest) = 8, which is as small as the *dt pointer
> >>> in a 64bit system.
> >>>       
> >> The usb_ctrlrequest pointer is passed down to the hardware and must point to 
> >> DMA-able memory. For this reason you can't use the stack and must kmalloc() 
> >> the structure.
> >>     
> >
> > Ah thanks for the background. Does GFP_NOIO guarantee that?
> >   
> No, GFP_NOIO means - do not generate block IO operations (e.g. move 
> pages to swap, sync dirty buffers to permanent storage etc.) in order to 
> fulfill this allocation.
> 
> The reason for this flag here is presumably that such block IO 
> operations may very cause USB transaction of the very same kind we're 
> trying to service now, which can easily get us to a loop.

Right.

> > e.g. what if the memory is allocated from ZONE_HIGHMEM?
> >   
> In many cases there is no problem to DMA high memory. If you happen to 
> be working with a device that does have problems with full 32 bit 
> addresses then GFP_DMA would be the right flag, not GFP_NOIO.

For 64bit systems, we can easily go beyond 4GB physical memory.
So at least we should add GFP_DMA32 in addition to GFP_NOIO?

Thanks,
Fengguang

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