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: <CAPSr9jHmx8unVN3rsQzGSSc4hYL2wafw20D8QKf8NG65dX7ErQ@mail.gmail.com>
Date:   Mon, 1 Apr 2019 22:21:58 +0800
From:   Muchun Song <smuchun@...il.com>
To:     Catalin Marinas <catalin.marinas@....com>
Cc:     will.deacon@....com, akpm@...ux-foundation.org,
        rppt@...ux.vnet.ibm.com,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Florian Fainelli <f.fainelli@...il.com>, logang@...tatee.com,
        robin.murphy@....com, ghackmann@...roid.com, hannes@...xchg.org,
        stefan@...er.ch, david@...hat.com,
        linux-arm-kernel@...ts.infradead.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arm64: mm: fix max_mapnr is assigned the wrong value

Hi Catalin,

Thanks for your reply.  In fact, I didn't hit any problem.  I just read the code
and found the problem. I see max_mapnr is to only be used in the
generic pfn_valid().
As you said, we do not use it on arm64.  So in a sense, the patch is
meaningless.

But I think since it is a problem, why not fix it (Even if max_mapnr
is not be used)?
What is your opinion?

Catalin Marinas <catalin.marinas@....com> 于2019年4月1日周一 下午6:44写道:
>
> On Sat, Mar 30, 2019 at 09:13:46PM +0800, Muchun Song wrote:
> > When we not use flat memory, the mem_map will be NULL and
> > pfn_to_page(max_pfn) is a pointer which is located in kernel space. So
> > max_mapnr is assigned a very large number(e.g., 0xffffxxxx_xxxxxxxx) - fix
> > it.
> >
> > Signed-off-by: Muchun Song <smuchun@...il.com>
> > ---
> >  arch/arm64/mm/init.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> > index bc02818fa48b..e86c21a44c88 100644
> > --- a/arch/arm64/mm/init.c
> > +++ b/arch/arm64/mm/init.c
> > @@ -535,7 +535,7 @@ void __init mem_init(void)
> >       else
> >               swiotlb_force = SWIOTLB_NO_FORCE;
> >
> > -     set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
> > +     set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
> >
> >  #ifndef CONFIG_SPARSEMEM_VMEMMAP
> >       free_unused_memmap();
>
> The patch looks fine but did you actually hit any problem? max_mapnr
> seems to only be used in the generic pfn_valid() which we do not use on
> arm64 (just wondering if it needs a cc stable; it doesn't look like as
> it's not a regression).
>
> --
> Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ