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:   Sat, 5 Oct 2019 06:46:40 +0800
From:   Wei Yang <richardw.yang@...ux.intel.com>
To:     Andrea Arcangeli <aarcange@...hat.com>
Cc:     Wei Yang <richardw.yang@...ux.intel.com>,
        linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
        linux-fsdevel@...r.kernel.org, Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH] fs/userfaultfd.c: simplify the calculation of new_flags

On Wed, Oct 02, 2019 at 08:45:05PM -0400, Andrea Arcangeli wrote:
>Hello,
>
>On Tue, Aug 06, 2019 at 01:38:59PM +0800, Wei Yang wrote:
>> Finally new_flags equals old vm_flags *OR* vm_flags.
>> 
>> It is not necessary to mask them first.
>> 
>> Signed-off-by: Wei Yang <richardw.yang@...ux.intel.com>
>> ---
>>  fs/userfaultfd.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
>> index ccbdbd62f0d8..653d8f7c453c 100644
>> --- a/fs/userfaultfd.c
>> +++ b/fs/userfaultfd.c
>> @@ -1457,7 +1457,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
>>  			start = vma->vm_start;
>>  		vma_end = min(end, vma->vm_end);
>>  
>> -		new_flags = (vma->vm_flags & ~vm_flags) | vm_flags;
>> +		new_flags = vma->vm_flags | vm_flags;
>>  		prev = vma_merge(mm, prev, start, vma_end, new_flags,
>>  				 vma->anon_vma, vma->vm_file, vma->vm_pgoff,
>>  				 vma_policy(vma),
>
>And then how do you clear the flags after the above?
>
>It must be possible to clear the flags (from
>UFFDIO_REGISTER_MODE_MISSING|UFFDIO_REGISTER_MODE_WP to only one set
>or invert).
>
>We have no WP support upstream yet, so maybe that's why it looks
>superfluous in practice, but in theory it isn't because it would then
>need to be reversed by Peter's (CC'ed) -wp patchset.
>
>The register code has already the right placeholder to support -wp and
>so it's better not to break them.
>
>I would recommend reviewing the uffd-wp support and working on testing
>the uffd-wp code instead of changing the above.
>

Sorry, I don't get your point. This change is valid to me even from arithmetic
point of view.

    vm_flags == VM_UFFD_MISSING | VM_UFFD_WP

The effect of current code is clear these two bits then add them. This equals
to just add these two bits.

I am not sure which part I lost.

>Thanks,
>Andrea

-- 
Wei Yang
Help you, Help me

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ