Bug 1125404

Summary: [RHEL 7] grub2 improperly escapes spaces in kernel parameters
Product: Red Hat Enterprise Linux 7 Reporter: Herton R. Krzesinski <hkrzesin>
Component: grub2Assignee: Peter Jones <pjones>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: jjaburek, mbanas, mkovarik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: grub2-2.02-0.17.el7 Doc Type: Bug Fix
Doc Text:
Cause: In order to support certain types of boot media, grub2 had been made to escape slashes in several different places. One of these was unnecessary, and prevented certain types of command line arguments from being passed to the kernel. Consequence: Kernel command line arguments which need to include escaped characters could not be passed to the kernel correctly. Fix: Remove one of the places we parsed escape characters. Result: Those command line options can work again.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:23:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Herton R. Krzesinski 2014-07-31 18:20:57 UTC
Description of problem:
This is a report of same issue which happened on Fedora and was reported on https://bugzilla.redhat.com/show_bug.cgi?id=923374 (RHEL 7 grub 2 package has the same problematic patch)

On RHEL 7, it's not possible to pass kernel command line parameters with spaces, grub 2 will wrongly escape the espaces with '\x20' and pass the string with it to kernel, the kernel then of course does not recognize it.

This is an annoying limitation, while the Fedora bug report talks about acpi_osi, I noticed this when I was trying to use dynamic debug option (dyndbg=...) of linux kernel (see Documentation/dynamic-debug-howto.txt at kernel sources, current grub2 makes it essentialy unusable). Also it limits Red Hat Support, which may want ask customers to use kernel options with spaces like dyndbg to get debug information on a given issue (I run into this while working on red hat support case 01133035, but luckily on that case debugging is during the installer using syslinux which isn't affected).

Version-Release number of selected component (if applicable):
grub2-2.02-0.2.10.el7

How reproducible:
Always

Steps to Reproduce:
Use any kernel option with spaces, eg.: dyndbg="module cpufreq +p"

Actual results:
Kernel doesn't recognize the kernel option due to extra \x20 in the string

Expected results:
No escaping done on command line options

Comment 1 Herton R. Krzesinski 2014-07-31 18:24:44 UTC
I did a test rebuilding grub2 on RHEL 7, replacing the patch on src.rpm with the fixed one proposed at bug 923374 (https://bugzilla.redhat.com/attachment.cgi?id=911363), and it fixed the issue.

Comment 5 Peter Jones 2015-06-30 20:54:44 UTC
*** Bug 1233229 has been marked as a duplicate of this bug. ***

Comment 7 Michal Kovarik 2015-08-27 08:07:10 UTC
Using grub2-2.02-0.25.el7 - added kernel option - test="abc 123"

[root@system1 ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz root=/dev/mapper/rhel_system1-root ro crashkernel=auto rd.lvm.lv=rhel_system1/root rd.lvm.lv=rhel_system1/swap LANG=en_US.UTF-8 "test=abc 123"

Based on [1]:
Double-quotes can be used to protect spaces in values, e.g.:
	param="spaces in here"

Moving back to Assigned.


Actual Result:
"test=abc 123"

Expected Result:
test="abc 123"

[1] https://www.kernel.org/doc/Documentation/kernel-parameters.txt

Comment 8 Peter Jones 2015-09-02 13:29:33 UTC
> Actual Result:
> "test=abc 123"
> 
> Expected Result:
> test="abc 123"

This is the same behavior as in RHEL 7.1 and is unrelated to this bug.  If you find some actual incorrect behavior due to this, please file that as a different bug - but there's a good chance any such problem you find will be a bug in something parsing the string later, since in terms of shell quoting, these two strings are still identical.

Comment 9 errata-xmlrpc 2015-11-19 12:23:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-2401.html