Received: by 10.223.185.116 with SMTP id b49csp5538787wrg; Tue, 27 Feb 2018 15:25:42 -0800 (PST) X-Google-Smtp-Source: AH8x227LY/bKkYpbVUyDQdhAX+PqtmaxTP307IhH5gqwEUcGUxpab28Pqmjbn1Ea9CS2pe1WciGi X-Received: by 10.98.73.4 with SMTP id w4mr15539020pfa.227.1519773942127; Tue, 27 Feb 2018 15:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519773942; cv=none; d=google.com; s=arc-20160816; b=ffuBtHxBO4PlOImjUSu6utZPEzo7NDWfXgQJXfr+b2QfkH7G0FRek78TRsGLNm7YmB YIjrJOaUJ5FWrWyWetkyzNTW22AA+J228+KPPjHnMvNP6sTf7iIwV485nJxh4jV+gVX5 a9xtDp50gB8SHPN86oCtYsWGfBLsaK2gO2qLRakC2dMo+yVTw9tSUf52XJkivEgl6iwo 8vhVvBPoa2GduEkmN1cMsIS6jdxyL4mQsUnqAIzaUX9Li0AhflBP0WHipCpYFbGc2lZg aYIQV+7Ijl5CFd9eQ/SFl1NPc8a+GecZkq/K4BJHXQjSZSaNyYMF82Kpqjd13pdUhvsh H0mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=tGDi/70heOUovRST6lROw/JMYgjYh9dezyoUHJ8A/30=; b=rXWkoO+v3it5dFYqIkrgu3BuN67TNj2lXkjFDTPKO9hRwdoDwLPRJD1WKY5jAX1+YH qs7qNLTjhcUV5bkr1QdWo5ayhLiE0wTJHAoISZXUygoppjwHSFo6e4NNMC2sGdvMgnaG OtXdwwhlAadyJiFo7KZWVvkQS3Ybq9DV3KOlyuIUNqTWByUUksjPE0goPbFaGCN8R4jn ht5X/WblcidNNk0XHpKNxqXjUGGEu0nhSTu5EsctGp1tCtPrQ1eu2KwlCOoRaL92E4/x KWWj+0uBRXvzgyqSyf9kRRJ0tU6h16up8t4rJdfq/AwsJqcRcFGoI9ke8Etfi068wHB2 XEMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=mfviC+8p; dkim=fail header.i=@chromium.org header.s=google header.b=dKLF2sLS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si172008pgv.234.2018.02.27.15.25.27; Tue, 27 Feb 2018 15:25:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=mfviC+8p; dkim=fail header.i=@chromium.org header.s=google header.b=dKLF2sLS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752214AbeB0XXI (ORCPT + 99 others); Tue, 27 Feb 2018 18:23:08 -0500 Received: from mail-vk0-f68.google.com ([209.85.213.68]:41973 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751974AbeB0XXF (ORCPT ); Tue, 27 Feb 2018 18:23:05 -0500 Received: by mail-vk0-f68.google.com with SMTP id t201so361652vke.8 for ; Tue, 27 Feb 2018 15:23:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=tGDi/70heOUovRST6lROw/JMYgjYh9dezyoUHJ8A/30=; b=mfviC+8ps7D8oLQFRAIBOPBP+9TJyQdM3rQyyfWYFqXQnkRvH9bG2i6xtZKk4boiHd kZhOnVPtlRAMgSjYoFCebH6ghq3TChrlmjOmAGtnmo222znsmCOgbXNA2z1UmKvbuly8 WWESqW3nL86gyY4R3jfCuckW0La8ukgbMA9TJG99FrdO7Op8TKQTghFSNGmMtlGNipzh eSBmovhC9lLh3jzYjiagkRNR8m7zrWqysQx/RiK4Ym7260yUAbxHFzhpOrsKeHn/2H2f 5i7AV1I+FGg3ck7wu4je1gd+/gS9GOO4cfeisWDU4bJJ33MnL7IUilurJjDrt6b7185W Xpgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=tGDi/70heOUovRST6lROw/JMYgjYh9dezyoUHJ8A/30=; b=dKLF2sLSbCDjm7Wp4zShEr0IYFdXRJk5lES6KHa7un61MLlPhcuopFlC2/OUtUIg6M qSH7diRavU4X8H1HDYm9xpBxfAYaW+uNyee90XtauVtg7jm6SnVHTOg8Dgzh46OEKKVZ xQqVslDI4yhRxcyDN7psUNP8sHuJf6zNQBipQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=tGDi/70heOUovRST6lROw/JMYgjYh9dezyoUHJ8A/30=; b=ULGQeLd27xeDePwy1rl1Xse3H096W789oK6dR2FgDr/vrP+T8chqCT1l/DaCTUj2FP +wFPI3PfPRXLYnKyeXYGttD0vcUNE3vzvY0vSfnPAFjs/A7tgeErDtnPfcqwkw20WitF GQ+bTFG5IIJXYMbhX46SmA4LdTE0hvQBZqtwJFpHYtP2kTb7T8uBFsQZsDLCDY325JUU 9S8XmOTOpxdgDjDAxwr2nJdTruArX1GF87HKd+/76DmF8RhcEOkW5HQW3y5Mkooipvcz b5qvzvZyhl0NHa5Kl4QJQH2ozocm9xpM4Hsb2V2ywJJtyyTrDTEmPS8BBEqvDvSiQ+LM xEzg== X-Gm-Message-State: APf1xPA1UO7z98RFKp47fXcB3KkM6BCaLp8msoNZfWXHZJMcB/6KeghI irr+UQypdT+AOXGgSltJa8Oo2OigcDVG+v3nOte4tg== X-Received: by 10.31.192.210 with SMTP id q201mr2403357vkf.7.1519773784291; Tue, 27 Feb 2018 15:23:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.242.140 with HTTP; Tue, 27 Feb 2018 15:23:03 -0800 (PST) In-Reply-To: <20180224024613.24078-10-mcgrof@kernel.org> References: <20180224024613.24078-1-mcgrof@kernel.org> <20180224024613.24078-10-mcgrof@kernel.org> From: Kees Cook Date: Tue, 27 Feb 2018 15:23:03 -0800 X-Google-Sender-Auth: ZYScVxCijSRqqBUqwBYIrCLPuvc Message-ID: Subject: Re: [PATCH v2 09/11] firmware: enable to force disable the fallback mechanism at run time To: "Luis R. Rodriguez" Cc: Greg KH , Andrew Morton , Shuah Khan , Martin Fuzzey , Mimi Zohar , David Howells , pali.rohar@gmail.com, Takashi Iwai , arend.vanspriel@broadcom.com, =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , nbroeking@me.com, Vikram Mulukutla , stephen.boyd@linaro.org, Mark Brown , Dmitry Torokhov , David Woodhouse , Linus Torvalds , Abhay_Salunke@dell.com, bjorn.andersson@linaro.org, jewalt@lgsinnovations.com, LKML , "linux-fsdevel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 6:46 PM, Luis R. Rodriguez wrote: > You currently need four different kernel builds to test the firmware > API fully. By adding a proc knob to force disable the fallback mechanism > completely we are able to reduce the amount of kernels you need built > to test the firmware API down to two. > > Signed-off-by: Luis R. Rodriguez Acked-by: Kees Cook -Kees > --- > drivers/base/firmware_fallback.c | 5 +++++ > drivers/base/firmware_fallback.h | 4 ++++ > drivers/base/firmware_fallback_table.c | 9 +++++++++ > 3 files changed, 18 insertions(+) > > diff --git a/drivers/base/firmware_fallback.c b/drivers/base/firmware_fallback.c > index cbce9a950cd8..13fa5ff2b46c 100644 > --- a/drivers/base/firmware_fallback.c > +++ b/drivers/base/firmware_fallback.c > @@ -643,6 +643,11 @@ static bool fw_force_sysfs_fallback(unsigned int opt_flags) > > static bool fw_run_sysfs_fallback(unsigned int opt_flags) > { > + if (fw_fallback_config.ignore_sysfs_fallback) { > + pr_info_once("Ignoring firmware sysfs fallback due to debugfs knob\n"); > + return false; > + } > + > if ((opt_flags & FW_OPT_NOFALLBACK)) > return false; > > diff --git a/drivers/base/firmware_fallback.h b/drivers/base/firmware_fallback.h > index ca7e69a8417b..dfebc644ed35 100644 > --- a/drivers/base/firmware_fallback.h > +++ b/drivers/base/firmware_fallback.h > @@ -14,12 +14,16 @@ > * as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y. > * Useful to help debug a CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y > * functionality on a kernel where that config entry has been disabled. > + * @ignore_sysfs_fallback: force to disable the sysfs fallback mechanism. > + * This emulates the behaviour as if we had set the kernel > + * config CONFIG_FW_LOADER_USER_HELPER=n. > * @old_timeout: for internal use > * @loading_timeout: the timeout to wait for the fallback mechanism before > * giving up, in seconds. > */ > struct firmware_fallback_config { > unsigned int force_sysfs_fallback; > + unsigned int ignore_sysfs_fallback; > int old_timeout; > int loading_timeout; > }; > diff --git a/drivers/base/firmware_fallback_table.c b/drivers/base/firmware_fallback_table.c > index 77300d5e9c52..5e990b0330c7 100644 > --- a/drivers/base/firmware_fallback_table.c > +++ b/drivers/base/firmware_fallback_table.c > @@ -39,6 +39,15 @@ struct ctl_table firmware_config_table[] = { > .extra1 = &zero, > .extra2 = &one, > }, > + { > + .procname = "ignore_sysfs_fallback", > + .data = &fw_fallback_config.ignore_sysfs_fallback, > + .maxlen = sizeof(unsigned int), > + .mode = 0644, > + .proc_handler = proc_douintvec_minmax, > + .extra1 = &zero, > + .extra2 = &one, > + }, > { } > }; > EXPORT_SYMBOL_GPL(firmware_config_table); > -- > 2.16.2 > -- Kees Cook Pixel Security