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: <20180126180242.ziek4kxdkimlawnw@armageddon.cambridge.arm.com>
Date:   Fri, 26 Jan 2018 18:02:43 +0000
From:   Catalin Marinas <catalin.marinas@....com>
To:     Marek Szyprowski <m.szyprowski@...sung.com>
Cc:     Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Will Deacon <will.deacon@....com>,
        linux-kernel@...r.kernel.org, Inki Dae <inki.dae@...sung.com>,
        Russell King <rmk+kernel@....linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC 2/2] arm64: compat: cacheflush syscall: process only pages
 that are in the memory

On Fri, Jan 26, 2018 at 05:41:45PM +0000, Catalin Marinas wrote:
> On Fri, Jan 26, 2018 at 12:14:41PM +0100, Marek Szyprowski wrote:
> > @@ -32,23 +33,36 @@
> >  static long
> >  __do_compat_cache_op(unsigned long start, unsigned long end)
> [...]
> > +		if (follow_page(vma, start, 0)) {
> > +			ret = __flush_cache_user_range(start, start + chunk);
> > +			if (ret)
> > +				goto done;
> > +		}
> 
> This looks pretty expensive for pages already in memory. Could we do
> some tricks with the AT instruction in __flush_cache_user_range() so
> that we skip the flushing if the page isn't there? We know that when a
> page is mapped, the cache will get cleaned/invalidated via set_pte_at()
> + sync_icache_dcache(), so the only problem of a race is flushing the
> caches twice for a page. If a page gets unmapped after AT, we may bring
> it back through the cache ops.

Alternatively, we could try to use pagefault_disable()/enable() around
this but we need to make sure we cover all the cases where a page may
not be flushed even when it is actually present (i.e. old pte). For
example, ptep_set_access_flags() skips __sync_icache_dcache().

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ