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]
Message-ID: <4CBC8B99.60806@cyconix.com>
Date:	Mon, 18 Oct 2010 19:02:01 +0100
From:	Tom Brown <sa212+emis@...onix.com>
To:	LKML <linux-kernel@...r.kernel.org>
CC:	Stefan Richter <stefanr@...6.in-berlin.de>,
	Yong Zhang <yong.zhang@...driver.com>,
	Arnd Bergmann <arnd@...db.de>
Subject: Re: Question: how to copy to user space from a tasklet

On 18/10/2010 18:01, Stefan Richter wrote:
> Tom Brown wrote:
>> Thanks, think I'm there:
>>
>> 1 - The user calls mmap() with a specific offset to flag that he wants a
>> DMA buffer
>>
>> 2 - I then 'vmalloc' the buffer, and call 'setPageReserved' for each page
>>
>> I then step over each page, and:
>>
>> 3 - call 'vmalloc_to_pfn' to get a PFN for each page, and then
>>
>> 4 - call 'remap_page_range' for that page (I instead call
>> 'remap_pfn_range' for kernels>= 2.6.10, but I'm on 2.6.9)
>>
>> This gives me the buffer, and the interrupt handler then just uses
>> 'memcpy' to copy data to the user.
>
> I would have thought of a bunch of alloc_page() and vm_insert_page() but I
> don't know if vm_insert_page exists in 2.6.9 and if it honors user limits.

It turns out that I'm getting occasional

"BUG: unable to handle kernel paging request at virtual address 
...[buffer address]"

oops when the driver attempts to 'memcpy' to the buffer, so I think 
'setPageReserved' is probably not the right thing to do.  This is 
strange - it's almost as if 'setPageReserved' stops the page being 
swapped out, but the kernel doesn't know this.

I'll look into alloc_page/vm_insert_page instead.

Thanks -

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