diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-09-16 14:52:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-09-16 14:52:48 +0000 |
commit | a7b8a239e2db4cf5ba868dd1f1d8af6a16854b0e (patch) | |
tree | 36645762f16f9f696ba2a8f42d0084225f0c9ae4 /main/libc0.9.32 | |
parent | 2a2efac1fde2986830b7b0008551fa243a3848ba (diff) | |
download | aports-a7b8a239e2db4cf5ba868dd1f1d8af6a16854b0e.tar.bz2 aports-a7b8a239e2db4cf5ba868dd1f1d8af6a16854b0e.tar.xz |
main/libc0.9.32: new snapshot. enable debugging
Diffstat (limited to 'main/libc0.9.32')
9 files changed, 180 insertions, 172 deletions
diff --git a/main/libc0.9.32/0001-config-parser-do-not-assume-that-realloc-return-same.patch b/main/libc0.9.32/0001-config-parser-do-not-assume-that-realloc-return-same.patch new file mode 100644 index 000000000..bc08616fd --- /dev/null +++ b/main/libc0.9.32/0001-config-parser-do-not-assume-that-realloc-return-same.patch @@ -0,0 +1,59 @@ +From 46db9fdff735edfda088b06d619d23dec2fc3e7a Mon Sep 17 00:00:00 2001 +From: Natanael Copa <natanael.copa@gmail.com> +Date: Thu, 16 Sep 2010 08:23:34 +0000 +Subject: [PATCH 1/3] config parser: do not assume that realloc return same pointer + +We need to update the parser->line pointer on realloc and do not +initialize the token array til after the potensial realloc in +bb_get_chunk_with_continuation(). + +While here, also replace a realloc() with malloc() where pointer always +is NULL. + +Signed-off-by: Natanael Copa <natanael.copa@gmail.com> +--- + libc/misc/internals/parse_config.c | 9 ++++----- + 1 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c +index 8fa324e..6734f35 100644 +--- a/libc/misc/internals/parse_config.c ++++ b/libc/misc/internals/parse_config.c +@@ -78,6 +78,7 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr) + parsr->line_len += PAGE_SIZE; + parsr->data = realloc(parsr->data, + parsr->data_len + parsr->line_len); ++ parsr->line = parsr->data + parsr->data_len; + } + } + return pos; +@@ -186,23 +187,21 @@ again: + parser->line_len = 81; + if (parser->data_len == 0) + parser->data_len += 1 + ntokens * sizeof(char *); +- parser->data = realloc(parser->data, +- parser->data_len + parser->line_len); ++ parser->data = malloc(parser->data_len + parser->line_len); + if (parser->data == NULL) + return 0; + parser->allocated |= 1; + } /* else { assert(parser->data_len > 0); } */ + if (parser->line == NULL) + parser->line = parser->data + parser->data_len; +- if (*tokens == NULL) +- *tokens = (char **) parser->data; +- memset(*tokens, 0, sizeof(*tokens[0]) * ntokens); + /*config_free_data(parser);*/ + + /* Read one line (handling continuations with backslash) */ + len = bb_get_chunk_with_continuation(parser); + if (len == -1) + return 0; ++ *tokens = (char **) parser->data; ++ memset(*tokens, 0, sizeof(*tokens[0]) * ntokens); + line = parser->line; + + /* Skip multiple token-delimiters in the start of line? */ +-- +1.7.2.3 + diff --git a/main/libc0.9.32/0001-config-parser-fix-memory-corruption.patch b/main/libc0.9.32/0001-config-parser-fix-memory-corruption.patch deleted file mode 100644 index 58acfb423..000000000 --- a/main/libc0.9.32/0001-config-parser-fix-memory-corruption.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 80bcb7a4806b27397629cf2e6bcbb7e8a0c5db5b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Fri, 6 Aug 2010 11:29:38 +0300 -Subject: [PATCH] config parser: fix memory corruption -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -fgets will happily write over allocated area limits. Adjusted the -buffer size according to how much is already read. - -Also increase the maximum default line length, as 80 is slightly -small. It might be better if bb_get_chunk_with_continuation would -reallocate the line buffer if it was not user given. - -Signed-off-by: Timo Teräs <timo.teras@iki.fi> ---- - libc/misc/internals/parse_config.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c -index cbb6ef7..8404d80 100644 ---- a/libc/misc/internals/parse_config.c -+++ b/libc/misc/internals/parse_config.c -@@ -60,7 +60,7 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr) - char *chp; - - while (1) { -- if (fgets(parsr->line + pos, parsr->line_len, parsr->fp) == NULL) { -+ if (fgets(parsr->line + pos, parsr->line_len - pos, parsr->fp) == NULL) { - memset(parsr->line, 0, parsr->line_len); - pos = -1; - break; -@@ -179,7 +179,7 @@ int attribute_hidden FAST_FUNC config_read(parser_t *parser, char ***tokens, - again: - if (parser->data == NULL) { - if (parser->line_len == 0) -- parser->line_len = 81; -+ parser->line_len = 161; - if (parser->data_len == 0) - parser->data_len += 1 + ntokens * sizeof(char *); - parser->data = realloc(parser->data, --- -1.7.0.4 - diff --git a/main/libc0.9.32/0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch b/main/libc0.9.32/0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch deleted file mode 100644 index 55edc51c9..000000000 --- a/main/libc0.9.32/0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch +++ /dev/null @@ -1,73 +0,0 @@ -From ed8017b08bee868eb5ea11c0b57074875267a3f1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Fri, 6 Aug 2010 13:26:25 +0300 -Subject: [PATCH] nptl: fix calling convention for __pthread_mutex_cond_lock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The assembly versions of pthread_cond_wait calls -__pthread_mutex_cond_lock and __pthread_mutex_cond_lock_adjust -using internal calling convention (which differs from default -calling convention at least on x86). Thus these two functions -must be defined with internal_function or the call sequence goes -wrong. - -__pthread_mutex_cond_lock resides in -sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c, but it does -evil macro definitions and includes pthread_mutex_lock.c, so -we need to add some extra kludge to pthread_mutex_lock.c to get -the prototypes correctly. - -Signed-off-by: Timo Teräs <timo.teras@iki.fi> ---- - libpthread/nptl/pthreadP.h | 6 ++++-- - libpthread/nptl/pthread_mutex_lock.c | 7 ++++++- - 2 files changed, 10 insertions(+), 3 deletions(-) - -diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h -index 85601d4..c45bd11 100644 ---- a/libpthread/nptl/pthreadP.h -+++ b/libpthread/nptl/pthreadP.h -@@ -414,8 +414,10 @@ extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex); - extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); - extern int __pthread_mutex_lock_internal (pthread_mutex_t *__mutex) - attribute_hidden; --extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex); --extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex); -+extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex) -+ attribute_hidden internal_function; -+extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex) -+ attribute_hidden internal_function; - extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); - extern int __pthread_mutex_unlock_internal (pthread_mutex_t *__mutex) - attribute_hidden; -diff --git a/libpthread/nptl/pthread_mutex_lock.c b/libpthread/nptl/pthread_mutex_lock.c -index 78b6671..77147db 100644 ---- a/libpthread/nptl/pthread_mutex_lock.c -+++ b/libpthread/nptl/pthread_mutex_lock.c -@@ -42,7 +42,11 @@ static int __pthread_mutex_lock_full (pthread_mutex_t *mutex) - - - int -+#ifdef NO_INCR -+attribute_hidden internal_function -+#else - attribute_protected -+#endif - __pthread_mutex_lock ( - pthread_mutex_t *mutex) - { -@@ -477,7 +481,8 @@ strong_alias (__pthread_mutex_lock, __pthread_mutex_lock_internal) - - - #ifdef NO_INCR --void attribute_protected -+void -+attribute_hidden internal_function - __pthread_mutex_cond_lock_adjust ( - pthread_mutex_t *mutex) - { --- -1.7.0.4 - diff --git a/main/libc0.9.32/0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch b/main/libc0.9.32/0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch new file mode 100644 index 000000000..29b8c3b3b --- /dev/null +++ b/main/libc0.9.32/0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch @@ -0,0 +1,57 @@ +From 1d1fab81f09e2472921e0b8f1897655de5f9089c Mon Sep 17 00:00:00 2001 +From: Natanael Copa <natanael.copa@gmail.com> +Date: Thu, 16 Sep 2010 11:37:39 +0000 +Subject: [PATCH 2/3] getservice: getservent_r must return ERANGE when buffer is too small + +This fixes issue introduced by 72e1a1ce186c39f07282398e2af9eb0253e60f15 + +This should also fix the following testcase to exit with error rather +than cause an endless loop. + +int main(void) { + if (getservbyname("non-existing", "udp") == NULL) + err(1, "getservbyname"); + return 0; +} + +Reported by Pirmin Walthert +http://lists.uclibc.org/pipermail/uclibc/2010-August/044277.html + +Signed-off-by: Natanael Copa <natanael.copa@gmail.com> +--- + libc/inet/getservice.c | 5 ++--- + 1 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c +index 1532df9..ccf9816 100644 +--- a/libc/inet/getservice.c ++++ b/libc/inet/getservice.c +@@ -69,7 +69,7 @@ int getservent_r(struct servent *result_buf, + char **serv_aliases; + char **tok = NULL; + const size_t aliaslen = sizeof(*serv_aliases) * MAXALIASES; +- int ret = ENOENT; ++ int ret = ERANGE; + + *result = NULL; + if (buflen < aliaslen +@@ -77,7 +77,7 @@ int getservent_r(struct servent *result_buf, + goto DONE_NOUNLOCK; + + __UCLIBC_MUTEX_LOCK(mylock); +- ++ ret = ENOENT; + if (servp == NULL) + setservent(serv_stayopen); + if (servp == NULL) +@@ -88,7 +88,6 @@ int getservent_r(struct servent *result_buf, + servp->line_len = buflen - aliaslen; + /* <name>[[:space:]]<port>/<proto>[[:space:]][<aliases>] */ + if (!config_read(servp, &tok, MAXALIASES, 3, "# \t/", PARSE_NORMAL)) { +- ret = ERANGE; + goto DONE; + } + result_buf->s_name = *(tok++); +-- +1.7.2.3 + diff --git a/main/libc0.9.32/0003-config-parser-always-initialize-line-pointer.patch b/main/libc0.9.32/0003-config-parser-always-initialize-line-pointer.patch new file mode 100644 index 000000000..171eeee0b --- /dev/null +++ b/main/libc0.9.32/0003-config-parser-always-initialize-line-pointer.patch @@ -0,0 +1,30 @@ +From 1f134a1d5456148e212dbe6eb69ce7bee11dc1fb Mon Sep 17 00:00:00 2001 +From: Natanael Copa <natanael.copa@gmail.com> +Date: Thu, 16 Sep 2010 11:51:21 +0000 +Subject: [PATCH 3/3] config parser: always initialize line pointer + +We must always initialize line pointer since data pointer might +have changed due to a realloc (in getserv.c for example). + +Signed-off-by: Natanael Copa <natanael.copa@gmail.com> +--- + libc/misc/internals/parse_config.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c +index 6734f35..6d3b6f4 100644 +--- a/libc/misc/internals/parse_config.c ++++ b/libc/misc/internals/parse_config.c +@@ -192,8 +192,7 @@ again: + return 0; + parser->allocated |= 1; + } /* else { assert(parser->data_len > 0); } */ +- if (parser->line == NULL) +- parser->line = parser->data + parser->data_len; ++ parser->line = parser->data + parser->data_len; + /*config_free_data(parser);*/ + + /* Read one line (handling continuations with backslash) */ +-- +1.7.2.3 + diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD index 11843bdfc..83d89a5b7 100644 --- a/main/libc0.9.32/APKBUILD +++ b/main/libc0.9.32/APKBUILD @@ -1,33 +1,41 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> _abiver=0.9.32 pkgname=libc$_abiver -_gitver=1008060645 +_gitver=1009151331 pkgver=${_abiver}_alpha0_git$_gitver -pkgrel=4 +pkgrel=0 pkgdesc="C library for developing embedded Linux systems" url=http://uclibc.org license="LGPL-2" - +options= subpackages="uclibc-dev:dev uclibc-utils:utils" depends_dev="linux-headers=>2.6.32" -#options="!strip" replaces=uclibc +DEBUG=y +if [ -n "$DEBUG" ]; then + options="!strip" +fi + + _snapurl="http://git.uclibc.org/uClibc/snapshot/master.tar.bz2" _snapfile="$pkgname-$pkgver.tar.bz2" source="http://build.alpinelinux.org:8010/distfiles/$_snapfile compat-stack-guard.patch uclibc-libm-pic.patch - uclibc-resolv-tls.patch - 0001-config-parser-fix-memory-corruption.patch - 0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch - 0001-netdb-increase-line-size-for-etc-services.patch 0001-create-DEVEL_PREFIX-MULTILIB_DIR-dir-rather-than-DEV.patch - getproto.patch - ld-tls.patch + + 0001-config-parser-do-not-assume-that-realloc-return-same.patch + 0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch + 0003-config-parser-always-initialize-line-pointer.patch + uclibcconfig.x86 uclibcconfig.i486 " +# uclibc-resolv-tls.patch +# 0001-config-parser-fix-memory-corruption.patch +# 0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch +# ld-tls.patch _config="$srcdir"/uclibcconfig.${ARCH:-x86} _builddir="$srcdir"/master @@ -73,6 +81,11 @@ build() { _kh=KERNEL_HEADERS="$SYSROOT/include" fi cp "$_config" .config + if [ -n "$DEBUG" ]; then + sed -i -e 's/# DODEBUG is not set/DODEBUG=y' \ + -e 's/DOSTRIP=y/# DOSTRIP is not set/' \ + .config + fi make silentoldconfig make -j1 pregen KERNEL_HEADERS="$SYSROOT"/usr/include \ CROSS="$CROSS" || return 1 @@ -104,15 +117,12 @@ utils() { mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin/ } -md5sums="2b3935c370307b806320e78883f9b07c libc0.9.32-0.9.32_alpha0_git1008060645.tar.bz2 +md5sums="966c830f294a8ab5069cc03a61e1b2ed libc0.9.32-0.9.32_alpha0_git1009151331.tar.bz2 4d408f72142ce55a0754948cc9cfe447 compat-stack-guard.patch 2f9739a980be24a842c57516155c7885 uclibc-libm-pic.patch -d08831b452acdeaa3037525ee617edab uclibc-resolv-tls.patch -d351ca4e5c33f4a7a60d4f1d754db5c4 0001-config-parser-fix-memory-corruption.patch -653b046611f98c990f1b52a28968ece3 0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch -39ac96d750ad058030f917912bfea466 0001-netdb-increase-line-size-for-etc-services.patch 9dd8192227f54d6d3ccb49dc54137ff3 0001-create-DEVEL_PREFIX-MULTILIB_DIR-dir-rather-than-DEV.patch -18afaad25c578bfbe1c7ddb0bea1228a getproto.patch -b769ffe8e6df01328fc6afb4b50da1cd ld-tls.patch -e2eb3bb00a0fe4d6f3d5b5c56b027bab uclibcconfig.x86 -e2eb3bb00a0fe4d6f3d5b5c56b027bab uclibcconfig.i486" +ba6e0370d1fc19e5903696de412507ef 0001-config-parser-do-not-assume-that-realloc-return-same.patch +19d923997f9625ce6f16d8128bbcba65 0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch +99b817778f4ef3a1b194740ea08990b4 0003-config-parser-always-initialize-line-pointer.patch +2ca97ab4b49f920247f335184bb02c1c uclibcconfig.x86 +2ca97ab4b49f920247f335184bb02c1c uclibcconfig.i486" diff --git a/main/libc0.9.32/ld-tls.patch b/main/libc0.9.32/ld-tls.patch deleted file mode 100644 index 057191c57..000000000 --- a/main/libc0.9.32/ld-tls.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in -index 99a726a..3e9676a 100644 ---- a/libpthread/nptl/Makefile.in -+++ b/libpthread/nptl/Makefile.in -@@ -48,9 +48,9 @@ libc-shared-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-shared-routines- - libc-static-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-static-routines-y:.c=.o)) - libc-shared-y += $(libc-shared-routines-y) $(libpthread_libc_OBJS:.o=.oS) - ifeq ($(DOPIC),y) --libc-static-y += $(libc-static-routines-y:.o=.os) $(libpthread_libc_a_OBJS:.o=.os) # $(libpthread_ld_tls_COBJ:.o=.os) -+libc-static-y += $(libc-static-routines-y:.o=.os) $(libpthread_libc_a_OBJS:.o=.os) $(libpthread_ld_tls_COBJ:.o=.os) - else --libc-static-y += $(libc-static-routines-y) $(libpthread_libc_a_OBJS) # $(libpthread_ld_tls_COBJ) -+libc-static-y += $(libc-static-routines-y) $(libpthread_libc_a_OBJS) $(libpthread_ld_tls_COBJ) - endif - - librt-pt-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-routines-y))) diff --git a/main/libc0.9.32/uclibc-resolv-tls.patch b/main/libc0.9.32/uclibc-resolv-tls.patch deleted file mode 100644 index 45a228517..000000000 --- a/main/libc0.9.32/uclibc-resolv-tls.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c -index 320aec4..f8066d2 100644 ---- a/libc/inet/resolv.c -+++ b/libc/inet/resolv.c -@@ -2916,8 +2916,8 @@ static void res_sync_func(void) - __nameserver[n].sa4 = rp->nsaddr_list[n]; /* struct copy */ - #endif - } -- __resolv_timeout = rp->retrans; -- __resolv_attempts = rp->retry; -+ __resolv_timeout = rp->retrans ?: RES_TIMEOUT; -+ __resolv_attempts = rp->retry ?: RES_DFLRETRY; - /* Extend and comment what program is known - * to use which _res.XXX member(s). - diff --git a/main/libc0.9.32/uclibcconfig.x86 b/main/libc0.9.32/uclibcconfig.x86 index 1368b58ec..3baabc771 100644 --- a/main/libc0.9.32/uclibcconfig.x86 +++ b/main/libc0.9.32/uclibcconfig.x86 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Version: 0.9.32-git -# Fri May 7 11:46:52 2010 +# Wed Sep 15 14:17:28 2010 # # TARGET_alpha is not set # TARGET_arm is not set @@ -51,7 +51,7 @@ CONFIG_486=y # CONFIG_WINCHIP2 is not set # CONFIG_CYRIXIII is not set # CONFIG_NEHEMIAH is not set -TARGET_SUBARCH="" +TARGET_SUBARCH="i486" # # Using ELF file format @@ -219,6 +219,7 @@ UCLIBC_HAS_NFTW=y UCLIBC_HAS_FTW=y UCLIBC_HAS_GLOB=y UCLIBC_HAS_GNU_GLOB=y +# UCLIBC_HAS_UTMPX is not set # # Library Installation Options @@ -249,8 +250,8 @@ UCLIBC_BUILD_NOEXECSTACK=y # CROSS_COMPILER_PREFIX="" UCLIBC_EXTRA_CFLAGS="" -# DODEBUG is not set -DOSTRIP=y +DODEBUG=y +# DOSTRIP is not set # DOASSERTS is not set # SUPPORT_LD_DEBUG is not set # SUPPORT_LD_DEBUG_EARLY is not set |