Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1374286

Re: [PATCH 2/2] localmodconfig: Reset certificate paths

From joeyli <jlee@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] localmodconfig: Reset certificate paths
Date 2016-04-08 17:10 +0200
Message-ID <rlGcO-5Mb-23@gated-at.bofh.it> (permalink)
References <rjy02-7lH-7@gated-at.bofh.it> <rjy02-7lH-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Apr 02, 2016 at 10:55:22AM -0700, Benjamin Poirier wrote:
> When using `make localmodconfig` and friends, if the input config comes
> from a kernel that was built in a different environment (for example, the
> canonical case of using localmodconfig to trim a distribution kernel
> config) the key files for module signature checking will not be available
> and should be regenerated or omitted. Otherwise, the user will be faced
> with annoying errors when trying to build with the generated .config:
> 
> make[1]: *** No rule to make target 'keyring.crt', needed by 'certs/x509_certificate_list'.  Stop.
> Makefile:1576: recipe for target 'certs/' failed
> 
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>

Tested-by: Lee, Chun-Yi <jlee@suse.com>


Regards
Joey Lee

> ---
>  scripts/kconfig/streamline_config.pl | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index 7036ae3..514735d 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -610,6 +610,40 @@ foreach my $line (@config_file) {
>  	next;
>      }
>  
> +    if (/CONFIG_MODULE_SIG_KEY="(.+)"/) {
> +        my $orig_cert = $1;
> +        my $default_cert = "certs/signing_key.pem";
> +
> +        # Check that the logic in this script still matches the one in Kconfig
> +        if (!defined($depends{"MODULE_SIG_KEY"}) ||
> +            $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
> +            die "Assertion failure, update needed";
> +        }
> +
> +        if ($orig_cert ne $default_cert && ! -f $orig_cert) {
> +            print STDERR "Module signature verification enabled but ",
> +                "module signing key \"$orig_cert\" not found. Resetting ",
> +                "signing key to default value.\n";
> +            print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
> +        } else {
> +            print;
> +        }
> +        next;
> +    }
> +
> +    if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) {
> +        my $orig_keys = $1;
> +
> +        if (! -f $orig_keys) {
> +            print STDERR "System keyring enabled but keys \"$orig_keys\" ",
> +                "not found. Resetting keys to default value.\n";
> +            print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
> +        } else {
> +            print;
> +        }
> +        next;
> +    }
> +
>      if (/^(CONFIG.*)=(m|y)/) {
>  	if (defined($configs{$1})) {
>  	    if ($localyesconfig) {
> -- 
> 2.7.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source" statements Benjamin Poirier <bpoirier@suse.com> - 2016-04-02 20:00 +0200
  [PATCH 2/2] localmodconfig: Reset certificate paths Benjamin Poirier <bpoirier@suse.com> - 2016-04-02 20:00 +0200
    Re: [PATCH 2/2] localmodconfig: Reset certificate paths joeyli <jlee@suse.com> - 2016-04-08 17:10 +0200
  Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source"  statements joeyli <jlee@suse.com> - 2016-04-08 17:00 +0200
  Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source"  statements Steven Rostedt <rostedt@goodmis.org> - 2016-04-08 20:30 +0200
    Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source"  statements Benjamin Poirier <bpoirier@suse.com> - 2016-04-11 02:00 +0200
      [PATCH 3/4] localmodconfig: Add missing $ to reference a variable Benjamin Poirier <bpoirier@suse.com> - 2016-04-11 02:10 +0200
      [PATCH 4/4] localmodconfig: Recognize standalone "prompt" Benjamin Poirier <bpoirier@suse.com> - 2016-04-11 02:10 +0200
      [PATCH 1/4] localmodconfig: Recognize more keywords that end a menu entry Benjamin Poirier <bpoirier@suse.com> - 2016-04-11 02:10 +0200
        [PATCH 2/4] localmodconfig: Fix parsing of "help" text Benjamin Poirier <bpoirier@suse.com> - 2016-04-11 02:10 +0200

csiph-web