2018-02-28 14:32:05

by Jinbum Park

[permalink] [raw]
Subject: [kernel-hardening] [PATCH 2/2] arm: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE

CONFIG_FORTIFY_SOURCE detects various overflows at compile-time.
(6974f0c4555e ("include/linux/string.h:
add the option of fortified string.h functions)

ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and
run with CONFIG_FORTIFY_SOURCE.

Since ARM can be built and run with that flag like other architectures,
select ARCH_HAS_FORTIFY_SOURCE as default.

Signed-off-by: Jinbum Park <[email protected]>
---
arch/arm/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7e3d535..3765336 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
select ARCH_HAS_DEBUG_VIRTUAL if MMU
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ELF_RANDOMIZE
+ select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_SET_MEMORY
select ARCH_HAS_PHYS_TO_DMA
select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
--
1.9.1



2018-02-28 16:56:08

by Kees Cook

[permalink] [raw]
Subject: Re: [kernel-hardening] [PATCH 2/2] arm: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE

On Wed, Feb 28, 2018 at 6:30 AM, Jinbum Park <[email protected]> wrote:
> CONFIG_FORTIFY_SOURCE detects various overflows at compile-time.
> (6974f0c4555e ("include/linux/string.h:
> add the option of fortified string.h functions)
>
> ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and
> run with CONFIG_FORTIFY_SOURCE.
>
> Since ARM can be built and run with that flag like other architectures,
> select ARCH_HAS_FORTIFY_SOURCE as default.
>
> Signed-off-by: Jinbum Park <[email protected]>

Acked-by: Kees Cook <[email protected]>

-Kees

> ---
> arch/arm/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 7e3d535..3765336 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -7,6 +7,7 @@ config ARM
> select ARCH_HAS_DEBUG_VIRTUAL if MMU
> select ARCH_HAS_DEVMEM_IS_ALLOWED
> select ARCH_HAS_ELF_RANDOMIZE
> + select ARCH_HAS_FORTIFY_SOURCE
> select ARCH_HAS_SET_MEMORY
> select ARCH_HAS_PHYS_TO_DMA
> select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
> --
> 1.9.1
>



--
Kees Cook
Pixel Security

2018-03-03 14:29:37

by kernel test robot

[permalink] [raw]
Subject: Re: [kernel-hardening] [PATCH 2/2] arm: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE

Hi Jinbum,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc3 next-20180302]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jinbum-Park/arm-Add-ARCH_HAS_FORTIFY_SOURCE/20180303-184154
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

arch/arm/boot/compressed/fdt_ro.o: In function `fdt_stringlist_count':
>> fdt_ro.c:(.text+0xc90): undefined reference to `fortify_panic'
arch/arm/boot/compressed/fdt_ro.o: In function `fdt_stringlist_search':
fdt_ro.c:(.text+0xd40): undefined reference to `fortify_panic'
arch/arm/boot/compressed/fdt_ro.o: In function `fdt_stringlist_get':
fdt_ro.c:(.text+0xe28): undefined reference to `fortify_panic'

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.32 kB)
.config.gz (63.64 kB)
Download all attachments