Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753258AbdGGNpP (ORCPT ); Fri, 7 Jul 2017 09:45:15 -0400 Received: from mail-bn3nam01on0042.outbound.protection.outlook.com ([104.47.33.42]:60976 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752961AbdGGNpD (ORCPT ); Fri, 7 Jul 2017 09:45:03 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; From: Tom Lendacky Subject: [PATCH v9 36/38] x86/boot: Add early cmdline parsing for options with arguments To: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, xen-devel@lists.xen.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Brijesh Singh , Toshimitsu Kani , Radim =?utf-8?b?S3LEjW3DocWZ?= , Matt Fleming , Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , Jonathan Corbet , Joerg Roedel , "Michael S. Tsirkin" , Ingo Molnar , Andrey Ryabinin , Dave Young , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Borislav Petkov , Andy Lutomirski , Boris Ostrovsky , Dmitry Vyukov , Juergen Gross , Thomas Gleixner , Paolo Bonzini Date: Fri, 07 Jul 2017 08:44:51 -0500 Message-ID: <20170707134451.29711.7278.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> References: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR06CA0024.namprd06.prod.outlook.com (10.174.172.165) To MWHPR12MB1151.namprd12.prod.outlook.com (10.169.204.15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ae3645b-e976-4d77-b56c-08d4c53e5aef X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR12MB1151; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1151;3:Jcf3uanZdza0tnH+dyCXxCTsO2XWzj6cOa6ZPcOq6OkunZSIIC7gqA7z666aIMH7O4D636CGbS9mS8HDwiSVdIWuuP5mQXC9rlqMKubRJCzVHLkLNciwfAfmuwCMHoXwbwnMGcst3akWoE69mZjpGHD8Wvb4nZ5cmaSm/rzRfkrFHy2mglEVM+dlXG5bsuiO9TTGP2tj5zdgFVO+euO2dri6ZqcIWVZcBA23kND0Ov7R7lE9hfZ39oZYgUk59cv8JUpU79kjKMqTOMfVNi+7WFej9tuaRkq+cYebAW40qCQMIMCkD4nFEXiyl98yebCgwbJNuqe9AhKfqXFFeDVUpFTLnCU1bklCPNLtdzC/fOTmCvQs794UT5h2QtjJPn4J1UK3sAAEkyAUsGLh/B0qG6Cjwmug7GsYBJQsywpiK6f/lDDoFmlaPhJ/JWG2lpuOzNKbH9trx0Fs2gfqe7J2O2A1j9qxTV/PFAMTyZVOJhArP+JG1yaQpFwt6ESVI/711TH5IWuTAUxsZJGv7lT5Csze7yPpp+8328BXgvNWnvtSrB2ufK6oXnieZU9i6rNk0ll/p+/ftNb1gzOBMwONfGzeS6uzR1sAnv2SRbAsERdgoblEXLTkebylxDkSmlaqKAl2AaBZbNO44odQdZPIJJ+16MJz0Qa3E5txGdfJOraIQjE1FIMvreP+0UELeAx8i6g9DQlRRC9bbf3BPS85HkbBpyhyvKj9cq1Vd671RtY/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zSWm7yAkCdUCuCy2dqIfGTWyCF1rL8MJQBVcVXrCbbOt+qamR1XYgeZOmjFEPxIhi77ceZratZXSFrBvoPO1oUgXKd597URfsrFT293vNqwWOStcp3KwI3vHgr99p3HKIyNMw2IAqZMYQ0Y+HZdMYqQIH75x6tcOwDwe75WevT5m1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(2017060910064)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR12MB1151;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR12MB1151; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUxOzQ6SUxzdGpyUnhvc1VucTc3QzRYSWhoOFlwQ0l6?= =?utf-8?B?a1RlS3JjTlJnd21qWWhydXpQVy9QRVZQazlGM1c4RUlrZkpIVFFLYXR4ejZz?= =?utf-8?B?QnRXLzdtYm9QR0hoRXRld2g1Z1VWbUlJQXNta3M3bC9KWXBjbVRyeWp3ditR?= =?utf-8?B?OGFnWk1YUjZKTlpLNUMvQXdnY0NyNDFxYTMxZjdBcSsyZWQ3L3dCZzRtckhX?= =?utf-8?B?cC9pZmltTVZhdnZBZmtLcFVNNUFnVStaRmZlVk8wc3A4dGdFRmp5SHU1YTBl?= =?utf-8?B?UXluT295dFFIT0JoWmc5UjVqOGRMUG04NGx2djZXOXhhYWV4L2VVQ1E4SHIr?= =?utf-8?B?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DRH?= =?utf-8?B?NVhHdjl5d2lxRFVXRTBZRlpFSHFyeVFYYnF2bjhudyt3Sit1dmtKOHp2ZERh?= =?utf-8?B?YTUzYnhObWtHb212elViVmpXMGlQUyt5a3RGMzZYS1oyTHFVWXk2aWZlbCti?= =?utf-8?B?THVIUGM0NEJwOEhIYk5QZlhLUTRuOXRMbDFvOUt3a0MyTVh3ZUthRDYwUENF?= =?utf-8?B?aTg4ZllqRUxka0k4RkhxaXFyQndWeXN5aVpyYWhXYzQ1MURkdEtES2t0U1ZT?= =?utf-8?B?WCt6Q0gxajhEVHk5SU53WjRjQS9UWW1MMkVDSVRBRFJuOXFpUzg4a2J1VThl?= =?utf-8?B?VzZ4dXdkVEpRa0l3aFJLMERuMytjZXUwbFIzZmhFbFphR2p5VVh5aUMwb3VL?= =?utf-8?B?cndpdk16WUxITDJLRjJQNlh6cU1BUnZXSTh4OXZGeWFNMzE5Zk1nZy9FdmhV?= =?utf-8?Q?KqcGwJCSh3lzw0McyqayEAIxp9rElYa9NoNEmj?= X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39840400002)(39860400002)(39850400002)(39400400002)(39410400002)(39450400003)(2950100002)(6666003)(50986999)(76176999)(103116003)(54356999)(189998001)(23676002)(54906002)(2906002)(33646002)(7736002)(81166006)(55016002)(9686003)(6506006)(8676002)(83506001)(50466002)(7416002)(25786009)(7406005)(53936002)(3846002)(1076002)(66066001)(38730400002)(47776003)(110136004)(305945005)(230700001)(72206003)(86362001)(4326008)(6116002)(5660300001)(53416004)(97746001)(478600001)(42186005)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1151;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUxOzIzOlN5TExUZGoxaDg4S2dUdHRscGc2Wm84V2xx?= =?utf-8?B?Rm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7I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1151;7:18rE9I0+A/QR2YcSbUv0QdaHEbMLUYIBjxDxlTDGeS8z717nIZxc3JXN5WBtqU42+QQZ2u2W+/WlSj71eJJvNczP/+PjphbRrmQZHTVWhxtquC27mjj6LqlSECckdP+U2Oo8SG1qxYyj4jsKpc+uI/jRcVo0YC4oVaIYehzkp6EUw7xB+PuN2+o37KWXsyGmwaEgTPfuC8IocQ3kShWjYNDxY0NiSpSrphm/n6aDiZpsfltxGrIypPuU5lnyh/8K9vl8nHtp50d9kdeBufxhlhhxFyZlifVAG//Qe8MuSoRQmIE2P3Cu2gzIM73DnnFHKOc+LppqcWOSg+9gWCCiitgbGjrNkfR+61FSBqD4iyQQvUa0tsL0MlLgUxX+ybQ5wKwol63wodylWhdju4CFcvhZpspFZdsQDKFJehZlCi/TNSVL5+rRJCr0vpHbIgONgYHxQJGB4pm/VCSCvJD7Y4LBI/FdorrZj8O03njfd0QOEHGrqXNO0wCwW8oSQMMr4RbCZOP6je5KK02H80HH0EmKDzDu4D7eNjeXxEYGtpnq/yYB84/+65U13hzF0EW6sT2vKFCIwI2rAla2obcBrlc3NWghl/d1CCetNIXZsNF8G10GQF0UG0mcfDardZfX00WCZLWs3G0z+602Zc7LMRPaZ5EfWhmT1ByT9OSqXAKz+SiLUQMoY8UVhK/oKZuzBYxGGTpggrTuWjhkafB9Ky6DXfnLW+ZGDd3owGiyIrudBcKR5UP/wMiyLBIF07oEEek45od25pVo58zs5LWkXa6/AG3f14bnhI9ybkkWge4= X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1151;20:IpLOxg72avAi6pALH0+Tj6ebkZ9NMAXn8UGey6dti9hUbzXIIAQvoIWGzSxy+F01BmCJW5bzvygc2alTZcEvI/8Xyu1PDspIOEkYC+LCcXi3gWBsIjqdaH15SCZfUM547M6tD4QQAyD/9ibEqpGrSobfuyZhe+61FK3+TgSyH2YucyukertPbqQsEL5B2hPnHJ7TUytt0rKEHWep8eO/amEeHadEbk/uqCkFFVUP70RPHX22b+RhiHpb0s0v+X2j X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:44:54.9291 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1151 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3795 Lines: 140 Add a cmdline_find_option() function to look for cmdline options that take arguments. The argument is returned in a supplied buffer and the argument length (regardless of whether it fits in the supplied buffer) is returned, with -1 indicating not found. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/cmdline.h | 2 + arch/x86/lib/cmdline.c | 105 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/arch/x86/include/asm/cmdline.h b/arch/x86/include/asm/cmdline.h index e01f7f7..84ae170 100644 --- a/arch/x86/include/asm/cmdline.h +++ b/arch/x86/include/asm/cmdline.h @@ -2,5 +2,7 @@ #define _ASM_X86_CMDLINE_H int cmdline_find_option_bool(const char *cmdline_ptr, const char *option); +int cmdline_find_option(const char *cmdline_ptr, const char *option, + char *buffer, int bufsize); #endif /* _ASM_X86_CMDLINE_H */ diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c index 5cc78bf..3261abb 100644 --- a/arch/x86/lib/cmdline.c +++ b/arch/x86/lib/cmdline.c @@ -104,7 +104,112 @@ static inline int myisspace(u8 c) return 0; /* Buffer overrun */ } +/* + * Find a non-boolean option (i.e. option=argument). In accordance with + * standard Linux practice, if this option is repeated, this returns the + * last instance on the command line. + * + * @cmdline: the cmdline string + * @max_cmdline_size: the maximum size of cmdline + * @option: option string to look for + * @buffer: memory buffer to return the option argument + * @bufsize: size of the supplied memory buffer + * + * Returns the length of the argument (regardless of if it was + * truncated to fit in the buffer), or -1 on not found. + */ +static int +__cmdline_find_option(const char *cmdline, int max_cmdline_size, + const char *option, char *buffer, int bufsize) +{ + char c; + int pos = 0, len = -1; + const char *opptr = NULL; + char *bufptr = buffer; + enum { + st_wordstart = 0, /* Start of word/after whitespace */ + st_wordcmp, /* Comparing this word */ + st_wordskip, /* Miscompare, skip */ + st_bufcpy, /* Copying this to buffer */ + } state = st_wordstart; + + if (!cmdline) + return -1; /* No command line */ + + /* + * This 'pos' check ensures we do not overrun + * a non-NULL-terminated 'cmdline' + */ + while (pos++ < max_cmdline_size) { + c = *(char *)cmdline++; + if (!c) + break; + + switch (state) { + case st_wordstart: + if (myisspace(c)) + break; + + state = st_wordcmp; + opptr = option; + /* fall through */ + + case st_wordcmp: + if ((c == '=') && !*opptr) { + /* + * We matched all the way to the end of the + * option we were looking for, prepare to + * copy the argument. + */ + len = 0; + bufptr = buffer; + state = st_bufcpy; + break; + } else if (c == *opptr++) { + /* + * We are currently matching, so continue + * to the next character on the cmdline. + */ + break; + } + state = st_wordskip; + /* fall through */ + + case st_wordskip: + if (myisspace(c)) + state = st_wordstart; + break; + + case st_bufcpy: + if (myisspace(c)) { + state = st_wordstart; + } else { + /* + * Increment len, but don't overrun the + * supplied buffer and leave room for the + * NULL terminator. + */ + if (++len < bufsize) + *bufptr++ = c; + } + break; + } + } + + if (bufsize) + *bufptr = '\0'; + + return len; +} + int cmdline_find_option_bool(const char *cmdline, const char *option) { return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, option); } + +int cmdline_find_option(const char *cmdline, const char *option, char *buffer, + int bufsize) +{ + return __cmdline_find_option(cmdline, COMMAND_LINE_SIZE, option, + buffer, bufsize); +}