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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Jun 2013 10:54:11 +0200
From:	Michael Holzheu <holzheu@...ux.vnet.ibm.com>
To:	HATAYAMA Daisuke <d.hatayama@...fujitsu.com>
Cc:	HATAYAMA Daisuke <d.hatayama@...il.com>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	kexec@...ts.infradead.org, Jan Willeke <willeke@...ibm.com>,
	linux-kernel@...r.kernel.org,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Vivek Goyal <vgoyal@...hat.com>
Subject: Re: [PATCH v5 3/5] vmcore: Introduce remap_oldmem_pfn_range()

On Thu, 13 Jun 2013 10:32:48 +0900
HATAYAMA Daisuke <d.hatayama@...fujitsu.com> wrote:

> > Perhaps one open issue remains:
> >
> > Can we remove the page from the page cache if __read_vmcore() fails?
> >  
> 
> Yes, use page_cache_release() after unlocking the page like:
> 
>                     if (__read_vmcore(buf, PAGE_SIZE, &src, 0) < 0) {
>                             unlock_page(page);
> +                          page_cache_release(page);
>                             return VM_FAULT_SIGBUS;
>                     }
> 
> BTW, you now keep file->f_mapping in vma->vm_private_data, but the vma already has the file object in its vma->vm_file member. You can get the mapping by vma->vm_file->f_mapping without necessity of vma->vm_private_data.

Hello Hatayama,

Here the new function:

static int mmap_vmcore_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
        struct address_space *mapping = vma->vm_file->f_mapping;
        pgoff_t index = vmf->pgoff;
        struct page *page;
        loff_t src;
        char *buf;
        int rc;

        page = find_or_create_page(mapping, index, GFP_KERNEL);
        if (!page)
                return VM_FAULT_OOM;
        if (!PageUptodate(page)) {
                src = index << PAGE_CACHE_SHIFT;
                buf = (void *) (page_to_pfn(page) << PAGE_SHIFT);
                rc = __read_vmcore(buf, PAGE_SIZE, &src, 0);
                if (rc < 0) {
                        unlock_page(page);
                        page_cache_release(page);
                        return (rc == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS;
                }
                SetPageUptodate(page);
        }
        unlock_page(page);
        vmf->page = page;
        return 0;
}

Thanks for all the constructive feedback!

Best Regards,
Michael

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