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: <CAPhsuW7p=xw41EZ-f+UHMO+o5bLFGirORPE-gfnkYqfpjv-rzw@mail.gmail.com>
Date:   Fri, 12 May 2023 18:05:19 -0700
From:   Song Liu <song@...nel.org>
To:     linan666@...weicloud.com
Cc:     neilb@...e.de, Rob.Becker@...erbed.com, linux-raid@...r.kernel.org,
        linux-kernel@...r.kernel.org, linan122@...wei.com,
        yukuai3@...wei.com, yi.zhang@...wei.com, houtao1@...wei.com,
        yangerkun@...wei.com
Subject: Re: [PATCH v2 1/4] md/raid10: fix slab-out-of-bounds in md_bitmap_get_counter

On Fri, May 5, 2023 at 6:24 PM <linan666@...weicloud.com> wrote:
>
> From: Li Nan <linan122@...wei.com>
>
> If we write a large number to md/bitmap_set_bits, md_bitmap_checkpage()
> will return -EINVAL because "page >= bitmap->pages", but the return value
> was not checked immediately in md_bitmap_get_counter() in order to set
> *blocks value and slab-out-of-bounds occurs.
>
> Return directly if err is -EINVAL.
>
> Fixes: ef4256733506 ("md/bitmap: optimise scanning of empty bitmaps.")
> Signed-off-by: Li Nan <linan122@...wei.com>
> Reviewed-by: Yu Kuai <yukuai3@...wei.com>
> ---
>  drivers/md/md-bitmap.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 920bb68156d2..0b41ef422da7 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -1388,6 +1388,8 @@ __acquires(bitmap->lock)
>         int err;
>
>         err = md_bitmap_checkpage(bitmap, page, create, 0);
> +       if (err == -EINVAL)
> +               return NULL;

This logic is error prone. Since we are on it, let's fix it better.
Specifically, we can move "page >= bitmap->pages" check out
of md_bitmap_checkpage(). (and fix the call site in md_bitmap_resize
for clustered md).

Also, could you please add a mdadm test for this issue?

Thanks,
Song

>
>         if (bitmap->bp[page].hijacked ||
>             bitmap->bp[page].map == NULL)
> --
> 2.31.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ