summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-04-24 20:31:50 +0000
committerJakub Jelinek <jakub@redhat.com>2006-04-24 20:31:50 +0000
commit1100b0e29213d536814d675cb3e1faff447db322 (patch)
treec6eb5ed6b41bccaaa7a9b263cac188a143a89e74
parent48f59b8e1a60fa1e9f20bfd322214cec1be3a635 (diff)
Updated to fedora-glibc-20060424T2027
-rw-r--r--ChangeLog32
-rw-r--r--debug/Makefile3
-rw-r--r--debug/Versions3
-rw-r--r--debug/readlinkat_chk.c31
-rw-r--r--debug/tst-chk1.c30
-rw-r--r--fedora/branch.mk4
-rw-r--r--include/unistd.h1
-rw-r--r--io/readlinkat.c1
-rw-r--r--malloc/arena.c4
-rw-r--r--posix/bits/unistd.h22
-rw-r--r--sysdeps/posix/getaddrinfo.c2
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c7
13 files changed, 128 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 62c3fe23fe..fdfd3ff811 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,32 @@
+2006-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ * malloc/arena.c (ptmalloc_init): Don't call __malloc_check_init
+ if MALLOC_CHECK_ env var contains an empty string.
+
+2006-04-24 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/posix/getaddrinfo.c (getaddrinfo): Always initialize in6ai.
+
+2006-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sync_file_range.c (sync_file_range): Use
+ __LONG_LONG_PAIR macro.
+
+ * posix/bits/unistd.h (__readlinkat_chk): New prototype.
+ (__readlinkat_alias): New alias.
+ (readlinkat): New inline function.
+ * include/unistd.h (readlinkat): Add libc_hidden_proto.
+ * sysdeps/unix/sysv/linux/readlinkat.c (readlinkat): Add
+ libc_hidden_def.
+ * io/readlinkat.c (readlinkat): Likewise.
+ * debug/readlinkat_chk.c: New file.
+ * debug/Makefile (routines): Add readlinkat_chk.
+ * debug/Versions (libc): Export __readlinkat_chk@@GLIBC_2.5.
+ * debug/tst-chk1.c (do_test): Add readlinkat tests.
+
2006-04-23 Ulrich Drepper <drepper@redhat.com>
- * nis/nss_nisplus/nisplus-netgrp.c: Cleanups.
+ * nis/nss_nisplus/nisplus-netgrp.c: Cleanups.
[BZ #1951]
* sysdeps/posix/sigset.c (sigset): Return correct value reflecting
@@ -37,13 +63,13 @@
* sysdeps/unix/sysv/linux/kernel-features.h: Define
__ASSUME_PROC_SELF_FD_SYMLINK.
* sysdeps/unix/sysv/linux/ttyname.c: Cleanups. Avoid compatibility
- code if possible. Move compatibility code in .text.compat section.
+ code is possible. Move compatibility code in .text.compat section.
* sysdeps/unix/sysv/linux/ttyname_r.c: Likewise.
2006-04-18 Ulrich Drepper <drepper@redhat.com>
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Rewrite to avoid loop
- over gaih array. There is only on function to call in the moment.
+ over gaih array. There is only one function to call in the moment.
2006-04-16 Ulrich Drepper <drepper@redhat.com>
diff --git a/debug/Makefile b/debug/Makefile
index 9123bf65b5..4b4b541ba7 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -31,7 +31,8 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \
printf_chk fprintf_chk vprintf_chk vfprintf_chk \
gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
- readlink_chk getwd_chk getcwd_chk realpath_chk ptsname_r_chk \
+ readlink_chk readlinkat_chk getwd_chk getcwd_chk \
+ realpath_chk ptsname_r_chk \
wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
wcpncpy_chk \
diff --git a/debug/Versions b/debug/Versions
index 683eb17d09..5c87af27c1 100644
--- a/debug/Versions
+++ b/debug/Versions
@@ -36,4 +36,7 @@ libc {
__stack_chk_fail;
}
+ GLIBC_2.5 {
+ __readlinkat_chk;
+ }
}
diff --git a/debug/readlinkat_chk.c b/debug/readlinkat_chk.c
new file mode 100644
index 0000000000..eab99c0ea9
--- /dev/null
+++ b/debug/readlinkat_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/param.h>
+
+
+ssize_t
+__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
+ size_t buflen)
+{
+ if (len > buflen)
+ __chk_fail ();
+
+ return readlinkat (fd, path, buf, len);
+}
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index a47d1466ec..c450744af5 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
@@ -947,6 +947,34 @@ do_test (void)
CHK_FAIL_END
#endif
+ int tmpfd = open ("/tmp", O_RDONLY | O_DIRECTORY);
+ if (tmpfd < 0)
+ FAIL ();
+
+ if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf, 4) != 3
+ || memcmp (readlinkbuf, "bar", 3) != 0)
+ FAIL ();
+ if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 1,
+ l0 + 3) != 3
+ || memcmp (readlinkbuf, "bbar", 4) != 0)
+ FAIL ();
+
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 2,
+ l0 + 3) != 3)
+ FAIL ();
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 3,
+ 4) != 3)
+ FAIL ();
+ CHK_FAIL_END
+#endif
+
+ close (tmpfd);
+
char *cwd1 = getcwd (NULL, 0);
if (cwd1 == NULL)
FAIL ();
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 30b137b955..5e2763d345 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
-fedora-sync-date := 2006-04-24 08:20 UTC
-fedora-sync-tag := fedora-glibc-20060424T0820
+fedora-sync-date := 2006-04-24 20:27 UTC
+fedora-sync-tag := fedora-glibc-20060424T2027
diff --git a/include/unistd.h b/include/unistd.h
index 670cb324ae..f8f15ed019 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -15,6 +15,7 @@ libc_hidden_proto (getlogin_r)
libc_hidden_proto (seteuid)
libc_hidden_proto (setegid)
libc_hidden_proto (tcgetpgrp)
+libc_hidden_proto (readlinkat)
/* Now define the internal interfaces. */
extern int __access (__const char *__name, int __type);
diff --git a/io/readlinkat.c b/io/readlinkat.c
index 483dc4914d..7e6a2227d8 100644
--- a/io/readlinkat.c
+++ b/io/readlinkat.c
@@ -46,5 +46,6 @@ readlinkat (fd, path, buf, len)
return -1;
}
stub_warning (readlinkat)
+libc_hidden_def (readlinkat)
#include <stub-tag.h>
diff --git a/malloc/arena.c b/malloc/arena.c
index 4d95462f26..6f0a9df8f1 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -551,8 +551,8 @@ ptmalloc_init (void)
}
s = getenv("MALLOC_CHECK_");
#endif
- if(s) {
- if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
+ if(s && s[0]) {
+ mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
if (check_action != 0)
__malloc_check_init();
}
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index d461108e53..96f26d5482 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -100,6 +100,28 @@ __NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
}
#endif
+#ifdef __USE_ATFILE
+extern ssize_t __readlinkat_chk (int __fd, __const char *__restrict __path,
+ char *__restrict __buf, size_t __len,
+ size_t __buflen)
+ __THROW __nonnull ((2, 3)) __wur;
+extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
+ (int __fd, __const char *__restrict __path,
+ char *__restrict __buf, size_t __len),
+ readlinkat)
+ __nonnull ((2, 3)) __wur;
+
+extern __always_inline __nonnull ((2, 3)) __wur ssize_t
+__NTH (readlinkat (int __fd, __const char *__restrict __path,
+ char *__restrict __buf, size_t __len))
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__len) || __len > __bos (__buf)))
+ return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
+ return __readlinkat_alias (__fd, __path, __buf, __len);
+}
+#endif
+
extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
__THROW __wur;
extern char *__REDIRECT_NTH (__getcwd_alias,
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 843e60bba3..e4fea334ca 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1516,7 +1516,7 @@ getaddrinfo (const char *name, const char *service,
if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
return EAI_BADFLAGS;
- struct in6addrinfo *in6ai;
+ struct in6addrinfo *in6ai = NULL;
size_t in6ailen;
bool seen_ipv4 = false;
bool seen_ipv6 = false;
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 9b4a730c0e..1361596503 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -87,3 +87,4 @@ readlinkat (fd, path, buf, len)
return result;
#endif
}
+libc_hidden_def (readlinkat)
diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c
index aabe192341..7519bb7fe6 100644
--- a/sysdeps/unix/sysv/linux/sync_file_range.c
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -29,9 +29,10 @@
int
sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
{
- return INLINE_SYSCALL (sync_file_range, 6, fd, (off_t) (from >> 32),
- (off_t) (from & 0xffffffff), (off_t) (to >> 32),
- (off_t) (to & 0xffffffff), flags);
+ return INLINE_SYSCALL (sync_file_range, 6, fd,
+ __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+ __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+ flags);
}
#else
int