Message ID | 20210413040329.2976942-1-rosenp@gmail.com |
---|---|
State | Not Applicable |
Headers | show |
Series | fortify-headers: fix compilation with GCC 10.3 | expand |
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. > Op 13 apr. 2021, om 06:03 heeft Rosen Penev <rosenp@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@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@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
On 4/13/21 6:03 AM, Rosen Penev wrote: > 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@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 > Could you please share your OpenWrt configuration. With this configuration it is compiling for me: ------------- hauke@hauke-t480:~/openwrt/openwrt$ ./scripts/diffconfig.sh CONFIG_TARGET_x86=y CONFIG_TARGET_x86_64=y CONFIG_TARGET_x86_64_DEVICE_generic=y CONFIG_DEVEL=y CONFIG_TOOLCHAINOPTS=y CONFIG_GCC_USE_VERSION_10=y # CONFIG_GCC_USE_VERSION_8 is not set CONFIG_GCC_VERSION="10.3.0" CONFIG_GCC_VERSION_10=y CONFIG_OPENSSL_ENGINE=y CONFIG_OPENSSL_OPTIMIZE_SPEED=y CONFIG_OPENSSL_WITH_ASM=y CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y CONFIG_OPENSSL_WITH_CMS=y CONFIG_OPENSSL_WITH_DEPRECATED=y CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y CONFIG_OPENSSL_WITH_PSK=y CONFIG_OPENSSL_WITH_SRP=y CONFIG_OPENSSL_WITH_TLS13=y CONFIG_PACKAGE_libopenssl=y CONFIG_PACKAGE_tvheadend=y CONFIG_PACKAGE_zlib=y CONFIG_TVHEADEND_CWC_SUPPORT=y CONFIG_TVHEADEND_DVBSCAN_SUPPORT=y CONFIG_TVHEADEND_LINUXDVB_SUPPORT=y ---------------- This could be similar to the umdns problem which only shows up on 32 bit platforms. Hauke
On Tue, Apr 13, 2021 at 3:53 PM Hauke Mehrtens <hauke@hauke-m.de> wrote: > > On 4/13/21 6:03 AM, Rosen Penev wrote: > > 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@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 > > > > Could you please share your OpenWrt configuration. It's basically malta - little endian (64-bit) with GCC10 and CONFIG_ALL. I can post if you really want. > > With this configuration it is compiling for me: > ------------- > hauke@hauke-t480:~/openwrt/openwrt$ ./scripts/diffconfig.sh > CONFIG_TARGET_x86=y > CONFIG_TARGET_x86_64=y > CONFIG_TARGET_x86_64_DEVICE_generic=y > CONFIG_DEVEL=y > CONFIG_TOOLCHAINOPTS=y > CONFIG_GCC_USE_VERSION_10=y > # CONFIG_GCC_USE_VERSION_8 is not set > CONFIG_GCC_VERSION="10.3.0" > CONFIG_GCC_VERSION_10=y > CONFIG_OPENSSL_ENGINE=y > CONFIG_OPENSSL_OPTIMIZE_SPEED=y > CONFIG_OPENSSL_WITH_ASM=y > CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y > CONFIG_OPENSSL_WITH_CMS=y > CONFIG_OPENSSL_WITH_DEPRECATED=y > CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y > CONFIG_OPENSSL_WITH_PSK=y > CONFIG_OPENSSL_WITH_SRP=y > CONFIG_OPENSSL_WITH_TLS13=y > CONFIG_PACKAGE_libopenssl=y > CONFIG_PACKAGE_tvheadend=y > CONFIG_PACKAGE_zlib=y > CONFIG_TVHEADEND_CWC_SUPPORT=y > CONFIG_TVHEADEND_DVBSCAN_SUPPORT=y > CONFIG_TVHEADEND_LINUXDVB_SUPPORT=y > ---------------- > > This could be similar to the umdns problem which only shows up on 32 bit > platforms. > > Hauke
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 + #undef mempcpy + _FORTIFY_FN(mempcpy) void *mempcpy(void *__d, const void *__s, size_t __n) + {
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@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