From: Baoquan He <bhe@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
mingo@kernel.org, hpa@zytor.com, kirill@shutemov.name,
keescook@chromium.org, yamada.masahiro@socionext.com,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, thgarnie@google.com, mike.travis@hpe.com,
frank.ramsay@hpe.com
Subject: Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size
Date: Mon, 8 Apr 2019 15:54:14 +0800 [thread overview]
Message-ID: <20190408075414.GA3856@localhost.localdomain> (raw)
In-Reply-To: <20190406044348.GA14245@zn.tnic>
On 04/06/19 at 06:43am, Borislav Petkov wrote:
> On Sat, Apr 06, 2019 at 09:51:19AM +0800, Baoquan He wrote:
> > It's KASLR happened in kernel_randomize_memory() of arch/x86/mm/kaslr.c .
>
> What is "KASLR happened in"? This doesn't make any sense. When you look
> at that function, there's a comment above it:
>
> /* Initialize base and padding for each memory region randomized with KASLR */
>
> Do you mean, that, per chance?
>
> > In fact, I don't know how to call it. Previously, I wrote it as mm
> > KASLR, to distinguish from KASLR during kernel decompression. Ingo
> > blamed the name,
>
> Of course he did, because it didn't make any sense to him either.
>
> > so I changed it to memory region KASLR. Seems Thomas
> > Garnier called it KASLR for kernel memory regions in his original KASLR
> > adding patch. May I call it 'KASLR for kernel memory regions', or 'KASLR
> > for memory regions'?
>
> So you're fixing kaslr_regions[0].size_tb. It's base gets initialized to
> page_offset_base.
>
> Now, if you look at
>
> Documentation/x86/x86_64/mm.txt
>
> it says there:
>
> ffff888000000000 | -119.5 TB | ffffc87fffffffff | 64 TB | direct mapping of all physical memory (page_offset_base)
>
> so that is the direct mapping memory region of all physical memory.
>
> Now, you're apparently fixing its size.
>
> Am I making sense and are you catching my drift?
Yes, makes sense. I will make it more specific, and use
kernel_randomize_memory() instead to indicate the place where code issue
is found out. Thanks.
>
> You need to explain what you change in your commit messages in
> *understandable* english so that reviewer/committer or even a person
> who's not deeply involved in KASLR inner workings, can at least get an
> idea about what the commit message is talking about.
>
> If you come up with strange constructs like "memory region KASLR" or
> "KASLR happened in" or "mm KASLR" which only make sense in your head,
> you're not doing anyone any favour.
>
> Commit messages need to be very understandable when someone is looking
> at them months or even years from now. And you need to restrain yourself
> when you write them. You will appreciate that the first time you have to
> do git archeology, dig out an ancient commit and wonder why we did it
> this way.
>
> Because we didn't document as good in previous years and our commits
> from the past suck big time.
>
> Thanks!
>
> --
> Regards/Gruss,
> Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.
next prev parent reply other threads:[~2019-04-08 7:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 2:03 [PATCH 0/2] x86/mm/KASLR: Fix two code bugs Baoquan He
2019-04-04 2:03 ` [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size Baoquan He
2019-04-05 16:58 ` Borislav Petkov
2019-04-05 17:22 ` Thomas Gleixner
2019-04-06 1:55 ` Baoquan He
2019-04-06 1:51 ` Baoquan He
2019-04-06 4:43 ` Borislav Petkov
2019-04-08 7:54 ` Baoquan He [this message]
2019-04-04 2:03 ` [PATCH 2/2] x86/mm/KASLR: Calculate the actual size of vmemmap region 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=20190408075414.GA3856@localhost.localdomain \
--to=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=frank.ramsay@hpe.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mike.travis@hpe.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=thgarnie@google.com \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
/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