[PATCH] fortify-headers: fix compilation with GCC 10.3

Paul Oranje por at oranjevos.nl
Tue Apr 13 12:52:02 BST 2021



> Op 13 apr. 2021, om 06:03 heeft Rosen Penev <rosenp at gmail.com> het volgende geschreven:
> 
> For some reason, fortified mempcpy does not work with GCC 10.3. It
> worked with GCC 10.2.
> 
> Some output with tvheadend:
> 
> error: 'mempcpy' undeclared here (not in a function);
> did you mean 'memccpy'?
> 144 | _FORTIFY_FN(mempcpy) void *mempcpy(void *__d,
> const void *__s, size_t __n)
>    |             ^~~~~~~
> note: in definition of macro '_FORTIFY_ORIG'
> 20 | #define _FORTIFY_ORIG(p,fn)
> __typeof__(fn) __orig_##fn __asm__(_FORTIFY_STR(p) #fn)
> note: in expansion of macro
> '_FORTIFY_FN'
> 144 | _FORTIFY_FN(mempcpy) void
> *mempcpy(void *__d, const void *__s, size_t __n)
> In function 'mempcpy':
> error: called object '__orig_mempcpy' is not a
> function or function pointer
> 151 |  return _orig_mempcpy(__d, __s, __n);
> 
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
> toolchain/fortify-headers/Makefile                  |  2 +-
> toolchain/fortify-headers/patches/010-mempcpy.patch | 11 +++++++++++
> 2 files changed, 12 insertions(+), 1 deletion(-)
> create mode 100644 toolchain/fortify-headers/patches/010-mempcpy.patch
> 
> diff --git a/toolchain/fortify-headers/Makefile b/toolchain/fortify-headers/Makefile
> index a6151bb2f1..bb67c33c30 100644
> --- a/toolchain/fortify-headers/Makefile
> +++ b/toolchain/fortify-headers/Makefile
> @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/target.mk
> 
> PKG_NAME:=fortify-headers
> PKG_VERSION:=1.1
> -PKG_RELEASE=1
> +PKG_RELEASE=2
> 
> PKG_SOURCE_URL:=http://dl.2f30.org/releases
> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> diff --git a/toolchain/fortify-headers/patches/010-mempcpy.patch b/toolchain/fortify-headers/patches/010-mempcpy.patch
> new file mode 100644
> index 0000000000..8423395da5
> --- /dev/null
> +++ b/toolchain/fortify-headers/patches/010-mempcpy.patch
> @@ -0,0 +1,11 @@
> +--- a/include/string.h
> ++++ b/include/string.h
> +@@ -139,7 +139,7 @@ _FORTIFY_FN(strncpy) char *strncpy(char
> + 	return __orig_strncpy(__d, __s, __n);
> + }
> + 
> +-#ifdef _GNU_SOURCE
> ++#if 0
This seems more like partly disabling code that poses problems then fixing it, a work-around.
Since the code code concerned deals with code security, I would NACK it.

> + #undef mempcpy
> + _FORTIFY_FN(mempcpy) void *mempcpy(void *__d, const void *__s, size_t __n)
> + {
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel





More information about the openwrt-devel mailing list