Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370024 > unrolled thread
| Started by | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| First post | 2016-04-02 20:00 +0200 |
| Last post | 2016-04-11 02:10 +0200 |
| Articles | 10 — 3 participants |
Back to article view | Back to linux.kernel
[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
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-02 20:00 +0200 |
| Subject | [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source" statements |
| Message-ID | <rjy02-7lH-7@gated-at.bofh.it> |
The parameter of Kconfig "source" statements does not need to be quoted.
The current regex causes many kconfig files to be skipped and hence,
dependencies to be missed.
Also fix the whitespace repeat count.
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
scripts/kconfig/streamline_config.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index f3d3fb4..7036ae3 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -188,7 +188,7 @@ sub read_kconfig {
$cont = 0;
# collect any Kconfig sources
- if (/^source\s*"(.*)"/) {
+ if (/^source\s+"?([^"]+)/) {
my $kconfig = $1;
# prevent reading twice.
if (!defined($read_kconfigs{$kconfig})) {
--
2.7.2
[toc] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-02 20:00 +0200 |
| Subject | [PATCH 2/2] localmodconfig: Reset certificate paths |
| Message-ID | <rjy02-7lH-11@gated-at.bofh.it> |
| In reply to | #1370024 |
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>
---
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
[toc] | [prev] | [next] | [standalone]
| From | joeyli <jlee@suse.com> |
|---|---|
| Date | 2016-04-08 17:10 +0200 |
| Subject | Re: [PATCH 2/2] localmodconfig: Reset certificate paths |
| Message-ID | <rlGcO-5Mb-23@gated-at.bofh.it> |
| In reply to | #1370025 |
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
[toc] | [prev] | [next] | [standalone]
| From | joeyli <jlee@suse.com> |
|---|---|
| Date | 2016-04-08 17:00 +0200 |
| Subject | Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source" statements |
| Message-ID | <rlG38-5o2-17@gated-at.bofh.it> |
| In reply to | #1370024 |
On Sat, Apr 02, 2016 at 10:55:21AM -0700, Benjamin Poirier wrote:
> The parameter of Kconfig "source" statements does not need to be quoted.
> The current regex causes many kconfig files to be skipped and hence,
> dependencies to be missed.
>
> Also fix the whitespace repeat count.
>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Lee, Chun-Yi <jlee@suse.com>
> ---
> scripts/kconfig/streamline_config.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index f3d3fb4..7036ae3 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -188,7 +188,7 @@ sub read_kconfig {
> $cont = 0;
>
> # collect any Kconfig sources
> - if (/^source\s*"(.*)"/) {
> + if (/^source\s+"?([^"]+)/) {
> my $kconfig = $1;
> # prevent reading twice.
> if (!defined($read_kconfigs{$kconfig})) {
> --
> 2.7.2
Regards
Joey Lee
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-04-08 20:30 +0200 |
| Subject | Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source" statements |
| Message-ID | <rlJkm-82k-13@gated-at.bofh.it> |
| In reply to | #1370024 |
On Sat, 2 Apr 2016 10:55:21 -0700
Benjamin Poirier <bpoirier@suse.com> wrote:
> The parameter of Kconfig "source" statements does not need to be quoted.
> The current regex causes many kconfig files to be skipped and hence,
> dependencies to be missed.
>
> Also fix the whitespace repeat count.
>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Thanks for sending this. I'll apply it. Should this be marked for
stable? And if so, how far back?
-- Steve
> ---
> scripts/kconfig/streamline_config.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index f3d3fb4..7036ae3 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -188,7 +188,7 @@ sub read_kconfig {
> $cont = 0;
>
> # collect any Kconfig sources
> - if (/^source\s*"(.*)"/) {
> + if (/^source\s+"?([^"]+)/) {
> my $kconfig = $1;
> # prevent reading twice.
> if (!defined($read_kconfigs{$kconfig})) {
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-11 02:00 +0200 |
| Subject | Re: [PATCH 1/2] localmodconfig: Fix parsing of Kconfig "source" statements |
| Message-ID | <rmxqO-4ER-3@gated-at.bofh.it> |
| In reply to | #1374405 |
On 2016/04/08 14:29, Steven Rostedt wrote:
> On Sat, 2 Apr 2016 10:55:21 -0700
> Benjamin Poirier <bpoirier@suse.com> wrote:
>
> > The parameter of Kconfig "source" statements does not need to be quoted.
> > The current regex causes many kconfig files to be skipped and hence,
> > dependencies to be missed.
> >
> > Also fix the whitespace repeat count.
> >
> > Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
>
> Thanks for sending this. I'll apply it. Should this be marked for
> stable? And if so, how far back?
The first problem dates back to the introduction of streamline_config.pl in
dcc6024 kconfig: add streamline_config.pl to scripts (v2.6.32-rc1)
The second problem started with
19e91b6 modsign: Allow external signing key to be specified (v4.3-rc1)
However, I'm not sure that adding the patch to stable is warranted. I
considered this with regards to the problem fixed by patch 1/2.
First, I searched for cases where dependency info that's currently missing
would lead to lead to symbols being erroneously deactivated but I did not find
any. Since these cases are not so obvious and are quite rare in general, it's
possible that I missed one but at this stage the problem is theoretical.
Second, even if there is such a case, I'm not sure that the problem is
"critical". streamline_config.pl may output an "invalid" config because
it misses some dependencies but the config will be fixed by the
invocation of silentoldconfig that comes right after in the
localmodconfig makefile rule. It might not be the config the user
wanted, but it will be valid.
However, while looking for such a case, I've noticed a few other issues in
streamline_config.pl and I'll send more patches shortly.
>
> -- Steve
>
> > ---
> > scripts/kconfig/streamline_config.pl | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> > index f3d3fb4..7036ae3 100755
> > --- a/scripts/kconfig/streamline_config.pl
> > +++ b/scripts/kconfig/streamline_config.pl
> > @@ -188,7 +188,7 @@ sub read_kconfig {
> > $cont = 0;
> >
> > # collect any Kconfig sources
> > - if (/^source\s*"(.*)"/) {
> > + if (/^source\s+"?([^"]+)/) {
> > my $kconfig = $1;
> > # prevent reading twice.
> > if (!defined($read_kconfigs{$kconfig})) {
>
>
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-11 02:10 +0200 |
| Subject | [PATCH 3/4] localmodconfig: Add missing $ to reference a variable |
| Message-ID | <rmxAt-52B-3@gated-at.bofh.it> |
| In reply to | #1375389 |
That is clearly what the original intention was. This does not change the
output .config but it prevents some useless processing.
! eq "m" is changed to the simpler eq "y"; symbols with values other than
m|y are not included in %orig_configs.
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
scripts/kconfig/streamline_config.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index f06972a..bbc160c 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -454,7 +454,7 @@ sub parse_config_depends
$p =~ s/^[^$valid]*[$valid]+//;
# We only need to process if the depend config is a module
- if (!defined($orig_configs{$conf}) || !$orig_configs{conf} eq "m") {
+ if (!defined($orig_configs{$conf}) || $orig_configs{$conf} eq "y") {
next;
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-11 02:10 +0200 |
| Subject | [PATCH 4/4] localmodconfig: Recognize standalone "prompt" |
| Message-ID | <rmxAt-52B-11@gated-at.bofh.it> |
| In reply to | #1375389 |
Note that this may change the resulting .config, causing it to have fewer
symbols turned on. Before this patch we incorrectly identified some symbols
as not having a prompt and needing to be selected by something else.
Also fix the whitespace repeat after "tristate".
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
scripts/kconfig/streamline_config.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index bbc160c..d465672 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -237,7 +237,7 @@ sub read_kconfig {
}
# configs without prompts must be selected
- } elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
+ } elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) {
# note if the config has a prompt
$prompts{$config} = 1;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-11 02:10 +0200 |
| Subject | [PATCH 1/4] localmodconfig: Recognize more keywords that end a menu entry |
| Message-ID | <rmxAt-52B-5@gated-at.bofh.it> |
| In reply to | #1375389 |
Based on the list in Documentation/kbuild/kconfig-language.txt
This removes junk from %depends because parsing of a menu entry spilled
over to another menu entry.
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
scripts/kconfig/streamline_config.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 514735d..c5b388c 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -256,8 +256,8 @@ sub read_kconfig {
$iflevel-- if ($iflevel);
- # stop on "help"
- } elsif (/^\s*help\s*$/) {
+ # stop on "help" and keywords that end a menu entry
+ } elsif (/^\s*help\s*$/ || /^(comment|choice|menu)\b/) {
$state = "NONE";
}
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Poirier <bpoirier@suse.com> |
|---|---|
| Date | 2016-04-11 02:10 +0200 |
| Subject | [PATCH 2/4] localmodconfig: Fix parsing of "help" text |
| Message-ID | <rmxAt-52B-15@gated-at.bofh.it> |
| In reply to | #1375392 |
Help text may start with "help" or "---help---". This patch fixes
read_kconfig() to recognize the second variant.
This removes useless junk from %depends and %selects. That junk is due to
help text that contains the words "selects" and "depends".
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
scripts/kconfig/streamline_config.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index c5b388c..f06972a 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -257,7 +257,7 @@ sub read_kconfig {
$iflevel-- if ($iflevel);
# stop on "help" and keywords that end a menu entry
- } elsif (/^\s*help\s*$/ || /^(comment|choice|menu)\b/) {
+ } elsif (/^\s*(---)?help(---)?\s*$/ || /^(comment|choice|menu)\b/) {
$state = "NONE";
}
}
--
2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web