lkml.org 
[lkml]   [2012]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] MODSIGN: Only sign modules if built in-tree
On Mon, Nov 05, 2012 at 12:31:39PM +1030, Rusty Russell wrote:
> Josh Boyer <jwboyer@redhat.com> writes:
> > diff --git a/Makefile b/Makefile
> > index 14c93b3..7e27d51 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -722,8 +722,14 @@ export mod_strip_cmd
> > ifeq ($(CONFIG_MODULE_SIG),y)
> > MODSECKEY = ./signing_key.priv
> > MODPUBKEY = ./signing_key.x509
> > +ifeq ($(KBUILD_EXTMOD),)
> > +SIGNFAIL = false
> > +else
> > +# External builds might not have a signing key, don't break module_install.
> > +SIGNFAIL = true
> > +endif # KBUILD_EXTMOD
> > export MODPUBKEY
> > -mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
> > +mod_sign_cmd = $(SIGNFAIL) || perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
> > else
> > mod_sign_cmd = true
> > endif
>
> Huh? 'true || perl' never runs perl due to short circuiting.

Ah. Maybe you were going for "sign all modules if keys are available,
but don't break external if they aren't" semantics. I was just skipping
it entirely for external modules.

> Let's do this instead. Tested here, please ack.

Either method works for me, and I tested this locally as you asked.
Seems to be working well.

> modules: don't break modules_install on external modules with no key.
>
> The script still spits out an error ("Can't read private key") but we
> don't break modules_install.
>
> Reported-by: Bruno Wolff III <bruno@wolff.to>
> Original-patch-by: Josh Boyer <jwboyer@redhat.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Acked-by: Josh Boyer <jwboyer@redhat.com>

josh

>
> diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
> index dda4b2b..ecbb447 100644
> --- a/scripts/Makefile.modinst
> +++ b/scripts/Makefile.modinst
> @@ -16,8 +16,9 @@ PHONY += $(modules)
> __modinst: $(modules)
> @:
>
> +# Don't stop modules_install if we can't sign external modules.
> quiet_cmd_modules_install = INSTALL $@
> - cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@)
> + cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD))
>
> # Modules built outside the kernel source tree go into extra by default
> INSTALL_MOD_DIR ?= extra


\
 
 \ /
  Last update: 2012-11-05 21:01    [W:0.069 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site