From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Christophe LEROY <christophe.leroy@c-s.fr>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Anton Blanchard <anton@samba.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: Are those hacks still valid on powerpc kernel ?
Date: Thu, 25 Jan 2018 10:49:42 +1100 [thread overview]
Message-ID: <1516837782.2312.10.camel@kernel.crashing.org> (raw)
In-Reply-To: <c0b2f3ad-3247-1b80-8789-e120c3ebd8bc@c-s.fr>
On Wed, 2018-01-24 at 11:17 +0100, Christophe LEROY wrote:
> Below comments are very old.
>
> Aren't new glibc and binutils now able to go without this ?
>
> Note that the code inside the #if 0 is wrong as we have no vma defined
> in the function.
>
> Or does it just have no performance impact anyway ?
>
>
> From /arch/powerpc/mm/mem.c:
>
> void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
> {
> clear_page(page);
>
> /*
> * We shouldn't have to do this, but some versions of glibc
> * require it (ld.so assumes zero filled pages are icache clean)
> * - Anton
> */
> flush_dcache_page(pg);
> }
> EXPORT_SYMBOL(clear_user_page);
Well, I think it would be a security issue to potentially leave garbage
icache content (possibly instructions from another process) accessible
to userspace. So I don't think we can avoid that one.
> void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
> struct page *pg)
> {
> copy_page(vto, vfrom);
>
> /*
> * We should be able to use the following optimisation, however
> * there are two problems.
> * Firstly a bug in some versions of binutils meant PLT sections
> * were not marked executable.
> * Secondly the first word in the GOT section is blrl, used
> * to establish the GOT address. Until recently the GOT was
> * not marked executable.
> * - Anton
> */
> #if 0
> if (!vma->vm_file && ((vma->vm_flags & VM_EXEC) == 0))
> return;
> #endif
Well, we try not to break userspace.... This doesn't affect newer CPUs
that much because they have CPU_FTR_COHERENT_ICACHE, so
flush_dcache_page is pretty much a nop on them.
Cheers,
Ben.
> flush_dcache_page(pg);
> }
>
> Christophe
prev parent reply other threads:[~2018-01-24 23:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 10:17 Are those hacks still valid on powerpc kernel ? Christophe LEROY
2018-01-24 23:49 ` Benjamin Herrenschmidt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516837782.2312.10.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=anton@samba.org \
--cc=christophe.leroy@c-s.fr \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).