Re: [OpenWrt-Devel] [PATCH RFC firewall3] musl-compat: avoid kernel header conflicts
* Ralph Sennhauser[2016-11-06 10:59:43 +0100]: > The conflict between Musls net/if.h and linux/if.h is an old well known > one and taken care of by a series of linux-headers patches in OpenWrt. > Since Linux 4.8-rc5 Firewall3 also indirectly pulls in linux/in.h and > linux/in6.h leading to new conflicts. can you check if http://www.openwall.com/lists/musl/2016/10/18/1 works for you? ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [musl] regex issue / asterisk / musl / sed
* Szabolcs Nagy <n...@port70.net> [2016-02-29 14:53:48 +0100]: > * Bastian Bittorf <bitt...@bluebottle.com> [2016-02-29 13:57:36 +0100]: > > root@box:~ echo 'o*o' | sed -e 's/*/asterisk/g' > > sed: bad regex '*': Invalid regexp > > root@box:~ echo 'o*o' | sed -e 's/\*/asterisk/g' > > oasterisko > > > > it's musl 1.1.14 on OpenWrt / r48814 > > both commands are working fine with glibc and uclibc > > but the first invokation fails with musl 1.1.14 but > > works with musl 1.1.13. unsre if the prob is on my > > side, maybe $you have an idea... > > yes, i introduced this regression in > http://git.musl-libc.org/cgit/musl/commit/?id=7eaa76fc2e7993582989d3838b1ac32dd8abac09 > > because i missed the special * behaviour for BRE, > but even before that ^* was broken so just reverting > the patch is not enough, handling * after an anchor > or assertion correctly needs more code changes. a possible fix is attached, the handling of ^ and $ in BRE is suboptimal, but that will need a bigger refactoring. >From b4abe263b2bc0c183274d1aec70cc586e4a46ba1 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy <n...@port70.net> Date: Mon, 29 Feb 2016 15:04:46 + Subject: [PATCH 1/2] fix * at the start of a BRE subexpression commit 7eaa76fc2e7993582989d3838b1ac32dd8abac09 made * invalid at the start of a BRE subexpression, but it should be accepted as literal * there according to the standard. This patch does not fix subexpressions starting with ^*. --- src/regex/regcomp.c |4 1 file changed, 4 deletions(-) diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index da6abd1..7a2864c 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -889,7 +889,6 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s) s++; break; case '*': - return REG_BADPAT; case '{': case '+': case '?': @@ -978,9 +977,6 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) } parse_iter: - /* extension: repetitions are rejected after an empty node - eg. (+), |*, {2}, but assertions are not treated as empty - so ^* or $? are accepted currently. */ for (;;) { int min, max; -- 1.7.9.5 >From d24223c8b344ab3c58f1b9200379bd5349bb8cee Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy <n...@port70.net> Date: Mon, 29 Feb 2016 16:36:25 + Subject: [PATCH 2/2] fix ^* at the start of a complete BRE This is a workaround to treat * as literal * at the start of a BRE. Ideally ^ would be treated as an anchor at the start of any BRE subexpression and similarly $ would be an anchor at the end of any subexpression. This is not required by the standard and hard to do with the current code, but it's the existing practice. If it is changed, * should be treated as literal after such anchor as well. --- src/regex/regcomp.c |4 1 file changed, 4 insertions(+) diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 7a2864c..5fad98b 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -994,6 +994,10 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) if (*s=='\\') s++; + /* handle ^* at the start of a complete BRE. */ + if (!ere && s==ctx->re+1 && s[-1]=='^') +break; + /* extension: multiple consecutive *+?{,} is unspecified, but (a+)+ has to be supported so accepting a++ makes sense, note however that the RE_DUP_MAX limit can be -- 1.7.9.5 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [musl] regex issue / asterisk / musl / sed
* Bastian Bittorf[2016-02-29 13:57:36 +0100]: > root@box:~ echo 'o*o' | sed -e 's/*/asterisk/g' > sed: bad regex '*': Invalid regexp > root@box:~ echo 'o*o' | sed -e 's/\*/asterisk/g' > oasterisko > > it's musl 1.1.14 on OpenWrt / r48814 > both commands are working fine with glibc and uclibc > but the first invokation fails with musl 1.1.14 but > works with musl 1.1.13. unsre if the prob is on my > side, maybe $you have an idea... yes, i introduced this regression in http://git.musl-libc.org/cgit/musl/commit/?id=7eaa76fc2e7993582989d3838b1ac32dd8abac09 because i missed the special * behaviour for BRE, but even before that ^* was broken so just reverting the patch is not enough, handling * after an anchor or assertion correctly needs more code changes. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Alsa-lib (libasound) segfaults on TLS variable (musl on mips)
* Ted Hess th...@kitschensync.net [2015-06-23 18:04:35 -0400]: Segfault in 'snd_lib_error_set_local' (error.c) referencing static __thread snd_local_error_handler_t local_error; Program received signal SIGSEGV, Segmentation fault. 0x0041b164 in snd_lib_error_set_local () (gdb) bt #0 0x0041b164 in snd_lib_error_set_local () #1 0x0041fb68 in try_config () #2 0x00420d80 in snd_device_name_hint () #3 0x0040a3be in pcm_list () #4 0x0040e92a in main () (gdb) disas Dump of assembler code for function snd_lib_error_set_local: 0x0041b12c +0: lui gp,0x8 0x0041b130 +4: addiu gp,gp,23668 0x0041b134 +8: addu gp,gp,t9 0x0041b138 +12: addiu sp,sp,-16 0x0041b13c +16: lw t9,-29872(gp) 0x0041b140 +20: sw ra,12(sp) 0x0041b144 +24: sw s0,8(sp) 0x0041b148 +28: sw gp,0(sp) 0x0041b14c +32: move s0,a0 0x0041b150 +36: addiu a0,gp,-29376 0x0041b154 +40: jalr t9 0x0041b158 +44: nop 0x0041b15c +48: lui v1,0x0 0x0041b160 +52: addu v1,v1,v0 = 0x0041b164 +56: lw v0,-32768(v1) 0x0041b168 +60: sw s0,-32768(v1) thanks for the report the bug is that mips tls access uses a hard coded -32768 offset relative to whatever __tls_get_addr returned. and musl did not account for this offset. the attached patch fixes the issue for me, we will fix it in musl soon. diff --git a/arch/mips/pthread_arch.h b/arch/mips/pthread_arch.h index f8e35ae..626b9bb 100644 --- a/arch/mips/pthread_arch.h +++ b/arch/mips/pthread_arch.h @@ -13,4 +13,6 @@ static inline struct pthread *__pthread_self() #define TLS_ABOVE_TP #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000) +#define DTV_OFFSET 0x8000 + #define CANCEL_REG_IP (3-(union {int __i; char __b;}){1}.__b) diff --git a/src/thread/__tls_get_addr.c b/src/thread/__tls_get_addr.c index 3633396..bcc9be3 100644 --- a/src/thread/__tls_get_addr.c +++ b/src/thread/__tls_get_addr.c @@ -1,6 +1,10 @@ #include stddef.h #include pthread_impl.h +#ifndef DTV_OFFSET +#define DTV_OFFSET 0 +#endif + void *__tls_get_addr(size_t *v) { pthread_t self = __pthread_self(); @@ -8,9 +12,9 @@ void *__tls_get_addr(size_t *v) __attribute__((__visibility__(hidden))) void *__tls_get_new(size_t *); if (v[0]=(size_t)self-dtv[0]) - return (char *)self-dtv[v[0]]+v[1]; - return __tls_get_new(v); + return (char *)self-dtv[v[0]]+v[1]+DTV_OFFSET; + return (char *)__tls_get_new(v)+DTV_OFFSET; #else - return (char *)self-dtv[1]+v[1]; + return (char *)self-dtv[1]+v[1]+DTV_OFFSET; #endif } ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] px5g-standalone: fix compilation after fortify-headers
* Hannu Nyman hannu.ny...@iki.fi [2015-06-23 22:05:54 +0300]: px5g-standalone: fix compilation after fortify-headers New fortify-headers functionality (default after r46117) is apparently conflicting with gcc -pedantic option. The package px5g-standalone fails to compile due to error: #include_next is a GCC extension errors. See https://dev.openwrt.org/ticket/19975 Fix the compilation of px5g-standalone by removing the -pedantic gcc option. it seems to me that adding __extension__ in front of the include_next line in the fortify headers make the warning go away. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Alsa-lib (libasound) segfaults on TLS variable (musl on mips)
* Szabolcs Nagy n...@port70.net [2015-06-24 22:57:54 +0200]: the bug is that mips tls access uses a hard coded -32768 offset relative to whatever __tls_get_addr returned. and musl did not account for this offset. only affects mips shared objects with 'static __thread' variables, extern __thread variables worked fine (and only those were tested in the libc-tests). the attached patch fixes the issue for me, we will fix it in musl soon. better patch attached that undoes the offset for extern tls vars in relocs handling.. (and with more consistent naming) diff --git a/arch/mips/pthread_arch.h b/arch/mips/pthread_arch.h index f8e35ae..904a248 100644 --- a/arch/mips/pthread_arch.h +++ b/arch/mips/pthread_arch.h @@ -13,4 +13,6 @@ static inline struct pthread *__pthread_self() #define TLS_ABOVE_TP #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000) +#define DTP_OFFSET 0x8000 + #define CANCEL_REG_IP (3-(union {int __i; char __b;}){1}.__b) diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index b77c6f6..b4ca410 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -337,7 +337,10 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri *reloc_addr = def.dso-tls_id; break; case REL_DTPOFF: - *reloc_addr = tls_val + addend; +#ifndef DTP_OFFSET +#define DTP_OFFSET 0 +#endif + *reloc_addr = tls_val + addend - DTP_OFFSET; break; #ifdef TLS_ABOVE_TP case REL_TPOFF: diff --git a/src/thread/__tls_get_addr.c b/src/thread/__tls_get_addr.c index 3633396..94ea03c 100644 --- a/src/thread/__tls_get_addr.c +++ b/src/thread/__tls_get_addr.c @@ -1,6 +1,10 @@ #include stddef.h #include pthread_impl.h +#ifndef DTP_OFFSET +#define DTP_OFFSET 0 +#endif + void *__tls_get_addr(size_t *v) { pthread_t self = __pthread_self(); @@ -8,9 +12,9 @@ void *__tls_get_addr(size_t *v) __attribute__((__visibility__(hidden))) void *__tls_get_new(size_t *); if (v[0]=(size_t)self-dtv[0]) - return (char *)self-dtv[v[0]]+v[1]; - return __tls_get_new(v); + return (char *)self-dtv[v[0]]+v[1]+DTP_OFFSET; + return (char *)__tls_get_new(v)+DTP_OFFSET; #else - return (char *)self-dtv[1]+v[1]; + return (char *)self-dtv[1]+v[1]+DTP_OFFSET; #endif } ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] musl breaks python
* micke.p...@telldus.se micke.p...@telldus.se [2015-06-22 12:37:47 +0200]: I have discovered that python is broken using musl. When a thread created using the threading library exists, python segfaults. This is a simple example application showing the issue: fwiw i cant reproduce this on alpine-linux so this is either arch specific, openwrt specific or python version specific. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] otrx: musl (?) compiles it as for big endian arch on bcm53xx
* Rafa?? Mi??ecki zaj...@gmail.com [2015-06-20 23:26:22 +0200]: When compiling otrx packages on bcm53xx the following condition is true: #if __BYTE_ORDER == __BIG_ENDIAN It results in not working otrx app. I suspect it's a regression since switching to musl. Any ideas? musl does not include endian.h into random standard headers so if you don't include endian.h directly both macros will be 0 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] strip for musl libc
sstrip is disabled for musl for some reason https://dev.openwrt.org/changeset/34427 i guess strip should be turned on then to get reasonable sized binaries ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] -fPIC flag for nacl
* Chris Warner inh...@gmail.com [2012-12-14 07:33:43 +0430]: In order to get cjdns to cross-compile I had to enable -fPIC for the nacl package in the makefile. I have included my patch below. I am last time i checked nacl only provided statically linked binaries and it has asm implementations for certain platforms that are not position independent so -fPIC is probably not useful ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [musl] Support for musl libc in OpenWrt
* Florian Fainelli flor...@openwrt.org [2012-11-25 12:46:26 +0100]: Cop1 registers. After patching setjmp not to access these it works flawlessly on MIPS (big-endian) but MIPS (little-endian) still segfaults while being executed either from the kernel or qemu-mipsel. so there is endian issue with dynamic linking musl c code should not depend on endianness (eg on x86 it works fine) so i guess the issue is mips specific maybe something in mips asm or maybe there is some difference between mips and mipsel other than the endianness? (elf header or auxv something, or the build toolchain is different in some way) can you run libc.so itself? /lib/libc.so should print a usage message if it works then try to run it as ldd on a dynlinked binary ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [iptables] iptables broken ?
* Frank Meerk?tter fr...@meerkoetter.org [2012-11-24 22:25:26 +0100]: On 24/11/12 20:49, shazz wrote: error: nested redefinition of 'enum tcp_ca_state' /var/www/LOG/openwrt/tpl703n/trunk/build_dir/linux-ar71xx_generic_eglibc-2.16/linux-3.3.8/user_headers/include/linux/tcp.h:117:6: Revert 4cf1359d5dc38debc89834d895f9a3951044bf90 [package] iptables: add some musl portability fixes as a workaround. there seems to be a typo in the iptables musl_fixes.patch: diff --git a/package/network/utils/iptables/patches/300-musl_fixes.patch b/package/network/utils/iptables/patches/300-musl_fixe index b6f6a0e..e329aa9 100644 --- a/package/network/utils/iptables/patches/300-musl_fixes.patch +++ b/package/network/utils/iptables/patches/300-musl_fixes.patch @@ -66,7 +66,7 @@ #define _XT_OSF_H #include linux/types.h -+#if !defined(__UCLIBC__) !defined(__GLIBC_) ++#if !defined(__UCLIBC__) !defined(__GLIBC__) +#include linux/tcp.h +#endif ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel