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: <CAK8P3a0F4JSBAG5B=GRFF9Aw0kJaNd=cph86sHqjAtiONUA-Bw@mail.gmail.com>
Date:   Mon, 13 Jul 2020 15:39:17 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Palmer Dabbelt <palmer@...belt.com>,
        Nick Kossifidis <mick@....forth.gr>,
        Mark Rutland <mark.rutland@....com>,
        Gregory Fong <gregory.0xf0@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Palmer Dabbelt <palmerdabbelt@...gle.com>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Marco Elver <elver@...gle.com>,
        Alexander Potapenko <glider@...gle.com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Uwe Kleine-König <uwe@...ine-koenig.org>,
        AKASHI Takahiro <takahiro.akashi@...aro.org>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Russell King - ARM Linux <linux@...linux.org.uk>,
        Matthew Wilcox <willy@...radead.org>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Android Kernel Team <kernel-team@...roid.com>,
        Petr Mladek <pmladek@...e.com>, zaslonko@...ux.ibm.com,
        Kees Cook <keescook@...omium.org>,
        Mark Brown <broonie@...nel.org>,
        "Vaittinen, Matti" <matti.vaittinen@...rohmeurope.com>,
        Ben Dooks <ben-linux@...ff.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        David Gow <davidgow@...gle.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Ard Biesheuvel <ardb@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Miller <davem@...emloft.net>
Subject: Re: [PATCH 1/3] lib: Add a generic copy_oldmem_page()

On Mon, Jul 13, 2020 at 3:07 PM Christoph Hellwig <hch@...radead.org> wrote:
> On Fri, Jul 10, 2020 at 08:55:42PM -0700, Palmer Dabbelt wrote:
> > +ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
> > +                      size_t csize, unsigned long offset,
> > +                      int userbuf)
> > +{
> > +     void *vaddr;
> > +
> > +     if (!csize)
> > +             return 0;
> > +
> > +     vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB);
> > +     if (!vaddr)
> > +             return -ENOMEM;
>
> Doing a memremap for every page is very inefficient.  Also I don't see
> why you'd want to even do that.  All memory is in the direct mapping
> for RISC-V.  For other architecture that support highmem kmap_atomic_pfn
> would do the job, which is what I'd use in a generic version.

I would expect the 'oldmem' data to not have a 'struct page', which would
be a problem at least for the generic implementation of kmap_atomic_pfn()

include/linux/highmem.h:#define kmap_atomic_pfn(pfn)
kmap_atomic(pfn_to_page(pfn))

kmap_atomic() might still work with a bogus page pointer if it
only transforms it back into a pfn, but some implementations just
have this one that cannot work:
static inline void *page_address(const struct page *page)
{
        return page->virtual;
}

I have not checked how the crash dump code works though, maybe
it does work after all.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ