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: <20200713130632.GA29945@infradead.org>
Date:   Mon, 13 Jul 2020 14:06:32 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     Palmer Dabbelt <palmer@...belt.com>
Cc:     mick@....forth.gr, mark.rutland@....com, gregory.0xf0@...il.com,
        peterz@...radead.org, catalin.marinas@....com,
        linus.walleij@...aro.org,
        Palmer Dabbelt <palmerdabbelt@...gle.com>,
        brendanhiggins@...gle.com, elver@...gle.com, glider@...gle.com,
        krzk@...nel.org, mchehab+samsung@...nel.org, will@...nel.org,
        mingo@...nel.org, uwe@...ine-koenig.org,
        takahiro.akashi@...aro.org, paulmck@...nel.org,
        masahiroy@...nel.org, linux@...linux.org.uk, willy@...radead.org,
        rppt@...ux.ibm.com, bgolaszewski@...libre.com,
        kernel-team@...roid.com, pmladek@...e.com, zaslonko@...ux.ibm.com,
        keescook@...omium.org, Arnd Bergmann <arnd@...db.de>,
        broonie@...nel.org, matti.vaittinen@...rohmeurope.com,
        ben-linux@...ff.org, dan.j.williams@...el.com,
        linux-arm-kernel@...ts.infradead.org, davidgow@...gle.com,
        rdunlap@...radead.org, Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kernel@...r.kernel.org, mhiramat@...nel.org, ardb@...nel.org,
        akpm@...ux-foundation.org, davem@...emloft.net
Subject: Re: [PATCH 1/3] lib: Add a generic copy_oldmem_page()

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ