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: <CAK1f24kfV0wHVFTmp7YdWMRB8jzncHTiM91kTn9dBtgfnqwdYQ@mail.gmail.com>
Date: Fri, 24 May 2024 11:54:01 +0800
From: Lance Yang <ioworker0@...il.com>
To: Barry Song <21cnbao@...il.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	Barry Song <v-songbaohua@...o.com>, Ryan Roberts <ryan.roberts@....com>, 
	David Hildenbrand <david@...hat.com>, Jeff Xie <xiehuan09@...il.com>, 
	Kefeng Wang <wangkefeng.wang@...wei.com>, Michal Hocko <mhocko@...e.com>, 
	Minchan Kim <minchan@...nel.org>, Muchun Song <songmuchun@...edance.com>, 
	Peter Xu <peterx@...hat.com>, Yang Shi <shy828301@...il.com>, 
	Yin Fengwei <fengwei.yin@...el.com>, "Zach O'Keefe" <zokeefe@...gle.com>, 
	Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>
Subject: Re: [PATCH] mm: arm64: Fix the out-of-bounds issue in contpte_clear_young_dirty_ptes

Thanks a lot for reaching out, Barry!

On Fri, May 24, 2024 at 8:55 AM Barry Song <21cnbao@...il.com> wrote:
>
> From: Barry Song <v-songbaohua@...o.com>
>
> We are passing a huge nr to __clear_young_dirty_ptes() right
> now. While we should pass the number of pages, we are actually

Yes.

It's my mistake - sorry :(

> passing CONT_PTE_SIZE. This is causing lots of crashes of
> MADV_FREE, panic oops could vary everytime.
>
> Fixes: 89e86854fb0a ("mm/arm64: override clear_young_dirty_ptes() batch helper")
> Cc: Lance Yang <ioworker0@...il.com>
> Cc: Barry Song <21cnbao@...il.com>
> Cc: Ryan Roberts <ryan.roberts@....com>
> Cc: David Hildenbrand <david@...hat.com>
> Cc: Jeff Xie <xiehuan09@...il.com>
> Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: Minchan Kim <minchan@...nel.org>
> Cc: Muchun Song <songmuchun@...edance.com>
> Cc: Peter Xu <peterx@...hat.com>
> Cc: Yang Shi <shy828301@...il.com>
> Cc: Yin Fengwei <fengwei.yin@...el.com>
> Cc: Zach O'Keefe <zokeefe@...gle.com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Will Deacon <will@...nel.org>

LGTM.

Acked-by: Lance Yang <ioworker0@...il.com>

> Signed-off-by: Barry Song <v-songbaohua@...o.com>
> ---
>  arch/arm64/mm/contpte.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c
> index 9f9486de0004..a3edced29ac1 100644
> --- a/arch/arm64/mm/contpte.c
> +++ b/arch/arm64/mm/contpte.c
> @@ -376,7 +376,7 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
>          * clearing access/dirty for the whole block.
>          */
>         unsigned long start = addr;
> -       unsigned long end = start + nr;
> +       unsigned long end = start + nr * PAGE_SIZE;
>
>         if (pte_cont(__ptep_get(ptep + nr - 1)))
>                 end = ALIGN(end, CONT_PTE_SIZE);
> @@ -386,7 +386,7 @@ void contpte_clear_young_dirty_ptes(struct vm_area_struct *vma,
>                 ptep = contpte_align_down(ptep);
>         }
>
> -       __clear_young_dirty_ptes(vma, start, ptep, end - start, flags);
> +       __clear_young_dirty_ptes(vma, start, ptep, (end - start) / PAGE_SIZE, flags);
>  }
>  EXPORT_SYMBOL_GPL(contpte_clear_young_dirty_ptes);
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ