[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8473 - in /fsf/trunk/libc: ./ nscd/ sysdeps/sh/ sysdeps/sh/sh3/ sysdeps/sh/sh4/
- To: commits@xxxxxxxxxx
- Subject: [commits] r8473 - in /fsf/trunk/libc: ./ nscd/ sysdeps/sh/ sysdeps/sh/sh3/ sysdeps/sh/sh4/
- From: eglibc@xxxxxxxxxx
- Date: Tue, 19 May 2009 07:06:32 -0000
Author: eglibc
Date: Tue May 19 00:06:31 2009
New Revision: 8473
Log:
Import glibc-mainline for 2009-05-19
Added:
fsf/trunk/libc/sysdeps/sh/____longjmp_chk.S
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/nscd/nscd_helper.c
fsf/trunk/libc/sysdeps/sh/sh3/__longjmp.S
fsf/trunk/libc/sysdeps/sh/sh4/__longjmp.S
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue May 19 00:06:31 2009
@@ -1,3 +1,17 @@
+2009-05-18 Kaz Kojima <kkojima@xxxxxxxxxxxxxx>
+
+ * sysdeps/sh/____longjmp_chk.S: New file.
+ * sysdeps/sh/sh3/__longjmp.S: If CHECK_SP is defined, use it.
+ * sysdeps/sh/sh4/__longjmp.S: Likewise.
+
+2009-05-18 Jakub Jelinek <jakub@xxxxxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * nscd/nscd_helper.c (MINIMUM_HASHENTRY_SIZE): Define.
+ (__nscd_cache_search): Assume each entry in the
+ hash chain needs one hashentry and half of datahead. Use
+ MINIMUM_HASHENTRY_SIZE instead of sizeof(hashentry).
+
2009-05-16 Ulrich Drepper <drepper@xxxxxxxxxx>
* posix/sys/wait.h: Fix typos. Pretty printing.
Modified: fsf/trunk/libc/nscd/nscd_helper.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_helper.c (original)
+++ fsf/trunk/libc/nscd/nscd_helper.c Tue May 19 00:06:31 2009
@@ -468,6 +468,15 @@
}
+/* Using sizeof (hashentry) is not always correct to determine the size of
+ the data structure as found in the nscd cache. The program could be
+ a 64-bit process and nscd could be a 32-bit process. In this case
+ sizeof (hashentry) would overestimate the size. The following is
+ the minimum size of such an entry, good enough for our tests here. */
+#define MINIMUM_HASHENTRY_SIZE \
+ (offsetof (struct hashentry, dellist) + sizeof (int32_t))
+
+
/* Don't return const struct datahead *, as eventhough the record
is normally constant, it can change arbitrarily during nscd
garbage collection. */
@@ -481,10 +490,11 @@
ref_t trail = mapped->head->array[hash];
trail = atomic_forced_read (trail);
ref_t work = trail;
- size_t loop_cnt = datasize / (offsetof (struct datahead, data) + datalen);
+ size_t loop_cnt = datasize / (MINIMUM_HASHENTRY_SIZE
+ + offsetof (struct datahead, data) / 2);
int tick = 0;
- while (work != ENDREF && work + sizeof (struct hashentry) <= datasize)
+ while (work != ENDREF && work + MINIMUM_HASHENTRY_SIZE <= datasize)
{
struct hashentry *here = (struct hashentry *) (mapped->data + work);
ref_t here_key, here_packet;
@@ -541,7 +551,7 @@
return NULL;
#endif
- if (trail + sizeof (struct hashentry) > datasize)
+ if (trail + MINIMUM_HASHENTRY_SIZE > datasize)
return NULL;
trail = atomic_forced_read (trailelem->next);
Added: fsf/trunk/libc/sysdeps/sh/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sh/____longjmp_chk.S (added)
+++ fsf/trunk/libc/sysdeps/sh/____longjmp_chk.S Tue May 19 00:06:31 2009
@@ -1,0 +1,70 @@
+/* Copyright (C) 2009 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. */
+
+ .section .rodata.str1.1,"aMS",@progbits,1
+ .type longjmp_msg,@object
+longjmp_msg:
+ .string "longjmp causes uninitialized stack frame"
+ .size longjmp_msg, .-longjmp_msg
+ .text
+
+#define __longjmp ____longjmp_chk
+
+#ifdef PIC
+# define CALL_FAIL \
+ mov.l .Lfail, r1; \
+ mov.l .Lstr, r4; \
+ mova .Lgot, r0; \
+ mov.l .Lgot, r12; \
+ add r0, r12; \
+ bsrf r1; \
+ add r12, r4; \
+.Lfail0: \
+ bra 0f; \
+ nop; \
+ .align 2; \
+.Lgot: \
+ .long _GLOBAL_OFFSET_TABLE_; \
+.Lstr: \
+ .long longjmp_msg@GOTOFF; \
+.Lfail: \
+ .long __GI___fortify_fail@PLT-(.Lfail0-.); \
+0:
+#else
+# define CALL_FAIL \
+ mov.l .Lfail, r1; \
+ mov.l .Lstr, r4; \
+ jsr @r1; \
+ nop; \
+ bra 0f; \
+ nop; \
+ .align 2; \
+.Lstr: \
+ .long longjmp_msg; \
+.Lfail: \
+ .long __fortify_fail; \
+0:
+#endif
+
+#define CHECK_SP(reg) \
+ cmp/hs r15, reg; \
+ bt .Lok; \
+ CALL_FAIL \
+.Lok:
+
+#include <__longjmp.S>
Modified: fsf/trunk/libc/sysdeps/sh/sh3/__longjmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sh/sh3/__longjmp.S (original)
+++ fsf/trunk/libc/sysdeps/sh/sh3/__longjmp.S Tue May 19 00:06:31 2009
@@ -1,5 +1,5 @@
/* longjmp for SH.
- Copyright (C) 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005, 2006, 2009 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
@@ -42,6 +42,9 @@
mov r2, r14
mov.l @r4+, r2
PTR_DEMANGLE2 (r2, r1)
+# ifdef CHECK_SP
+ CHECK_SP (r2)
+# endif
mov r2, r15
mov.l @r4+, r2
PTR_DEMANGLE2 (r2, r1)
@@ -49,6 +52,10 @@
mov #0, r1
#else
mov.l @r4+, r14
+# ifdef CHECK_SP
+ mov.l @r4, r2
+ CHECK_SP (r2)
+# endif
mov.l @r4+, r15
lds.l @r4+, pr
#endif
Modified: fsf/trunk/libc/sysdeps/sh/sh4/__longjmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sh/sh4/__longjmp.S (original)
+++ fsf/trunk/libc/sysdeps/sh/sh4/__longjmp.S Tue May 19 00:06:31 2009
@@ -42,6 +42,9 @@
mov r2, r14
mov.l @r4+, r2
PTR_DEMANGLE2 (r2, r1)
+# ifdef CHECK_SP
+ CHECK_SP (r2)
+# endif
mov r2, r15
mov.l @r4+, r2
PTR_DEMANGLE2 (r2, r1)
@@ -49,6 +52,10 @@
mov #0, r1
#else
mov.l @r4+, r14
+# ifdef CHECK_SP
+ mov.l @r4, r2
+ CHECK_SP (r2)
+# endif
mov.l @r4+, r15
lds.l @r4+, pr
#endif