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]
Message-ID: <CA+EESO6-W7SidFxz8+5FL-Jqu5L4pUZTpYVJ+2xdktxXgwXE5Q@mail.gmail.com>
Date:   Tue, 25 Oct 2022 11:44:20 -0700
From:   Lokesh Gidra <lokeshgidra@...gle.com>
To:     Axel Rasmussen <axelrasmussen@...gle.com>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Peter Xu <peterx@...hat.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: Re: [PATCH] userfaultfd: wake on unregister for minor faults as well
 as missing

Thanks for fixing this issue.

On Tue, Oct 25, 2022 at 11:21 AM Axel Rasmussen
<axelrasmussen@...gle.com> wrote:
>
> This was an overlooked edge case when minor faults were added. In
> general, minor faults have the same rough edge here as missing faults:
> if we unregister while there are waiting threads, they will just remain
> waiting forever, as there is no way for userspace to wake them after
> unregistration. To work around this, userspace needs to carefully wake
> everything before unregistering.
Actually, WAKE ioctl doesn't check if the provided range is registered
with userfaultfd or not. So, it's possible to wake the waiting threads
after unregisteration.

But, in this context, missing faults are the same as minor faults (and
wp too?). Therefore, waking the waiting threads as part of
unregistration is expected.
>
> So, wake for minor faults just like we already do for missing faults as
> part of the unregistration process.
>
> Cc: stable@...r.kernel.org
> Fixes: 7677f7fd8be7 ("userfaultfd: add minor fault registration mode")
> Reported-by: Lokesh Gidra <lokeshgidra@...gle.com>
> Signed-off-by: Axel Rasmussen <axelrasmussen@...gle.com>
> ---
>  fs/userfaultfd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 07c81ab3fd4d..7daee4b9481c 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -1606,7 +1606,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
>                         start = vma->vm_start;
>                 vma_end = min(end, vma->vm_end);
>
> -               if (userfaultfd_missing(vma)) {
> +               if (userfaultfd_missing(vma) || userfaultfd_minor(vma)) {
>                         /*
>                          * Wake any concurrent pending userfault while
>                          * we unregister, so they will not hang
> --
> 2.38.0.135.g90850a2211-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ