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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANe_+Ui+1wyC8XS-9BsGKUCtzgEA0DuFMVbE95Y3QitEkF5jyA@mail.gmail.com>
Date:   Mon, 20 Dec 2021 12:16:29 +0000
From:   Mark Hemment <markhemm@...glemail.com>
To:     NeilBrown <neilb@...e.de>
Cc:     Trond Myklebust <trond.myklebust@...merspace.com>,
        Anna Schumaker <anna.schumaker@...app.com>,
        Chuck Lever <chuck.lever@...cle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mel Gorman <mgorman@...e.de>,
        Christoph Hellwig <hch@...radead.org>,
        David Howells <dhowells@...hat.com>, linux-nfs@...r.kernel.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/18] MM: use ->swap_rw for reads from SWP_FS_OPS swap-space

On Thu, 16 Dec 2021 at 23:54, NeilBrown <neilb@...e.de> wrote:
>
> To submit an async read with ->swap_rw() we need to allocate
> a structure to hold the kiocb and other details.  swap_readpage() cannot
> handle transient failure, so create a mempool to provide the structures.
>
> Signed-off-by: NeilBrown <neilb@...e.de>
> ---
>  mm/page_io.c  |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++------
>  mm/swap.h     |    1 +
>  mm/swapfile.c |    5 +++++
>  3 files changed, 58 insertions(+), 6 deletions(-)
...
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index f23d9ff21cf8..43539be38e68 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -2401,6 +2401,11 @@ static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span)
>                 if (ret < 0)
>                         return ret;
>                 sis->flags |= SWP_ACTIVATED;
> +               if ((sis->flags & SWP_FS_OPS) &&
> +                   sio_pool_init() != 0) {
> +                       destroy_swap_extents(sis);
> +                       return -ENOMEM;
> +               }
>                 return ret;
>         }

This code is called before 'swapon_mutex' is taken in the swapon code
path, so possible for multiple swapons to race here creating two (or
more) memory pools.

Mark

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ