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: <1522431689.2693.290.camel@hpe.com>
Date:   Fri, 30 Mar 2018 17:41:50 +0000
From:   "Kani, Toshi" <toshi.kani@....com>
To:     "xieyisheng1@...wei.com" <xieyisheng1@...wei.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "guohanjun@...wei.com" <guohanjun@...wei.com>,
        "tanxiaojun@...wei.com" <tanxiaojun@...wei.com>,
        "wangzhou1@...ilicon.com" <wangzhou1@...ilicon.com>,
        "kstewart@...uxfoundation.org" <kstewart@...uxfoundation.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "arnd@...db.de" <arnd@...db.de>, "jcm@...hat.com" <jcm@...hat.com>
Subject: Re: [RFC PATCH] lib/ioremap: Avoid triggering BUG_ON when end is not
 PAGE_ALIGN

On Fri, 2018-03-30 at 12:49 +0800, Yisheng Xie wrote:
> Zhou reported a bug on Hisilicon arm64 D06 platform with 64KB page size:
 :
> The cause is the size of PCI IO resource is 32KB, which is 4K aligned but
> not 64KB aligned, so when do ioremap_pte_range(), its incoming end is not
> PAGE_ALIGN on 64KB page size system, but ioremap_pte_range increase the
> addr by PAGE_SIZE, which makes addr != end until trigger BUG_ON.
> 
> This patch introduces pte_addr_end(addr, end) to resolve this problem, just
> as what pmd_addr_end do. When end is not PAGE_ALIGN, it will return end
> instead of addr + PAGE_SIZE, therefore ioremap_pte_range() can break out
> when real end is coming.

ioremap_pte_range() assumes that addr and end are aligned by PAGE_SIZE. 
While some improvement can be made in the range check and documentation,
 I do not think it is safe for letting this library function to map
outside of a requested range blindly.

Can you change the caller of ioremap_page_range() to align the request
by PAGE_SIZE so that the caller is aware of what it's asking for? 

Thanks,
-Toshi

Powered by blists - more mailing lists