Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1368043 > unrolled thread

[PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot

Started byMatt Redfearn <matt.redfearn@imgtec.com>
First post2016-03-31 11:20 +0200
Last post2016-04-01 11:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot Matt Redfearn <matt.redfearn@imgtec.com> - 2016-03-31 11:20 +0200
    Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on  boot Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-03-31 14:40 +0200
      Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on  boot Ralf Baechle <ralf@linux-mips.org> - 2016-04-01 10:50 +0200
        Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on  boot Matt Redfearn <matt.redfearn@imgtec.com> - 2016-04-01 11:10 +0200

#1368043 — [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot

FromMatt Redfearn <matt.redfearn@imgtec.com>
Date2016-03-31 11:20 +0200
Subject[PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot
Message-ID<riGVI-2I1-17@gated-at.bofh.it>
When debugging a relocated kernel, the addresses of the relocated
symbols and the offset applied is essential information. If the kernel
is compiled with debugging information, then print this information
during bootup using the same function as the panic notifer.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---

Changes in v2: None

 arch/mips/kernel/setup.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index d8376d7b3345..ae71f8d9b555 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -477,9 +477,18 @@ static void __init bootmem_init(void)
 	 */
 	if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
 		unsigned long offset;
+		extern void show_kernel_relocation(const char *level);
 
 		offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
 		free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
+
+#if (defined CONFIG_DEBUG_KERNEL) && (defined CONFIG_DEBUG_INFO)
+		/*
+		 * This information is necessary when debugging the kernel
+		 * But is a security vulnerability otherwise!
+		 */
+		show_kernel_relocation(KERN_INFO);
+#endif
 	}
 #endif
 
-- 
2.5.0

[toc] | [next] | [standalone]


#1368248 — Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-03-31 14:40 +0200
SubjectRe: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot
Message-ID<riK3h-531-31@gated-at.bofh.it>
In reply to#1368043
Hello.

On 3/31/2016 12:05 PM, Matt Redfearn wrote:

> When debugging a relocated kernel, the addresses of the relocated
> symbols and the offset applied is essential information. If the kernel
> is compiled with debugging information, then print this information
> during bootup using the same function as the panic notifer.

    Notifier.

> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
> ---
>
> Changes in v2: None
>
>   arch/mips/kernel/setup.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index d8376d7b3345..ae71f8d9b555 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -477,9 +477,18 @@ static void __init bootmem_init(void)
>   	 */
>   	if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
>   		unsigned long offset;
> +		extern void show_kernel_relocation(const char *level);
>
>   		offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
>   		free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
> +
> +#if (defined CONFIG_DEBUG_KERNEL) && (defined CONFIG_DEBUG_INFO)

    Not #if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)?

[...]

MBR, Sergei

[toc] | [prev] | [next] | [standalone]


#1369111 — Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot

FromRalf Baechle <ralf@linux-mips.org>
Date2016-04-01 10:50 +0200
SubjectRe: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot
Message-ID<rj2We-1Lk-11@gated-at.bofh.it>
In reply to#1368248
On Thu, Mar 31, 2016 at 03:38:10PM +0300, Sergei Shtylyov wrote:

> >When debugging a relocated kernel, the addresses of the relocated
> >symbols and the offset applied is essential information. If the kernel
> >is compiled with debugging information, then print this information
> >during bootup using the same function as the panic notifer.
> 
>    Notifier.

Fixed when merging.

> >Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
> >---
> >
> >Changes in v2: None
> >
> >  arch/mips/kernel/setup.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> >diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> >index d8376d7b3345..ae71f8d9b555 100644
> >--- a/arch/mips/kernel/setup.c
> >+++ b/arch/mips/kernel/setup.c
> >@@ -477,9 +477,18 @@ static void __init bootmem_init(void)
> >  	 */
> >  	if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
> >  		unsigned long offset;
> >+		extern void show_kernel_relocation(const char *level);
> >
> >  		offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
> >  		free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
> >+
> >+#if (defined CONFIG_DEBUG_KERNEL) && (defined CONFIG_DEBUG_INFO)
> 
>    Not #if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)?
> 
> [...]

CPP syntax is not what most people seem to believe that is the parenthesis
around the argument of defined are not required so above line is unusual
but perfectly ok.  However following boring standards is good so I changed
this, too.

  Ralf

[toc] | [prev] | [next] | [standalone]


#1369118 — Re: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot

FromMatt Redfearn <matt.redfearn@imgtec.com>
Date2016-04-01 11:10 +0200
SubjectRe: [PATCH v2 11/11] MIPS: KASLR: Print relocation Information on boot
Message-ID<rj3fA-2as-23@gated-at.bofh.it>
In reply to#1369111

On 01/04/16 09:44, Ralf Baechle wrote:
> On Thu, Mar 31, 2016 at 03:38:10PM +0300, Sergei Shtylyov wrote:
>
>>> When debugging a relocated kernel, the addresses of the relocated
>>> symbols and the offset applied is essential information. If the kernel
>>> is compiled with debugging information, then print this information
>>> during bootup using the same function as the panic notifer.
>>     Notifier.
> Fixed when merging.
>
>>> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
>>> ---
>>>
>>> Changes in v2: None
>>>
>>>   arch/mips/kernel/setup.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
>>> index d8376d7b3345..ae71f8d9b555 100644
>>> --- a/arch/mips/kernel/setup.c
>>> +++ b/arch/mips/kernel/setup.c
>>> @@ -477,9 +477,18 @@ static void __init bootmem_init(void)
>>>   	 */
>>>   	if (__pa_symbol(_text) > __pa_symbol(VMLINUX_LOAD_ADDRESS)) {
>>>   		unsigned long offset;
>>> +		extern void show_kernel_relocation(const char *level);
>>>
>>>   		offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
>>>   		free_bootmem(__pa_symbol(VMLINUX_LOAD_ADDRESS), offset);
>>> +
>>> +#if (defined CONFIG_DEBUG_KERNEL) && (defined CONFIG_DEBUG_INFO)
>>     Not #if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)?
>>
>> [...]
> CPP syntax is not what most people seem to believe that is the parenthesis
> around the argument of defined are not required so above line is unusual
> but perfectly ok.  However following boring standards is good so I changed
> this, too.
>
>    Ralf

Great, thanks Ralf.

Matt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web