From: Andrey Ryabinin <ryabinin.a.a@gmail.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org,
kasan-dev <kasan-dev@googlegroups.com>,
Alexander Potapenko <glider@google.com>
Subject: Re: [PATCH v2] kasan: account for destructor sections
Date: Fri, 24 Jun 2016 18:26:42 +0300 [thread overview]
Message-ID: <CAPAsAGy7akew4xFDQOwcHaCFEGYFaJUsU1h7neEUzrYG=2cUAQ@mail.gmail.com> (raw)
In-Reply-To: <1466698010-62530-1-git-send-email-dvyukov@google.com>
2016-06-23 19:06 GMT+03:00 Dmitry Vyukov <dvyukov@google.com>:
Subsystem prefix in subject is wrong. Change it to vmlinux.lds
> If CONFIG_KASAN is enabled and gcc is configured with
> --disable-initfini-array, gcc emits .ctors/.dtors and
> .text.startup/.text.exit sections instead of
> .init_array/.fini_array.
> .dtors section is not explicitly accounted in the linker
> script and messes vvar/percpu layout. Want:
As far as I found out this happens if gold linker has been used.
Gcc configuration is irrelevant here.
> ffffffff822bfd80 D _edata
> ffffffff822c0000 D __vvar_beginning_hack
> ffffffff822c0000 A __vvar_page
> ffffffff822c0080 0000000000000098 D vsyscall_gtod_data
> ffffffff822c1000 A __init_begin
> ffffffff822c1000 D init_per_cpu__irq_stack_union
> ffffffff822c1000 A __per_cpu_load
> ffffffff822d3000 D init_per_cpu__gdt_page
>
> Got:
>
> ffffffff8279a600 D _edata
> ffffffff8279b000 A __vvar_page
> ffffffff8279c000 A __init_begin
> ffffffff8279c000 D init_per_cpu__irq_stack_union
> ffffffff8279c000 A __per_cpu_load
> ffffffff8279e000 D __vvar_beginning_hack
> ffffffff8279e080 0000000000000098 D vsyscall_gtod_data
> ffffffff827ae000 D init_per_cpu__gdt_page
>
> This happens because __vvar_page and .vvar get different
> addresses in arch/x86/kernel/vmlinux.lds.S:
>
> . = ALIGN(PAGE_SIZE);
> __vvar_page = .;
>
> .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
> /* work around gold bug 13023 */
> __vvar_beginning_hack = .;
>
> Discard .dtors/.fini_array/.text.exit, since we don't call dtors.
> Merge .text.startup into init text.
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
>
> ---
>
> Changes since v1:
> - discard .dtors
> - don't define .mem sections
> ---
> include/asm-generic/vmlinux.lds.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 6a67ab9..081d0f2 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -542,15 +542,19 @@
>
> #define INIT_TEXT \
> *(.init.text) \
> + *(.text.startup) \
> MEM_DISCARD(init.text)
>
> #define EXIT_DATA \
> *(.exit.data) \
> + *(.fini_array) \
> + *(.dtors) \
> MEM_DISCARD(exit.data) \
> MEM_DISCARD(exit.rodata)
>
> #define EXIT_TEXT \
> *(.exit.text) \
> + *(.text.exit) \
> MEM_DISCARD(exit.text)
>
> #define EXIT_CALL \
> --
> 2.8.0.rc3.226.g39d4020
>
prev parent reply other threads:[~2016-06-24 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 16:06 [PATCH v2] kasan: account for destructor sections Dmitry Vyukov
2016-06-24 15:26 ` Andrey Ryabinin [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='CAPAsAGy7akew4xFDQOwcHaCFEGYFaJUsU1h7neEUzrYG=2cUAQ@mail.gmail.com' \
--to=ryabinin.a.a@gmail.com \
--cc=arnd@arndb.de \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-arch@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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).