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]
Date:	Fri, 4 Dec 2015 22:49:33 +0100
From:	Andrea Arcangeli <aarcange@...hat.com>
To:	Dominik Dingel <dingel@...ux.vnet.ibm.com>
Cc:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	"Jason J. Herne" <jjherne@...ux.vnet.ibm.com>,
	linux-s390@...r.kernel.org, linux-mm@...ck.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Rientjes <rientjes@...gle.com>,
	Eric B Munson <emunson@...mai.com>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Mel Gorman <mgorman@...e.de>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mm: bring in additional flag for fixup_user_fault to
 signal unlock

On Thu, Nov 26, 2015 at 06:27:01PM +0100, Dominik Dingel wrote:
> @@ -599,6 +603,10 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
>  	if (!(vm_flags & vma->vm_flags))
>  		return -EFAULT;
>  
> +	if (unlocked)
> +		fault_flags |= FAULT_FLAG_ALLOW_RETRY;
> +
> +retry:

This should move up before find_extend_vma, otherwise the vma used
below could be a dangling pointer after the "goto retry".

>  	ret = handle_mm_fault(mm, vma, address, fault_flags);
>  	if (ret & VM_FAULT_ERROR) {
>  		if (ret & VM_FAULT_OOM)
> @@ -609,12 +617,21 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
>  			return -EFAULT;
>  		BUG();
>  	}
> -	if (tsk) {
> +	if (tsk && !(fault_flags & FAULT_FLAG_TRIED)) {
>  		if (ret & VM_FAULT_MAJOR)
>  			tsk->maj_flt++;
>  		else
>  			tsk->min_flt++;
>  	}

It'd look cleaner if we'd move the tsk update after the retry check in
case the FAULT_FLAG_TRIED second attempt actually fails, to avoid
recording a fault for a non-really-faulting VM_FAULT_RETRY
attempt. This is what the real page fault does at least so it sounds
cleaner do the same here, but then in practice it makes very little
difference.

> +	if (ret & VM_FAULT_RETRY) {
> +		down_read(&mm->mmap_sem);
> +		if (!(fault_flags & FAULT_FLAG_TRIED)) {
> +			*unlocked = true;
> +			fault_flags &= ~FAULT_FLAG_ALLOW_RETRY;
> +			fault_flags |= FAULT_FLAG_TRIED;
> +			goto retry;
> +		}
> +	}
>  	return 0;
>  }

Rest looks great.

The futex.c should be patched to pass the unlocked pointer in a later
patch but we can also postpone it to a different patchset.

Thanks,
Andrea
--
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