Accepting request 329759 from home:Andreas_Schwab:Factory

- opendir-o-directory-check.patch: Fix opendir inverted o_directory_works
  test
- static-dlopen.patch: Static dlopen default library search path fix
  (bsc#937853)

- mntent-blank-line.patch: Fix memory corruption w/blank lines

OBS-URL: https://build.opensuse.org/request/show/329759
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=414
This commit is contained in:
Andreas Schwab 2015-09-08 15:58:39 +00:00 committed by Git OBS Bridge
parent e85cac7c02
commit eb7479f1eb
9 changed files with 306 additions and 15 deletions

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Sep 7 13:27:58 UTC 2015 - schwab@suse.de
- opendir-o-directory-check.patch: Fix opendir inverted o_directory_works
test
- static-dlopen.patch: Static dlopen default library search path fix
(bsc#937853)
-------------------------------------------------------------------
Mon Aug 31 12:21:29 UTC 2015 - schwab@suse.de
- mntent-blank-line.patch: Fix memory corruption w/blank lines
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de

View File

@ -230,6 +230,14 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM Clear DF_1_NODELETE flag only for failed to load library (BZ #18778)
Patch1000: dont-remove-nodelete-flag.patch
# PATCH-FIX-UPSTREAM Readd O_LARGEFILE flag for openat64 (BZ #18781)
Patch1001: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM getmntent: fix memory corruption w/blank lines (BZ #18887)
Patch1002: mntent-blank-line.patch
# PATCH-FIX-UPSTREAM Fix opendir inverted o_directory_works test (BZ #18921)
Patch1003: opendir-o-directory-check.patch
###
# Patches awaiting upstream approval
@ -244,10 +252,8 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM Static dlopen default library search path fix (BZ #17250)
Patch2007: static-dlopen.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -447,13 +453,17 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Sep 7 13:27:58 UTC 2015 - schwab@suse.de
- opendir-o-directory-check.patch: Fix opendir inverted o_directory_works
test
- static-dlopen.patch: Static dlopen default library search path fix
(bsc#937853)
-------------------------------------------------------------------
Mon Aug 31 12:21:29 UTC 2015 - schwab@suse.de
- mntent-blank-line.patch: Fix memory corruption w/blank lines
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de

View File

@ -229,6 +229,14 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM Clear DF_1_NODELETE flag only for failed to load library (BZ #18778)
Patch1000: dont-remove-nodelete-flag.patch
# PATCH-FIX-UPSTREAM Readd O_LARGEFILE flag for openat64 (BZ #18781)
Patch1001: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM getmntent: fix memory corruption w/blank lines (BZ #18887)
Patch1002: mntent-blank-line.patch
# PATCH-FIX-UPSTREAM Fix opendir inverted o_directory_works test (BZ #18921)
Patch1003: opendir-o-directory-check.patch
###
# Patches awaiting upstream approval
@ -243,10 +251,8 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM Static dlopen default library search path fix (BZ #17250)
Patch2007: static-dlopen.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -447,13 +453,17 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Sep 7 13:27:58 UTC 2015 - schwab@suse.de
- opendir-o-directory-check.patch: Fix opendir inverted o_directory_works
test
- static-dlopen.patch: Static dlopen default library search path fix
(bsc#937853)
-------------------------------------------------------------------
Mon Aug 31 12:21:29 UTC 2015 - schwab@suse.de
- mntent-blank-line.patch: Fix memory corruption w/blank lines
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de

View File

@ -230,6 +230,14 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM Clear DF_1_NODELETE flag only for failed to load library (BZ #18778)
Patch1000: dont-remove-nodelete-flag.patch
# PATCH-FIX-UPSTREAM Readd O_LARGEFILE flag for openat64 (BZ #18781)
Patch1001: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM getmntent: fix memory corruption w/blank lines (BZ #18887)
Patch1002: mntent-blank-line.patch
# PATCH-FIX-UPSTREAM Fix opendir inverted o_directory_works test (BZ #18921)
Patch1003: opendir-o-directory-check.patch
###
# Patches awaiting upstream approval
@ -244,10 +252,8 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# PATCH-FIX-UPSTREAM Static dlopen default library search path fix (BZ #17250)
Patch2007: static-dlopen.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -447,13 +453,17 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000

183
mntent-blank-line.patch Normal file
View File

@ -0,0 +1,183 @@
2015-08-28 Mike Frysinger <vapier@gentoo.org>
[BZ #18887]
* misc/Makefile (tests): Add tst-mntent-blank-corrupt and
tst-mntent-blank-passno.
* misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
* misc/tst-mntent-blank-corrupt.c: New test.
* misc/tst-mntent-blank-passno.c: New test ripped from ...
* misc/tst-mntent.c (do_test): ... here.
diff --git a/misc/Makefile b/misc/Makefile
index aecb0da..2f5edf6 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -76,7 +76,8 @@ install-lib := libg.a
gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
+ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
+ tst-mntent-blank-corrupt tst-mntent-blank-passno
ifeq ($(run-built-tests),yes)
tests-special += $(objpfx)tst-error1-mem.out
endif
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 6159873..4f26998 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
end_ptr = strchr (buffer, '\n');
if (end_ptr != NULL) /* chop newline */
{
- while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
+ /* Do not walk past the start of buffer if it's all whitespace. */
+ while (end_ptr != buffer
+ && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
end_ptr--;
*end_ptr = '\0';
}
diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
new file mode 100644
index 0000000..92266a3
--- /dev/null
+++ b/misc/tst-mntent-blank-corrupt.c
@@ -0,0 +1,45 @@
+/* Make sure blank lines does not cause memory corruption BZ #18887.
+
+ Copyright (C) 2009-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 <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Make sure blank lines don't trigger memory corruption. This doesn't happen
+ for all targets though, so it's a best effort test BZ #18887. */
+static int
+do_test (void)
+{
+ FILE *fp;
+
+ fp = tmpfile ();
+ fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+ rewind (fp);
+
+ /* The corruption happens here ... */
+ getmntent (fp);
+ /* ... but trigers here. */
+ endmntent (fp);
+
+ /* If the test failed, we would crash, and not hit this point. */
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
new file mode 100644
index 0000000..fc04291
--- /dev/null
+++ b/misc/tst-mntent-blank-passno.c
@@ -0,0 +1,53 @@
+/* Make sure trailing whitespace is handled properly BZ #17273.
+
+ Copyright (C) 2009-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 <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Check entries to make sure trailing whitespace is ignored and we return the
+ correct passno value BZ #17273. */
+static int
+do_test (void)
+{
+ int result = 0;
+ FILE *fp;
+ struct mntent *mnt;
+
+ fp = tmpfile ();
+ fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+ rewind (fp);
+
+ mnt = getmntent (fp);
+ if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
+ || strcmp (mnt->mnt_dir, "/bar dir") != 0
+ || strcmp (mnt->mnt_type, "auto") != 0
+ || strcmp (mnt->mnt_opts, "bind") != 0
+ || mnt->mnt_freq != 0
+ || mnt->mnt_passno != 0)
+ {
+ puts ("Error while reading entry with trailing whitespaces");
+ result = 1;
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
index 932fd3f..b6ad8af 100644
--- a/misc/tst-mntent.c
+++ b/misc/tst-mntent.c
@@ -73,26 +73,6 @@ do_test (void)
puts ("Error while reading written entry back in");
result = 1;
}
-
- /* Part III: Entry with whitespaces at the end of a line. */
- rewind (fp);
-
- fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
-
- rewind (fp);
-
- mnt = getmntent (fp);
-
- if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
- || strcmp (mnt->mnt_dir, "/bar dir") != 0
- || strcmp (mnt->mnt_type, "auto") != 0
- || strcmp (mnt->mnt_opts, "bind") != 0
- || mnt->mnt_freq != 0
- || mnt->mnt_passno != 0)
- {
- puts ("Error while reading entry with trailing whitespaces");
- result = 1;
- }
}
return result;
--
2.5.1

View File

@ -0,0 +1,21 @@
2015-09-04 Roland McGrath <roland@hack.frob.com>
[BZ #18921]
* sysdeps/posix/opendir.c (need_isdir_precheck) [O_DIRECTORY]:
Fix inverted sense of test of 'o_directory_works' value.
Reported by Pádraig Brady <P@draigBrady.com>, diagnosed by
Bernhard Voelker <mail@bernhard-voelker.de>.
Index: glibc-2.22/sysdeps/posix/opendir.c
===================================================================
--- glibc-2.22.orig/sysdeps/posix/opendir.c
+++ glibc-2.22/sysdeps/posix/opendir.c
@@ -105,7 +105,7 @@ need_isdir_precheck (void)
tryopen_o_directory ();
/* We can skip the expensive `stat' call if O_DIRECTORY works. */
- return o_directory_works > 0;
+ return o_directory_works < 0;
#endif
return true;
}

18
static-dlopen.patch Normal file
View File

@ -0,0 +1,18 @@
2015-08-04 Maciej W. Rozycki <macro@linux-mips.org>
[BZ #17250]
* elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1
member.
Index: glibc-2.22/elf/dl-support.c
===================================================================
--- glibc-2.22.orig/elf/dl-support.c
+++ glibc-2.22/elf/dl-support.c
@@ -91,7 +91,6 @@ static struct link_map _dl_main_map =
.l_scope = _dl_main_map.l_scope_mem,
.l_local_scope = { &_dl_main_map.l_searchlist },
.l_used = 1,
- .l_flags_1 = DF_1_NODEFLIB,
.l_tls_offset = NO_TLS_OFFSET,
.l_serial = 1,
};