All of lore.kernel.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Dave Anderson <anderson@redhat.com>
Cc: Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, kernel-hardening@lists.openwall.com,
	Aaron Durbin <adurbin@google.com>,
	Eric Northup <digitaleric@google.com>,
	Julien Tinnes <jln@google.com>, Will Drewry <wad@google.com>,
	Mathias Krause <minipli@googlemail.com>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Discussion list for crash utility usage,
	maintenance and development" <crash-utility@redhat.com>
Subject: [kernel-hardening] Re: [PATCH 6/7] x86, kaslr: report kernel offset on panic
Date: Tue, 08 Oct 2013 18:52:36 +0900	[thread overview]
Message-ID: <5253D5E4.7060004@jp.fujitsu.com> (raw)
In-Reply-To: <1678208981.2178058.1381152105871.JavaMail.root@redhat.com>

(2013/10/07 22:21), Dave Anderson wrote:

> ----- Original Message -----
>> (2013/10/03 22:47), Dave Anderson wrote:

>>> ----- Original Message -----
>>>> (2013/10/02 18:13), HATAYAMA Daisuke wrote:
>>>>> (2013/10/02 16:48), Kees Cook wrote:

>>
>> Thanks for detailed explanation. So, there's already a feature in crash utility
>> to address relocation!, though it's better for me to try them to check if it's
>> really applicable to this feature. My concern is whether --reloc works well
>> on x86_64 too, because relocation has never done on x86_64 ever, right?
>
> Correct.
>
>> Another concern is that in case of relocation, users need to additional information
>> regarding runtime symbol information to crash utility. I want to avoid additional
>> process, automation is preferable if possible.
>
> Right.  As I mentioned in the case of 32-bit x86 dumpfiles, there is no automation
> available when CONFIG_PHYSICAL_START is larger than CONFIG_PHYSICAL_ALIGN.  The user
> either has to be aware of their values in order to calculate the --reloc argument,
> or has to capture a copy of the /proc/kallsyms file on the crashed system.  Typically
> users/distros using kdump changed their x86 configurations to avoid having to deal
> with that.
>

Sorry, I don't understand why relocation size cannot be calculated when
CONFIG_PHYSICALSTART > CONFIG_PHYSICAL_ALIGN. Could you explain that?

>> I guess it's enough if there's runtime symbol addresses because we can get relocated
>> offset value by comparing it with the compile-time symbol address contained in
>> a given debuginfo file. Candidates for such symbols are the ones contained in
>> VMCOREINFO note containing some symbol values for makedumpfile to refer to mm-related
>> objects in kernel, which is always contained in vmcore generated by current kdump and
>> also vmcores converted by makedumpfile from it. How about this idea?
>
> But how would that differ from using an incorrect (non-matching) vmlinux file?
>

It seems to me almost similar to what crash currently does even if we do relocation check.
The current check crash currently does is trial-and-error since there's no information
indicating given vmcore and vmlinuxcertainly match well.

For example, the process I imagine is:

   1) try to match vmcore and vmlinux with no relocation. If fails, go to 2).
   2) try to match vmcore and vmlinux with relocation.

The two steps include symbol table initialization so it might actually be difficult to
resume back from 2) to 1).

Also, if gap due to phys_base and gap due to relocation can happen at the same time,
calculating two values automatically might be futher complicated. So, it would be better
to add relocation value in VMCOREINFO. Then, what crash utility sholud do becomes very simple.

BTW, can it really happen that gaps due to phys_base and due to relocation happen at the
same time? I feel relocation covers phys_base mechanism. If there's relocation, phys_base
is not necessary.

-- 
Thanks.
HATAYAMA, Daisuke

WARNING: multiple messages have this Message-ID (diff)
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Dave Anderson <anderson@redhat.com>
Cc: Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, kernel-hardening@lists.openwall.com,
	Aaron Durbin <adurbin@google.com>,
	Eric Northup <digitaleric@google.com>,
	Julien Tinnes <jln@google.com>, Will Drewry <wad@google.com>,
	Mathias Krause <minipli@googlemail.com>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Discussion list for crash utility usage,
	maintenance and development"  <crash-utility@redhat.com>
Subject: Re: [PATCH 6/7] x86, kaslr: report kernel offset on panic
Date: Tue, 08 Oct 2013 18:52:36 +0900	[thread overview]
Message-ID: <5253D5E4.7060004@jp.fujitsu.com> (raw)
In-Reply-To: <1678208981.2178058.1381152105871.JavaMail.root@redhat.com>

(2013/10/07 22:21), Dave Anderson wrote:

> ----- Original Message -----
>> (2013/10/03 22:47), Dave Anderson wrote:

>>> ----- Original Message -----
>>>> (2013/10/02 18:13), HATAYAMA Daisuke wrote:
>>>>> (2013/10/02 16:48), Kees Cook wrote:

>>
>> Thanks for detailed explanation. So, there's already a feature in crash utility
>> to address relocation!, though it's better for me to try them to check if it's
>> really applicable to this feature. My concern is whether --reloc works well
>> on x86_64 too, because relocation has never done on x86_64 ever, right?
>
> Correct.
>
>> Another concern is that in case of relocation, users need to additional information
>> regarding runtime symbol information to crash utility. I want to avoid additional
>> process, automation is preferable if possible.
>
> Right.  As I mentioned in the case of 32-bit x86 dumpfiles, there is no automation
> available when CONFIG_PHYSICAL_START is larger than CONFIG_PHYSICAL_ALIGN.  The user
> either has to be aware of their values in order to calculate the --reloc argument,
> or has to capture a copy of the /proc/kallsyms file on the crashed system.  Typically
> users/distros using kdump changed their x86 configurations to avoid having to deal
> with that.
>

Sorry, I don't understand why relocation size cannot be calculated when
CONFIG_PHYSICALSTART > CONFIG_PHYSICAL_ALIGN. Could you explain that?

>> I guess it's enough if there's runtime symbol addresses because we can get relocated
>> offset value by comparing it with the compile-time symbol address contained in
>> a given debuginfo file. Candidates for such symbols are the ones contained in
>> VMCOREINFO note containing some symbol values for makedumpfile to refer to mm-related
>> objects in kernel, which is always contained in vmcore generated by current kdump and
>> also vmcores converted by makedumpfile from it. How about this idea?
>
> But how would that differ from using an incorrect (non-matching) vmlinux file?
>

It seems to me almost similar to what crash currently does even if we do relocation check.
The current check crash currently does is trial-and-error since there's no information
indicating given vmcore and vmlinuxcertainly match well.

For example, the process I imagine is:

   1) try to match vmcore and vmlinux with no relocation. If fails, go to 2).
   2) try to match vmcore and vmlinux with relocation.

The two steps include symbol table initialization so it might actually be difficult to
resume back from 2) to 1).

Also, if gap due to phys_base and gap due to relocation can happen at the same time,
calculating two values automatically might be futher complicated. So, it would be better
to add relocation value in VMCOREINFO. Then, what crash utility sholud do becomes very simple.

BTW, can it really happen that gaps due to phys_base and due to relocation happen at the
same time? I feel relocation covers phys_base mechanism. If there's relocation, phys_base
is not necessary.

-- 
Thanks.
HATAYAMA, Daisuke


  reply	other threads:[~2013-10-08  9:52 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 19:37 [kernel-hardening] [PATCH v6 0/7] Kernel base address randomization Kees Cook
2013-10-01 19:37 ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 1/7] x86, kaslr: move CPU flags out of cpucheck Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-01 20:48   ` [kernel-hardening] " H. Peter Anvin
2013-10-01 20:48     ` H. Peter Anvin
2013-10-01 21:09     ` [kernel-hardening] " Kees Cook
2013-10-01 21:09       ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 2/7] x86, kaslr: return location from decompress_kernel Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 3/7] x86, kaslr: find minimum safe relocation position Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 4/7] x86, kaslr: select random base offset Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-01 20:46   ` [kernel-hardening] " H. Peter Anvin
2013-10-01 20:46     ` H. Peter Anvin
2013-10-01 21:18     ` [kernel-hardening] " Kees Cook
2013-10-01 21:18       ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 5/7] x86, kaslr: select memory region from e820 maps Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 6/7] x86, kaslr: report kernel offset on panic Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-02  0:38   ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-02  0:38     ` HATAYAMA Daisuke
2013-10-02  1:06     ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-02  1:06       ` HATAYAMA Daisuke
2013-10-02  7:51       ` [kernel-hardening] " Kees Cook
2013-10-02  7:51         ` Kees Cook
2013-10-02  7:48     ` [kernel-hardening] " Kees Cook
2013-10-02  7:48       ` Kees Cook
2013-10-02  9:13       ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-02  9:13         ` HATAYAMA Daisuke
2013-10-03  0:33         ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-03  0:33           ` HATAYAMA Daisuke
2013-10-03 13:47           ` [kernel-hardening] " Dave Anderson
2013-10-03 13:47             ` Dave Anderson
2013-10-07  1:59             ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-07  1:59               ` HATAYAMA Daisuke
2013-10-07 13:21               ` [kernel-hardening] " Dave Anderson
2013-10-07 13:21                 ` Dave Anderson
2013-10-08  9:52                 ` HATAYAMA Daisuke [this message]
2013-10-08  9:52                   ` HATAYAMA Daisuke
2013-10-08 13:38                   ` [kernel-hardening] " Dave Anderson
2013-10-08 13:38                     ` Dave Anderson
2013-10-09 10:04                     ` [kernel-hardening] " HATAYAMA Daisuke
2013-10-09 10:04                       ` HATAYAMA Daisuke
2013-10-09 14:13                       ` [kernel-hardening] " H. Peter Anvin
2013-10-09 14:13                         ` H. Peter Anvin
2013-10-09 18:06                       ` [kernel-hardening] " Kees Cook
2013-10-09 18:06                         ` Kees Cook
2013-10-01 19:37 ` [kernel-hardening] [PATCH 7/7] x86, kaslr: raise max positions to 1GiB on x86_64 Kees Cook
2013-10-01 19:37   ` Kees Cook
2013-10-02  5:07 ` [kernel-hardening] Re: [PATCH v6 0/7] Kernel base address randomization Ingo Molnar
2013-10-02  5:07   ` Ingo Molnar
2013-10-02  5:11   ` [kernel-hardening] " H. Peter Anvin
2013-10-02  5:11     ` H. Peter Anvin
2013-10-02  5:25     ` [kernel-hardening] " Ingo Molnar
2013-10-02  5:25       ` Ingo Molnar
2013-10-02  5:30       ` [kernel-hardening] " H. Peter Anvin
2013-10-02  5:30         ` H. Peter Anvin
2013-10-02  5:36         ` [kernel-hardening] " Kees Cook
2013-10-02  5:36           ` Kees Cook

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=5253D5E4.7060004@jp.fujitsu.com \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=adurbin@google.com \
    --cc=anderson@redhat.com \
    --cc=crash-utility@redhat.com \
    --cc=digitaleric@google.com \
    --cc=hpa@zytor.com \
    --cc=jln@google.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minipli@googlemail.com \
    --cc=wad@google.com \
    --cc=x86@kernel.org \
    --cc=zhangyanfei@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.