Bug 1476219 - If there is white space before the path in /etc/kdump.conf. The vmcore will be dumped at the default location and not the path mentioned.
If there is white space before the path in /etc/kdump.conf. The vmcore will ...
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kexec-tools (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: Bhupesh Sharma
Ziqian SUN (Zamir)
Depends On:
Blocks: 1469549 1473055
  Show dependency treegraph
Reported: 2017-07-28 06:29 EDT by Kenneth D'souza
Modified: 2017-08-18 05:39 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
kdumpctl file with spacefunction to detect white space. (26.71 KB, application/x-shellscript)
2017-07-28 06:35 EDT, Kenneth D'souza
no flags Details

  None (edit)
Description Kenneth D'souza 2017-07-28 06:29:38 EDT
Description of problem:

When a white space is introduced before the path parameter.The vmocre is dumped on the default location /var/crash and not the path that was given.

The path is ignored and the service still restarts without any errors.

Version-Release number of selected component (if applicable):

On all RHEL 7 versions.

How reproducible:

Steps to Reproduce:

  mkdir /tmp/crash

1.Edit /etc/kdump.conf

     path /tmp/crash --------------->> Introduce space before the path.

2. systemctl restart kdump 

I analysed the mkdumprd and kdumpctl code, they would ignore the path and the default /var/kdump path would be set as there is no code to remove spaces.

3.Crash the kernel and check that the dump is stored in /var/kdump and not /tmp/kdump.

Expected results:

In RHEL 6 even if white space were mentioned the vmcore would be dumped at the path given and not default path.

This does not work in RHEL 7.

We can either say that there should be no space before the path by failing the service.


We will have to change the code and remove the spaces in /etc/kdump.conf file.

The code of sed that would delete the spaces in RHEL 6 is not in RHEL 7.

sed 's/^\s\+//' ------------->> To remove the spaces.

The above change must be done in all code files of mkdumprd and kdumpctl.

The save_path and other code will have to be passed

Correct me if I am wrong.


We can do the below and fail the kdump service by saying no white spaces are allowed before the config parameters. That would be an easy fix.

I changed the below code in /usr/bin/kdumpctl

#Performs a check on white spaces in a file.

sed 's/^\s\+//' /etc/kdump.conf > /tmp/space.conf #This command will remove white spaces if there are any
if cmp -s "$KDUMP_CONFIG_FILE" "$exclude_space"  
 return 0
    echo "There is space before config options"
   echo "The /etc/kdump.conf file contains space, please check if there are any white spaces before config options"
  return 1

Call the space function at sanity checking of invalid parameters in configuraion file. 

Call space in  ------------->> Line number 291

 space  || return 1 


Snippet /sbin/mkdumprd 

sed 's/^\s\+//' ------>> This is not impemented before grep ^path

SAVE_PATH=$(grep ^path $conf_file| cut -d' '  -f2)
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)


The same is not implemented in Snippet /usr/bin/kdumpctl

	local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}')
	if [ -z "$_save_path" ]; then
	echo $_save_path


Additional info:
Comment 2 Kenneth D'souza 2017-07-28 06:35 EDT
Created attachment 1305890 [details]
kdumpctl file with spacefunction to detect white space.
Comment 3 Kenneth D'souza 2017-07-28 09:25:52 EDT
sorry for the typo:

3.Crash the kernel and check that the dump is stored in /var/crash and not /tmp/crash.

Note You need to log in before you can comment on or make changes to this bug.