mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinyang He <hejinyang@loongson.cn>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] MIPS: relocatable: Use __kaslr_offset in show_kernel_relocation
Date: Fri, 5 Feb 2021 09:55:01 +0800	[thread overview]
Message-ID: <a2f9868c-707c-6f63-e5e4-956354d241e4@loongson.cn> (raw)
In-Reply-To: <20210204153623.GA14818@alpha.franken.de>

On 02/04/2021 11:36 PM, Thomas Bogendoerfer wrote:

> On Wed, Feb 03, 2021 at 06:35:10PM +0800, Jinyang He wrote:
>> The type of the VMLINUX_LOAD_ADDRESS macro is the (unsigned long long)
>> in 32bits kernel but (unsigned long) in the 64-bit kernel. Although there
>> is no error here, avoid using it to calculate kaslr_offset. And here we
>> may need is that the address of __kaslr_offset rather than (void *)offset.
>>
>> Signed-off-by: Jinyang He <hejinyang@loongson.cn>
>> ---
>>   arch/mips/kernel/relocate.c | 8 ++------
>>   1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
>> index 95abb9c..52018a3 100644
>> --- a/arch/mips/kernel/relocate.c
>> +++ b/arch/mips/kernel/relocate.c
>> @@ -430,13 +430,9 @@ void *__init relocate_kernel(void)
>>    */
>>   static void show_kernel_relocation(const char *level)
>>   {
>> -	unsigned long offset;
>> -
>> -	offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
>> -
>> -	if (IS_ENABLED(CONFIG_RELOCATABLE) && offset > 0) {
>> +	if (__kaslr_offset > 0) {
>>   		printk(level);
>> -		pr_cont("Kernel relocated by 0x%pK\n", (void *)offset);
>> +		pr_cont("Kernel relocated by 0x%pK\n", &__kaslr_offset);
> are you sure ? I would have expected (void *)__kaslr_offset here.
>
> Thomas.
>
It is my fault. I misunderstood the meaning of 'by' and '@' because of
my poor English. Thank you for pointing out my fault. I'll send v3 later.

Thanks,
Jinyang


      reply	other threads:[~2021-02-05  1:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 10:35 [PATCH v2 1/2] MIPS: relocatable: Provide kaslr_offset() to get the kernel offset Jinyang He
2021-02-03 10:35 ` [PATCH v2 2/2] MIPS: relocatable: Use __kaslr_offset in show_kernel_relocation Jinyang He
2021-02-04 15:36   ` Thomas Bogendoerfer
2021-02-05  1:55     ` Jinyang He [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=a2f9868c-707c-6f63-e5e4-956354d241e4@loongson.cn \
    --to=hejinyang@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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

all inboxes | Powered by JetHome®