SHA256
1
0
forked from pool/glibc

Accepting request 345159 from home:Andreas_Schwab:Factory

- resolv-mem-leak.patch: Fix resource leak in resolver (BZ #19257)
- tzset-tzname.patch: Force rereading TZDEFRULES after it was used to set
  DST rules only (BZ #19253)

- glibc-2.3.90-noversion.diff: use stat64

- ld-pointer-guard.patch: Always enable pointer guard (bsc#950944, BZ
  #18928)

OBS-URL: https://build.opensuse.org/request/show/345159
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=419
This commit is contained in:
Andreas Schwab 2015-11-19 09:31:48 +00:00 committed by Git OBS Bridge
parent 5366b2a10b
commit 5f9962d8aa
10 changed files with 303 additions and 2 deletions

View File

@ -24,7 +24,7 @@ Index: glibc-2.20/elf/rtld.c
+ && (main_map->l_info[DT_DEBUG] != 0
+ || !(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)))
+ {
+ struct stat test_st;
+ struct stat64 test_st;
+ int test_fd;
+ bool can_load;
+
@ -36,7 +36,7 @@ Index: glibc-2.20/elf/rtld.c
+ can_load = false;
+ else
+ {
+ if (__fxstat (_STAT_VER, test_fd, &test_st) < 0
+ if (__fxstat64 (_STAT_VER, test_fd, &test_st) < 0
+ || test_st.st_size == 0)
+ can_load = false;
+ __close(test_fd);

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Nov 18 15:09:30 UTC 2015 - schwab@suse.de
- resolv-mem-leak.patch: Fix resource leak in resolver (BZ #19257)
- tzset-tzname.patch: Force rereading TZDEFRULES after it was used to set
DST rules only (BZ #19253)
-------------------------------------------------------------------
Mon Oct 26 15:22:53 UTC 2015 - schwab@suse.de
- glibc-2.3.90-noversion.diff: use stat64
-------------------------------------------------------------------
Mon Oct 19 12:28:58 UTC 2015 - schwab@suse.de
- ld-pointer-guard.patch: Always enable pointer guard (bsc#950944, BZ
#18928)
-------------------------------------------------------------------
Mon Oct 12 08:12:10 UTC 2015 - schwab@suse.de

View File

@ -240,6 +240,8 @@ Patch1002: mntent-blank-line.patch
Patch1003: opendir-o-directory-check.patch
# PATCH-FIX-UPSTREAM strcoll: Remove incorrect STRDIFF-based optimization (BZ #18589)
Patch1004: strcoll-remove-strdiff-opt.patch
# PATCH-FIX-UPSTREAM Always enable pointer guard (BZ #18928)
Patch1005: ld-pointer-guard.patch
###
# Patches awaiting upstream approval
@ -264,6 +266,10 @@ Patch2009: nss-files-long-lines-2.patch
Patch2010: 0001-powerpc-Fix-a-race-condition-when-eliding-a-lock-20150730.patch
# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830)
Patch2011: iconv-reset-input-buffer.patch
# PATCH-FIX-UPSTREAM Force rereading TZDEFRULES after it was used to set DST rules only (BZ #19253)
Patch2012: tzset-tzname.patch
# PATCH-FIX-UPSTREAM Fix resource leak in resolver (BZ #19257)
Patch2013: resolv-mem-leak.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -468,6 +474,7 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch2000 -p1
%patch2002 -p1
@ -479,6 +486,8 @@ rm nscd/s-stamp
%patch2009 -p1
%patch2010 -p1
%patch2011 -p1
%patch2012 -p1
%patch2013 -p1
%patch3000

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Nov 18 15:09:30 UTC 2015 - schwab@suse.de
- resolv-mem-leak.patch: Fix resource leak in resolver (BZ #19257)
- tzset-tzname.patch: Force rereading TZDEFRULES after it was used to set
DST rules only (BZ #19253)
-------------------------------------------------------------------
Mon Oct 26 15:22:53 UTC 2015 - schwab@suse.de
- glibc-2.3.90-noversion.diff: use stat64
-------------------------------------------------------------------
Mon Oct 19 12:28:58 UTC 2015 - schwab@suse.de
- ld-pointer-guard.patch: Always enable pointer guard (bsc#950944, BZ
#18928)
-------------------------------------------------------------------
Mon Oct 12 08:12:10 UTC 2015 - schwab@suse.de

View File

@ -239,6 +239,8 @@ Patch1002: mntent-blank-line.patch
Patch1003: opendir-o-directory-check.patch
# PATCH-FIX-UPSTREAM strcoll: Remove incorrect STRDIFF-based optimization (BZ #18589)
Patch1004: strcoll-remove-strdiff-opt.patch
# PATCH-FIX-UPSTREAM Always enable pointer guard (BZ #18928)
Patch1005: ld-pointer-guard.patch
###
# Patches awaiting upstream approval
@ -263,6 +265,10 @@ Patch2009: nss-files-long-lines-2.patch
Patch2010: 0001-powerpc-Fix-a-race-condition-when-eliding-a-lock-20150730.patch
# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830)
Patch2011: iconv-reset-input-buffer.patch
# PATCH-FIX-UPSTREAM Force rereading TZDEFRULES after it was used to set DST rules only (BZ #19253)
Patch2012: tzset-tzname.patch
# PATCH-FIX-UPSTREAM Fix resource leak in resolver (BZ #19257)
Patch2013: resolv-mem-leak.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -468,6 +474,7 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch2000 -p1
%patch2002 -p1
@ -479,6 +486,8 @@ rm nscd/s-stamp
%patch2009 -p1
%patch2010 -p1
%patch2011 -p1
%patch2012 -p1
%patch2013 -p1
%patch3000

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Nov 18 15:09:30 UTC 2015 - schwab@suse.de
- resolv-mem-leak.patch: Fix resource leak in resolver (BZ #19257)
- tzset-tzname.patch: Force rereading TZDEFRULES after it was used to set
DST rules only (BZ #19253)
-------------------------------------------------------------------
Mon Oct 26 15:22:53 UTC 2015 - schwab@suse.de
- glibc-2.3.90-noversion.diff: use stat64
-------------------------------------------------------------------
Mon Oct 19 12:28:58 UTC 2015 - schwab@suse.de
- ld-pointer-guard.patch: Always enable pointer guard (bsc#950944, BZ
#18928)
-------------------------------------------------------------------
Mon Oct 12 08:12:10 UTC 2015 - schwab@suse.de

View File

@ -240,6 +240,8 @@ Patch1002: mntent-blank-line.patch
Patch1003: opendir-o-directory-check.patch
# PATCH-FIX-UPSTREAM strcoll: Remove incorrect STRDIFF-based optimization (BZ #18589)
Patch1004: strcoll-remove-strdiff-opt.patch
# PATCH-FIX-UPSTREAM Always enable pointer guard (BZ #18928)
Patch1005: ld-pointer-guard.patch
###
# Patches awaiting upstream approval
@ -264,6 +266,10 @@ Patch2009: nss-files-long-lines-2.patch
Patch2010: 0001-powerpc-Fix-a-race-condition-when-eliding-a-lock-20150730.patch
# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830)
Patch2011: iconv-reset-input-buffer.patch
# PATCH-FIX-UPSTREAM Force rereading TZDEFRULES after it was used to set DST rules only (BZ #19253)
Patch2012: tzset-tzname.patch
# PATCH-FIX-UPSTREAM Fix resource leak in resolver (BZ #19257)
Patch2013: resolv-mem-leak.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -468,6 +474,7 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch2000 -p1
%patch2002 -p1
@ -479,6 +486,8 @@ rm nscd/s-stamp
%patch2009 -p1
%patch2010 -p1
%patch2011 -p1
%patch2012 -p1
%patch2013 -p1
%patch3000

66
ld-pointer-guard.patch Normal file
View File

@ -0,0 +1,66 @@
2015-10-15 Florian Weimer <fweimer@redhat.com>
[BZ #18928]
* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
_dl_pointer_guard member.
* elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard
initializer.
(security_init): Always set up pointer guard.
(process_envvars): Do not process LD_POINTER_GUARD.
Index: glibc-2.22/elf/rtld.c
===================================================================
--- glibc-2.22.orig/elf/rtld.c
+++ glibc-2.22/elf/rtld.c
@@ -162,7 +162,6 @@ struct rtld_global_ro _rtld_global_ro at
._dl_hwcap_mask = HWCAP_IMPORTANT,
._dl_lazy = 1,
._dl_fpu_control = _FPU_DEFAULT,
- ._dl_pointer_guard = 1,
._dl_pagesize = EXEC_PAGESIZE,
._dl_inhibit_cache = 0,
@@ -709,15 +708,12 @@ security_init (void)
#endif
/* Set up the pointer guard as well, if necessary. */
- if (GLRO(dl_pointer_guard))
- {
- uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
- stack_chk_guard);
+ uintptr_t pointer_chk_guard
+ = _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
#ifdef THREAD_SET_POINTER_GUARD
- THREAD_SET_POINTER_GUARD (pointer_chk_guard);
+ THREAD_SET_POINTER_GUARD (pointer_chk_guard);
#endif
- __pointer_chk_guard_local = pointer_chk_guard;
- }
+ __pointer_chk_guard_local = pointer_chk_guard;
/* We do not need the _dl_random value anymore. The less
information we leave behind, the better, so clear the
@@ -2517,9 +2513,6 @@ process_envvars (enum mode *modep)
GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
break;
}
-
- if (memcmp (envline, "POINTER_GUARD", 13) == 0)
- GLRO(dl_pointer_guard) = envline[14] != '0';
break;
case 14:
Index: glibc-2.22/sysdeps/generic/ldsodefs.h
===================================================================
--- glibc-2.22.orig/sysdeps/generic/ldsodefs.h
+++ glibc-2.22/sysdeps/generic/ldsodefs.h
@@ -592,9 +592,6 @@ struct rtld_global_ro
/* List of auditing interfaces. */
struct audit_ifaces *_dl_audit;
unsigned int _dl_naudit;
-
- /* 0 if internal pointer values should not be guarded, 1 if they should. */
- EXTERN int _dl_pointer_guard;
};
# define __rtld_global_attribute__
# if IS_IN (rtld)

21
resolv-mem-leak.patch Normal file
View File

@ -0,0 +1,21 @@
Fix resource leak in resolver (bug 19257)
* resolv/res_init.c (__res_iclose): Use statp->nscount instead of
statp->_u._ext.nscount as loop count.
---
resolv/res_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: glibc-2.22/resolv/res_init.c
===================================================================
--- glibc-2.22.orig/resolv/res_init.c
+++ glibc-2.22/resolv/res_init.c
@@ -593,7 +593,7 @@ __res_iclose(res_state statp, bool free_
statp->_vcsock = -1;
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
}
- for (ns = 0; ns < statp->_u._ext.nscount; ns++)
+ for (ns = 0; ns < statp->nscount; ns++)
if (statp->_u._ext.nsaddrs[ns]) {
if (statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);

133
tzset-tzname.patch Normal file
View File

@ -0,0 +1,133 @@
Force rereading TZDEFRULES after it was used to set DST rules only (bug #19253)
If the TZDEFRULES file was used to set the DST rules when $TZ didn't
provide any we need to make sure that the next time it is used we
recompute everything as __tzfile_default changes some setting from what is
provided by TZDEFRULES.
[BZ #19253]
* time/tzfile.c (__tzfile_default): Invalidate tzfile attribute
cache when TZDEFRULES was used.
* time/tst-tzname.c: New file.
* time/Makefile (test): Add tst-tzname.
(tst-tzname-ENV, CFLAGS-tst-tzname.c): Define.
* timezone/Makefile (test-zones): Add $(posixrules-file).
($(testdata)/$(posixrules-file)): New rule.
Index: glibc-2.22/time/Makefile
===================================================================
--- glibc-2.22.orig/time/Makefile
+++ glibc-2.22/time/Makefile
@@ -37,7 +37,8 @@ aux := era alt_digit lc-time-cleanup
tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
- tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime
+ tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
+ tst-tzname
include ../Rules
@@ -55,4 +56,7 @@ CFLAGS-test_time.c = -Wno-format
tst-getdate-ENV= DATEMSK=datemsk TZDIR=${common-objpfx}timezone/testdata
test_time-ARGS= EST5EDT CST
+tst-tzname-ENV = TZDIR=${common-objpfx}timezone/testdata
+CFLAGS-tst-tzname.c = -DTZDEFRULES='"$(posixrules-file)"'
+
bug-getdate1-ARGS = ${objpfx}bug-getdate1-fmt
Index: glibc-2.22/time/tst-tzname.c
===================================================================
--- /dev/null
+++ glibc-2.22/time/tst-tzname.c
@@ -0,0 +1,50 @@
+/* Test that tzset sets tzname correctly (BZ #19253).
+ Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+static int
+do_test (void)
+{
+ int result = 0;
+
+ setenv ("TZ", TZDEFRULES, 1);
+ tzset ();
+ const char *stdtz = strdup (tzname[0]);
+ setenv ("TZ", "STD-1DST", 1);
+ tzset ();
+ if (strcmp (tzname[0], "STD") != 0)
+ {
+ printf ("FAIL: TZ=STD-1DST, tzname[0] = %s\n", tzname[0]);
+ result = 1;
+ }
+ setenv ("TZ", TZDEFRULES, 1);
+ tzset ();
+ if (strcmp (tzname[0], stdtz) != 0)
+ {
+ printf ("FAIL: TZ=%s, tzname[0] = %s\n", TZDEFRULES, tzname[0]);
+ result = 1;
+ }
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Index: glibc-2.22/time/tzfile.c
===================================================================
--- glibc-2.22.orig/time/tzfile.c
+++ glibc-2.22/time/tzfile.c
@@ -628,6 +628,12 @@ __tzfile_default (const char *std, const
__timezone = -types[0].offset;
compute_tzname_max (stdlen + dstlen);
+
+ /* Invalidate the tzfile attribute cache to force rereading
+ TZDEFRULES the next time it is used. */
+ tzfile_dev = 0;
+ tzfile_ino = 0;
+ tzfile_mtime = 0;
}
void
Index: glibc-2.22/timezone/Makefile
===================================================================
--- glibc-2.22.orig/timezone/Makefile
+++ glibc-2.22/timezone/Makefile
@@ -49,7 +49,8 @@ ifeq ($(run-built-tests),yes)
# List zones generated by separate commands running zic on the host.
# Each such zic run counts as a separate test.
test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
- Australia/Melbourne America/Sao_Paulo Asia/Tokyo
+ Australia/Melbourne America/Sao_Paulo Asia/Tokyo \
+ $(posixrules-file)
tests-special += $(addprefix $(testdata)/, $(test-zones))
endif
@@ -101,6 +102,8 @@ zic-deps = $(objpfx)zic $(leapseconds) y
$(testdata)/America/New_York: northamerica $(zic-deps)
$(build-testdata)
+$(testdata)/$(posixrules-file): $(testdata)/America/New_York
+ $(make-link); $(evaluate-test)
$(testdata)/Etc/UTC: etcetera $(zic-deps)
$(build-testdata)
# Use a pattern rule to indicate the command produces both targets at once.