diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-11-23 16:57:31 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-24 09:55:54 +0000 |
commit | cccb8f4242de60b625f09bdb18f94aab0fc1f04e (patch) | |
tree | 38ce872639cdc0128b174e100fcb3a5412a8e332 | |
parent | 30d1eb384132cf1bfe7885e975a801234029db64 (diff) | |
download | poky-cccb8f4242de60b625f09bdb18f94aab0fc1f04e.tar.gz |
kernel-yocto: conditionally enable stack protection checking on x86-64
The kernel Makfile uses pkgconfig to check for libelf when enabling
CONFIG_STACK_VALIDATION. We already have libelf in our DEPENDS, but
the kernel Makefiles hardcode 'pkgconfig', so fail to pick up our
pkgconfig-native binary that would report the correct flags and paths
for libelf support.
Rather than patching the kernel Makefile's to use pkgconfig-native,
we can use the KERNEL_EXTRA_ARGS variable to pass the definition of
HOST_LIBELF_LIBS via the kernel build commmand line.
We conditionally set HOST_LIBELF_LIBS based on "stack" being in
a newly introduced variable KERNEL_DEBUG_OPTIONS. The value of
HOST_LIBELF_LIBS is the same as pkgconfig-native would set in a
kernel build (but we cannot call pkgconfig at the point this
variable is set).
(From OE-Core rev: 0ad2b69dace6ac851c1f0bdae6a3c41045fc2d1d)
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto.inc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc index 331727d62c..15fc7ff724 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++ b/meta/recipes-kernel/linux/linux-yocto.inc | |||
@@ -46,6 +46,7 @@ LINUX_VERSION_EXTENSION ??= "-yocto-${LINUX_KERNEL_TYPE}" | |||
46 | # Pick up shared functions | 46 | # Pick up shared functions |
47 | inherit kernel | 47 | inherit kernel |
48 | inherit kernel-yocto | 48 | inherit kernel-yocto |
49 | inherit pkgconfig | ||
49 | 50 | ||
50 | B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build" | 51 | B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build" |
51 | 52 | ||
@@ -57,3 +58,6 @@ do_install:append(){ | |||
57 | 58 | ||
58 | # enable kernel-sample for oeqa/runtime/cases's ksample.py test | 59 | # enable kernel-sample for oeqa/runtime/cases's ksample.py test |
59 | KERNEL_FEATURES:append:qemuall=" features/kernel-sample/kernel-sample.scc" | 60 | KERNEL_FEATURES:append:qemuall=" features/kernel-sample/kernel-sample.scc" |
61 | |||
62 | KERNEL_DEBUG_OPTIONS ?= "stack" | ||
63 | KERNEL_EXTRA_ARGS:append:x86-64 = "${@bb.utils.contains('KERNEL_DEBUG_OPTIONS', 'stack', 'HOST_LIBELF_LIBS="-L${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig/../../../usr/lib/ -lelf"', '', d)}" | ||