kdump now defaults to only dump vmcore to the root partition in the /var/crash directory. This is problematic when /var is a separate file system because this makes saved vmcore hidden since one can not unmount /var even in single user mode. This also has the potential of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action is dump_to_rootfs while different disk is mounted on save path.
Signed-off-by: Baoquan He bhe@redhat.com --- kexec-kdump-howto.txt | 3 +++ mkdumprd | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index 7ffeab9..a43c225 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -430,6 +430,9 @@ There are other default actions available though. - poweroff Poweroff system after failure.
+Note that if default action is set to dump_to_rootfs, kdump will fail +loading of kdump kernel when a different disk is mounted on 'save path'. + Compression and filtering
The 'core_collector' parameter in kdump.conf allows you to specify a custom diff --git a/mkdumprd b/mkdumprd index bc002bc..a86f8bb 100644 --- a/mkdumprd +++ b/mkdumprd @@ -370,6 +370,24 @@ get_default_action_target() return }
+check_default_action_target() +{ + local _target + local _mntpoint + local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}') + if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then + #get rootfs device name + mkdir -p $SAVE_PATH + _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'` + _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'` + if [ "$_mntpoint" != "/" ]; then + perror_exit "$_target is mounted on $_mntpoint" + fi + fi + return +} + + get_override_resettable() { local override_resettable @@ -453,6 +471,8 @@ check_resettable() return 1 }
+check_default_action_target + if ! check_resettable; then exit 1 fi
On Thu, Feb 20, 2014 at 02:00:54PM +0800, Baoquan He wrote:
kdump now defaults to only dump vmcore to the root partition in the /var/crash directory. This is problematic when /var is a separate file system because this makes saved vmcore hidden since one can not unmount /var even in single user mode. This also has the potential of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action is dump_to_rootfs while different disk is mounted on save path.
Hi Bao,
Few things.
- First of all, it does not matter what's the default failure action is. Kdump service should fail irrespective of default action.
- Our default dump target is root disk and path /var/crash. If we detect some disk mounted on /var/crash we fail.
- We should do this checking *only* if user has not specified any disk and path in /etc/kdump.conf. If user has specified root disk in /etc/kdump.conf, then we should continue to dump.
- We need to give a very clear message to user that why dump is failing and what user needs to do to avoid problem.
Thanks Vivek
Signed-off-by: Baoquan He bhe@redhat.com
kexec-kdump-howto.txt | 3 +++ mkdumprd | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index 7ffeab9..a43c225 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -430,6 +430,9 @@ There are other default actions available though.
- poweroff Poweroff system after failure.
+Note that if default action is set to dump_to_rootfs, kdump will fail +loading of kdump kernel when a different disk is mounted on 'save path'.
Compression and filtering
The 'core_collector' parameter in kdump.conf allows you to specify a custom diff --git a/mkdumprd b/mkdumprd index bc002bc..a86f8bb 100644 --- a/mkdumprd +++ b/mkdumprd @@ -370,6 +370,24 @@ get_default_action_target() return }
+check_default_action_target() +{
- local _target
- local _mntpoint
- local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}')
- if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then
#get rootfs device name
mkdir -p $SAVE_PATH
_mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
_target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
if [ "$_mntpoint" != "/" ]; then
perror_exit "$_target is mounted on $_mntpoint"
fi
- fi
- return
+}
get_override_resettable() { local override_resettable @@ -453,6 +471,8 @@ check_resettable() return 1 }
+check_default_action_target
if ! check_resettable; then exit 1 fi -- 1.8.3.1
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 02/20/14 at 12:01pm, Vivek Goyal wrote:
On Thu, Feb 20, 2014 at 02:00:54PM +0800, Baoquan He wrote:
kdump now defaults to only dump vmcore to the root partition in the /var/crash directory. This is problematic when /var is a separate file system because this makes saved vmcore hidden since one can not unmount /var even in single user mode. This also has the potential of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action is dump_to_rootfs while different disk is mounted on save path.
Hi Bao,
Few things.
- First of all, it does not matter what's the default failure action is. Kdump service should fail irrespective of default action.
So we just need focus the fix on default, no need to care about the default failure action which is specified by "default xxx".
- Our default dump target is root disk and path /var/crash. If we detect some disk mounted on /var/crash we fail.
Agree.
- We should do this checking *only* if user has not specified any disk and path in /etc/kdump.conf. If user has specified root disk in /etc/kdump.conf, then we should continue to dump.
Here user has not specificed any disk, but specified a path like "/home/user/test", and there's another disk mounted on this path, doesn't this need to be cared?
I think this should fail and give out en error message.
- We need to give a very clear message to user that why dump is failing and what user needs to do to avoid problem.
Sure, will think about the error message again.
Thanks Vivek
On Mon, Feb 24, 2014 at 04:37:15PM +0800, Baoquan He wrote:
On 02/20/14 at 12:01pm, Vivek Goyal wrote:
On Thu, Feb 20, 2014 at 02:00:54PM +0800, Baoquan He wrote:
kdump now defaults to only dump vmcore to the root partition in the /var/crash directory. This is problematic when /var is a separate file system because this makes saved vmcore hidden since one can not unmount /var even in single user mode. This also has the potential of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action is dump_to_rootfs while different disk is mounted on save path.
Hi Bao,
Few things.
- First of all, it does not matter what's the default failure action is. Kdump service should fail irrespective of default action.
So we just need focus the fix on default, no need to care about the default failure action which is specified by "default xxx".
Yes.
- Our default dump target is root disk and path /var/crash. If we detect some disk mounted on /var/crash we fail.
Agree.
- We should do this checking *only* if user has not specified any disk and path in /etc/kdump.conf. If user has specified root disk in /etc/kdump.conf, then we should continue to dump.
Here user has not specificed any disk, but specified a path like "/home/user/test", and there's another disk mounted on this path, doesn't this need to be cared?
I think this should fail and give out en error message.
What if user decides do dump to root partition (even if there is another disk mounted on /var). I think we should have mechanism to address that.
I see that "path" is uncommented in kdump.conf. So kdump code has to assume that user specified it.
But disk is not uncommented and we take rootfs as default.
So we can do following.
- If dump target is specified in kdump.conf, then just dump to it. User wants it that way.
- If dump target is not mentioned in kdump.conf and are dumping to rootfs by default, in that case we need to check whether there are other disks mounted in "path" and fail service.
The example you gave, yes, there kdump service will fail as user has not specified the disk and there is another disk mounted on /home/user/test path.
Thanks Vivek
On 02/24/14 at 10:54am, Vivek Goyal wrote:
On Mon, Feb 24, 2014 at 04:37:15PM +0800, Baoquan He wrote:
On 02/20/14 at 12:01pm, Vivek Goyal wrote:
On Thu, Feb 20, 2014 at 02:00:54PM +0800, Baoquan He wrote:
- We should do this checking *only* if user has not specified any disk and path in /etc/kdump.conf. If user has specified root disk in /etc/kdump.conf, then we should continue to dump.
Here user has not specificed any disk, but specified a path like "/home/user/test", and there's another disk mounted on this path, doesn't this need to be cared?
I think this should fail and give out en error message.
What if user decides do dump to root partition (even if there is another disk mounted on /var). I think we should have mechanism to address that.
I see that "path" is uncommented in kdump.conf. So kdump code has to assume that user specified it.
But disk is not uncommented and we take rootfs as default.
So we can do following.
If dump target is specified in kdump.conf, then just dump to it. User wants it that way.
If dump target is not mentioned in kdump.conf and are dumping to rootfs by default, in that case we need to check whether there are other disks mounted in "path" and fail service.
The example you gave, yes, there kdump service will fail as user has not specified the disk and there is another disk mounted on /home/user/test path.
Yeah, can't agree more. Thanks for making this clear.
Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec