From: Ingo Molnar <mingo@kernel.org>
To: Borislav Petkov <bp@suse.de>
Cc: Baoquan He <bhe@redhat.com>,
tglx@linutronix.de, hpa@zytor.com, mingo@redhat.com,
linux-kernel@vger.kernel.org, x86@kernel.org,
keescook@chromium.org, yinghai@kernel.org, anderson@redhat.com,
luto@kernel.org, thgarnie@google.com, kuleshovmail@gmail.com
Subject: Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE
Date: Thu, 16 Mar 2017 09:14:29 +0100 [thread overview]
Message-ID: <20170316081429.GA28585@gmail.com> (raw)
In-Reply-To: <20170303152319.yensbclmz6uomoyy@pd.tnic>
* Borislav Petkov <bp@suse.de> wrote:
> Ok,
>
> TBH, I still don't like adding yet another define and paying attention
> to whether I should use image size or mapping size. After your patch,
> KERNEL_IMAGE_SIZE is used to enforce the actual image size from
> exploding:
>
> arch/x86/include/asm/page_32_types.h:43:#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
> arch/x86/include/asm/page_32_types.h:49:#define KERNEL_MAPPING_SIZE KERNEL_IMAGE_SIZE
> arch/x86/include/asm/page_64_types.h:56:#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
> arch/x86/include/asm/pgtable_32.h:83: * (KERNEL_IMAGE_SIZE/4096) / 1024 pages (worst case, non PAE)
> arch/x86/include/asm/pgtable_32.h:84: * (KERNEL_IMAGE_SIZE/4096) / 512 + 4 pages (worst case for PAE)
> arch/x86/include/asm/pgtable_32.h:91: * KERNEL_IMAGE_SIZE should be greater than pa(_end)
> arch/x86/kernel/vmlinux.lds.S:356:. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
> arch/x86/kernel/vmlinux.lds.S:357: "kernel image bigger than KERNEL_IMAGE_SIZE");
> arch/x86/kernel/vmlinux.lds.S:370:. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
> arch/x86/kernel/vmlinux.lds.S:371: "kernel image bigger than KERNEL_IMAGE_SIZE");
>
> So what I'd do is keep KERNEL_IMAGE_SIZE and make it default 1G and use it
> everywhere.
>
> Then, define a separate define which is used only in vmlinux.lds.S to
> enforce the size check. Having MAPPING_SIZE and IMAGE_SIZE is just
> needlessly confusing.
That sounds like the right solution to me - having two values is asking for
trouble.
Thanks,
Ingo
next prev parent reply other threads:[~2017-03-16 8:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 12:54 [PATCH v4 0/3] x86/64/KASLR: Change kernel mapping size to 1G unconditionally Baoquan He
2017-02-02 12:54 ` [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE Baoquan He
2017-02-14 17:32 ` Borislav Petkov
2017-02-26 4:09 ` Baoquan He
2017-03-03 11:43 ` Borislav Petkov
2017-03-03 12:06 ` Baoquan He
2017-03-03 12:16 ` Borislav Petkov
2017-03-03 12:52 ` Baoquan He
2017-03-03 13:11 ` Baoquan He
2017-03-03 14:28 ` Borislav Petkov
2017-03-03 15:07 ` Baoquan He
2017-03-03 15:08 ` Baoquan He
2017-03-03 15:23 ` Borislav Petkov
2017-03-04 10:10 ` Baoquan He
2017-03-04 11:55 ` Borislav Petkov
2017-03-04 13:59 ` Baoquan He
2017-03-16 8:14 ` Ingo Molnar [this message]
2017-03-16 9:44 ` Baoquan He
2017-02-02 12:54 ` [PATCH v4 2/3] x86/64/KASLR: Change kernel mapping size to 1G unconditionally Baoquan He
2017-02-02 12:54 ` [PATCH v4 3/3] x86/64/doc: Update the ranges of kernel text and modules mapping Baoquan He
2017-02-02 19:40 ` [PATCH v4 0/3] x86/64/KASLR: Change kernel mapping size to 1G unconditionally Kees Cook
2017-03-04 14:26 ` Baoquan He
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=20170316081429.GA28585@gmail.com \
--to=mingo@kernel.org \
--cc=anderson@redhat.com \
--cc=bhe@redhat.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=thgarnie@google.com \
--cc=x86@kernel.org \
--cc=yinghai@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).