Bug 9805 - Signing keys not available when signing out-of-tree kernel modules
Summary: Signing keys not available when signing out-of-tree kernel modules
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: kernel (show other bugs)
Version: 2.1
Hardware: x86 x86_64
: Medium normal
Target Milestone: 2.2
Assignee: Jianxun Zhang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-06-21 09:49 UTC by Mattias Waldo
Modified: 2016-09-05 10:05 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mattias Waldo 2016-06-21 09:49:45 UTC
When a kernel module built out-of-tree is installed, the module signing fails silently because the signing keys are not available in $kerneldir at install time. The key files need to be explicitly copied in a linux-yocto_4.4.bbappend file for the signing to work (see below).

To reproduce:

* Add meta-skeleton layer to bblayers.conf.
* Add 'IMAGE_INSTALL += " hello-mod"' to local.conf.
* In any layer (e.g. meta-skeleton):
- Add a hello-mod_0.1.bbappend file containing 'INHIBIT_PACKAGE_STRIP = "1"'.
- Add a linux-yocto_4.4.bbappend file that includes a .cfg file with the following kernel configuration modifications:
'CONFIG_MODULE_SIG = "y"'
'CONFIG_MODULE_SIG_ALL = "y"'
* Run "bitbake hello-mod".
* Run "hexdump -C " on the newly created hello.ko file - there is no signing information at the end.
* Check the log.do_install log file for hello-mod: it states "certs/signing_key.pem: No such file or directory".
* Add the following lines to the linux-yocto_4.4.bbappend file:
- do_shared_workdir_append() {
    cd ${B}
    mkdir $kerneldir/certs
    cp certs/signing_key.* $kerneldir/certs/
}
* Rebuild hello-mod
* Running hexdump again reveals the text "Module signature appended" at the end.
Comment 1 Jianxun Zhang 2016-08-05 18:21:41 UTC
Hi Mattias,
I have't started troubleshooting this issue, just feel you are actually close to a final solution based on the workaround you provided.

Do you think you can have a patch to OE mailing list?
openembedded-core@lists.openembedded.org

Let me know if it is not the case and we will work on it from here.

Thanks lot!
Comment 2 Mattias Waldo 2016-08-15 06:24:43 UTC
(In reply to comment #1)
> Hi Mattias,
> I have't started troubleshooting this issue, just feel you are actually
> close to a final solution based on the workaround you provided.
> 
> Do you think you can have a patch to OE mailing list?
> openembedded-core@lists.openembedded.org
> 
> Let me know if it is not the case and we will work on it from here.
> 
> Thanks lot!
Hi!

I've submitted a patch to the mailing list: https://patchwork.openembedded.org/patch/129137/

Regards,

Mattias
Comment 3 Jianxun Zhang 2016-08-24 00:42:36 UTC
I haven't seen feedbacks in OE mailing list, so I pinged Bruce in mail for the status of your patch.
Comment 4 Mattias Waldo 2016-09-05 10:05:40 UTC
The patch was accepted and is now in the openembedded-core master branch.