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]
Message-ID: <460A2184.8060207@yahoo.com.au>
Date:	Wed, 28 Mar 2007 18:04:20 +1000
From:	Nick Piggin <nickpiggin@...oo.com.au>
To:	Pekka J Enberg <penberg@...helsinki.fi>
CC:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] revoke: break cow for private mappings

Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@...helsinki.fi>
> 
> We need to break COW for private mappings to make sure a process cannot
> read new data after an inode has been revoked.

Seems OK.

> 
> Signed-off-by: Pekka Enberg <penberg@...helsinki.fi>
> ---
>  fs/revoke.c |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 73 insertions(+), 12 deletions(-)
> 
> Index: uml-2.6/fs/revoke.c
> ===================================================================
> --- uml-2.6.orig/fs/revoke.c	2007-03-26 18:10:24.000000000 +0300
> +++ uml-2.6/fs/revoke.c	2007-03-26 18:27:25.000000000 +0300
> @@ -174,12 +174,58 @@ static inline bool need_revoke(struct vm
>  	if (file->f_path.dentry->d_inode != inode)
>  		return false;
>  
> -	if (!(vma->vm_flags & VM_SHARED))
> -		return false;
> -
>  	return file != to_exclude;
>  }
>  
> +static int __revoke_break_cow(struct task_struct *tsk, struct inode *inode,
> +			      struct file *to_exclude)
> +{
> +	struct mm_struct *mm = tsk->mm;
> +	struct vm_area_struct *vma;
> +	int err = 0;
> +
> +	down_write(&mm->mmap_sem);
> +	for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) {
> +		int ret;
> +
> +		if (vma->vm_flags & VM_SHARED)
> +			continue;
> +
> +		if (!need_revoke(vma, inode, to_exclude))
> +			continue;
> +
> +		ret = get_user_pages(tsk, tsk->mm, vma->vm_start,
> +				     vma->vm_end-vma->vm_start, 1, 1, NULL,
> +				     NULL);

get_user_pages length argument is in # of pages, rather than address range,
I think. vma_pages is what you want?

> +		if (ret < 0) {
> +			err = ret;
> +			break;
> +		}
> +	}
> +	up_write(&mm->mmap_sem);

I think you just need down_read of mmap_sem here?

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 
-
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