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:   Thu, 8 Feb 2018 07:00:25 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     Laurent Dufour <ldufour@...ux.vnet.ibm.com>
Cc:     paulmck@...ux.vnet.ibm.com, peterz@...radead.org,
        akpm@...ux-foundation.org, kirill@...temov.name,
        ak@...ux.intel.com, mhocko@...nel.org, dave@...olabs.net,
        jack@...e.cz, benh@...nel.crashing.org, mpe@...erman.id.au,
        paulus@...ba.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, hpa@...or.com,
        Will Deacon <will.deacon@....com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        kemi.wang@...el.com, sergey.senozhatsky.work@...il.com,
        Daniel Jordan <daniel.m.jordan@...cle.com>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        haren@...ux.vnet.ibm.com, khandual@...ux.vnet.ibm.com,
        npiggin@...il.com, bsingharora@...il.com,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        linuxppc-dev@...ts.ozlabs.org, x86@...nel.org
Subject: Re: [PATCH v7 04/24] mm: Dont assume page-table invariance during
 faults

On Thu, Feb 08, 2018 at 03:35:58PM +0100, Laurent Dufour wrote:
> I reviewed that part of code, and I think I could now change the way
> pte_unmap_safe() is checking for the pte's value. Since we now have all the
> needed details in the vm_fault structure, I will pass it to
> pte_unamp_same() and deal with the VMA checks when locking for the pte as
> it is done in the other part of the page fault handler by calling
> pte_spinlock().

This does indeed look much better!  Thank you!

> This means that this patch will be dropped, and pte_unmap_same() will become :
> 
> static inline int pte_unmap_same(struct vm_fault *vmf, int *same)
> {
> 	int ret = 0;
> 
> 	*same = 1;
> #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
> 	if (sizeof(pte_t) > sizeof(unsigned long)) {
> 		if (pte_spinlock(vmf)) {
> 			*same = pte_same(*vmf->pte, vmf->orig_pte);
> 			spin_unlock(vmf->ptl);
> 		}
> 		else
> 			ret = VM_FAULT_RETRY;
> 	}
> #endif
> 	pte_unmap(vmf->pte);
> 	return ret;
> }

I'm not a huge fan of auxiliary return values.  Perhaps we could do this
instead:

	ret = pte_unmap_same(vmf);
	if (ret != VM_FAULT_NOTSAME) {
		if (page)
			put_page(page);
		goto out;
	}
	ret = 0;

(we have a lot of unused bits in VM_FAULT_, so adding a new one shouldn't
be a big deal)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ