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
| ||
|
Date: Thu, 26 Jan 2012 11:12:47 -0800 From: Dave Hansen <dave@...ux.vnet.ibm.com> To: Seth Jennings <sjenning@...ux.vnet.ibm.com> CC: Greg Kroah-Hartman <gregkh@...e.de>, Nitin Gupta <ngupta@...are.org>, Dan Magenheimer <dan.magenheimer@...cle.com>, Brian King <brking@...ux.vnet.ibm.com>, Konrad Wilk <konrad.wilk@...cle.com>, linux-mm@...ck.org, devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH 1/5] staging: zsmalloc: zsmalloc memory allocation library On 01/09/2012 02:51 PM, Seth Jennings wrote: > + area = &get_cpu_var(zs_map_area); > + if (off + class->size <= PAGE_SIZE) { > + /* this object is contained entirely within a page */ > + area->vm_addr = kmap_atomic(page); > + } else { > + /* this object spans two pages */ > + struct page *nextp; > + > + nextp = get_next_page(page); > + BUG_ON(!nextp); > + > + > + set_pte(area->vm_ptes[0], mk_pte(page, PAGE_KERNEL)); > + set_pte(area->vm_ptes[1], mk_pte(nextp, PAGE_KERNEL)); > + > + /* We pre-allocated VM area so mapping can never fail */ > + area->vm_addr = area->vm->addr; > + } This bit appears to be trying to make kmap_atomic() variant that can map two pages in to contigious virtual addresses. Instead of open-coding it in a non-portable way like this, should we just make a new kmap_atomic() variant that does this? >From the way it's implemented, I _think_ you're guaranteed to get two contiguous addresses if you do two adjacent kmap_atomics() on the same CPU: void *kmap_atomic_prot(struct page *page, pgprot_t prot) { ... type = kmap_atomic_idx_push(); idx = type + KM_TYPE_NR*smp_processor_id(); vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); I think if you do a get_cpu()/put_cpu() or just a preempt_disable() across the operations you'll be guaranteed to get two contiguous addresses. -- 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