Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
kdump.25799
kdump-calibrate-Fix-kernel-command-line-parsing...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdump-calibrate-Fix-kernel-command-line-parsing.patch of Package kdump.25799
From: Petr Tesarik <ptesarik@suse.com> Date: Tue, 2 Mar 2021 11:54:14 +0100 Subject: calibrate: Fix kernel command line parsing References: bsc#1180513 Upstream: merged Git-commit: 1fe1bba64e208032b7c20b885cbbc5b54a13314a A kernel parameter value can be quoted (param="val"). This quoting is not removed properly. It is necessary to follow the logic of kernel's next_arg() in lib/cmdline.c more closely. Note that if the value as well as the whole argument are quoted, the Linux kernel removes only one trailing quote. For instance: "root="/dev/sda1"" is parsed as /dev/sda1" (with the trailing quote). I consider this a bug in the kernel option parser and I'm not redoing it here. Signed-off-by: Petr Tesarik <ptesarik@suse.com> --- kdumptool/mounts.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) --- a/kdumptool/mounts.cc +++ b/kdumptool/mounts.cc @@ -295,6 +295,17 @@ bool PathResolver::_devroot_hexhex(void) return true; } +// Remove quotes from a kernel command line parameter +static void remove_kparam_quotes(string &s) +{ + if (!s.empty() && *s.begin() == '"') { + s.erase(s.begin()); + string::iterator last = s.end(); + if (last != s.begin() && *--last == '"') + s.erase(last); + } +} + // ----------------------------------------------------------------------------- FilePath& PathResolver::system_root(void) { @@ -316,19 +327,16 @@ FilePath& PathResolver::system_root(void in_quote = !in_quote; } - // remove surrounding quotes - if (!s.empty() && *s.begin() == '"') { - s.erase(s.begin()); - string::iterator last = s.end(); - if (last != s.begin() && *--last == '"') - s.erase(last); - } + remove_kparam_quotes(s); if (s == "--") break; - if (s.startsWith(param)) - m_devroot.assign(s, param.length()); + if (s.startsWith(param)) { + s.erase(0, param.length()); + remove_kparam_quotes(s); + m_devroot.assign(s); + } } fin.close();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor