Remove obsolete patches
This commit is contained in:
parent
a0c4aeb2e1
commit
d2f39ec9ec
@ -1,315 +0,0 @@
|
||||
commit 815e6fa3e010628f77838abec18692cbfeb60809
|
||||
Author: Gary Benson <gbenson@redhat.com>
|
||||
Date: Thu Jul 26 11:03:35 2012 +0100
|
||||
|
||||
Add SystemTap static probes to the runtime linker. [BZ #14298]
|
||||
|
||||
2012-07-27 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
[BZ #14298]
|
||||
* elf/rtld.c: Include <stap-probe.h>.
|
||||
(dl_main): Added static probes "init_start" and "init_complete".
|
||||
* elf/dl-load.c: Include <stap-probe.h>.
|
||||
(lose): Take new parameter "nsid".
|
||||
Added static probe "map_failed".
|
||||
(_dl_map_object_from_fd): Pass namespace id to lose.
|
||||
Added static probe "map_start".
|
||||
(open_verify): Pass namespace id to lose.
|
||||
* elf/dl-open.c: Include <stap-probe.h>.
|
||||
(dl_open_worker) Added static probes "map_complete", "reloc_start"
|
||||
and "reloc_complete".
|
||||
* elf/dl-close.c: Include <stap-probe.h>.
|
||||
(_dl_close_worker): Added static probes "unmap_start" and
|
||||
"unmap_complete".
|
||||
* elf/rtld-debugger-interface.txt: New file documenting the above.
|
||||
|
||||
diff --git a/elf/dl-close.c b/elf/dl-close.c
|
||||
index a250ea5..45b2187 100644
|
||||
--- a/elf/dl-close.c
|
||||
+++ b/elf/dl-close.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
|
||||
/* Type of the constructor functions. */
|
||||
@@ -468,6 +469,7 @@ _dl_close_worker (struct link_map *map)
|
||||
struct r_debug *r = _dl_debug_initialize (0, nsid);
|
||||
r->r_state = RT_DELETE;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (unmap_start, 2, nsid, r);
|
||||
|
||||
if (unload_global)
|
||||
{
|
||||
@@ -737,6 +739,7 @@ _dl_close_worker (struct link_map *map)
|
||||
/* Notify the debugger those objects are finalized and gone. */
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (unmap_complete, 2, nsid, r);
|
||||
|
||||
/* Recheck if we need to retry, release the lock. */
|
||||
out:
|
||||
diff --git a/elf/dl-load.c b/elf/dl-load.c
|
||||
index fe83f87..43e1269 100644
|
||||
--- a/elf/dl-load.c
|
||||
+++ b/elf/dl-load.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stackinfo.h>
|
||||
#include <caller.h>
|
||||
#include <sysdep.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -882,7 +883,7 @@ _dl_init_paths (const char *llp)
|
||||
static void
|
||||
__attribute__ ((noreturn, noinline))
|
||||
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
|
||||
- const char *msg, struct r_debug *r)
|
||||
+ const char *msg, struct r_debug *r, Lmid_t nsid)
|
||||
{
|
||||
/* The file might already be closed. */
|
||||
if (fd != -1)
|
||||
@@ -896,6 +897,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
|
||||
{
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (map_failed, 2, nsid, r);
|
||||
}
|
||||
|
||||
_dl_signal_error (code, name, NULL, msg);
|
||||
@@ -934,7 +936,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
errval = errno;
|
||||
call_lose:
|
||||
lose (errval, fd, name, realname, l, errstring,
|
||||
- make_consistent ? r : NULL);
|
||||
+ make_consistent ? r : NULL, nsid);
|
||||
}
|
||||
|
||||
/* Look again to see if the real name matched another already loaded. */
|
||||
@@ -1041,6 +1043,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
linking has not been used before. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (map_start, 2, nsid, r);
|
||||
make_consistent = true;
|
||||
}
|
||||
else
|
||||
@@ -1736,7 +1739,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
|
||||
name = strdupa (realname);
|
||||
free (realname);
|
||||
}
|
||||
- lose (errval, fd, name, NULL, NULL, errstring, NULL);
|
||||
+ lose (errval, fd, name, NULL, NULL, errstring, NULL, 0);
|
||||
}
|
||||
|
||||
/* See whether the ELF header is what we expect. */
|
||||
diff --git a/elf/dl-open.c b/elf/dl-open.c
|
||||
index e2780a4..00781af 100644
|
||||
--- a/elf/dl-open.c
|
||||
+++ b/elf/dl-open.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <caller.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -291,6 +292,7 @@ dl_open_worker (void *a)
|
||||
struct r_debug *r = _dl_debug_initialize (0, args->nsid);
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (map_complete, 3, args->nsid, r, new);
|
||||
|
||||
/* Print scope information. */
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
|
||||
@@ -376,10 +378,19 @@ dl_open_worker (void *a)
|
||||
}
|
||||
}
|
||||
|
||||
+ int relocation_in_progress = 0;
|
||||
+
|
||||
for (size_t i = nmaps; i-- > 0; )
|
||||
{
|
||||
l = maps[i];
|
||||
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
+
|
||||
#ifdef SHARED
|
||||
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
{
|
||||
@@ -544,6 +555,10 @@ cannot load any more object with static TLS"));
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Notify the debugger all new objects have been relocated. */
|
||||
+ if (relocation_in_progress)
|
||||
+ LIBC_PROBE (reloc_complete, 3, args->nsid, r, new);
|
||||
+
|
||||
/* Run the initializer functions of new objects. */
|
||||
_dl_init (new, args->argc, args->argv, args->env);
|
||||
|
||||
diff --git a/elf/rtld-debugger-interface.txt b/elf/rtld-debugger-interface.txt
|
||||
new file mode 100644
|
||||
index 0000000..61bc99e
|
||||
--- /dev/null
|
||||
+++ b/elf/rtld-debugger-interface.txt
|
||||
@@ -0,0 +1,122 @@
|
||||
+Standard debugger interface
|
||||
+===========================
|
||||
+
|
||||
+The run-time linker exposes a rendezvous structure to allow debuggers
|
||||
+to interface with it. This structure, r_debug, is defined in link.h.
|
||||
+If the executable's dynamic section has a DT_DEBUG element, the
|
||||
+run-time linker sets that element's value to the address where this
|
||||
+structure can be found.
|
||||
+
|
||||
+The r_debug structure contains (amongst others) the following fields:
|
||||
+
|
||||
+ struct link_map *r_map:
|
||||
+ A linked list of loaded objects.
|
||||
+
|
||||
+ enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state:
|
||||
+ The current state of the r_map list. RT_CONSISTENT means that r_map
|
||||
+ is not currently being modified and may safely be inspected. RT_ADD
|
||||
+ means that an object is being added to r_map, and that the list is
|
||||
+ not guaranteed to be consistent. Likewise RT_DELETE means that an
|
||||
+ object is being removed from the list.
|
||||
+
|
||||
+ ElfW(Addr) r_brk:
|
||||
+ The address of a function internal to the run-time linker which is
|
||||
+ called whenever r_state is changed. The debugger should set a
|
||||
+ breakpoint at this address if it wants to notice mapping changes.
|
||||
+
|
||||
+This protocol is widely supported, but somewhat limited in that it
|
||||
+has no provision to provide access to multiple namespaces, and that
|
||||
+the notifications (via r_brk) only refer to changes to r_map--the
|
||||
+debugger is notified that a new object has been added, for instance,
|
||||
+but there is no way for the debugger to discover whether any of the
|
||||
+objects in the link-map have been relocated or not.
|
||||
+
|
||||
+
|
||||
+Probe-based debugger interface
|
||||
+==============================
|
||||
+
|
||||
+Systemtap is a dynamic tracing/instrumenting tool available on Linux.
|
||||
+Probes that are not fired at run time have close to zero overhead.
|
||||
+glibc contains a number of probes that debuggers can set breakpoints
|
||||
+on in order to notice certain events.
|
||||
+
|
||||
+All rtld probes have the following arguments:
|
||||
+
|
||||
+ arg1: Lmid_t lmid:
|
||||
+ The link-map ID of the link-map list that the object was loaded
|
||||
+ into. This will be LM_ID_BASE for the application's main link-map
|
||||
+ list, or some other value for different namespaces.
|
||||
+
|
||||
+ arg2: struct r_debug *r_debug:
|
||||
+ A pointer to the r_debug structure containing the link-map list
|
||||
+ that the object was loaded into. This will be the value stored in
|
||||
+ DT_DEBUG for the application's main link-map list, or some other
|
||||
+ value for different namespaces.
|
||||
+
|
||||
+map_complete and reloc_complete may have the following additional
|
||||
+argument:
|
||||
+
|
||||
+ arg3: struct link_map *new:
|
||||
+ A pointer which, if not NULL, points to the entry in the specified
|
||||
+ r_debug structure's link-map list corresponding to the first new
|
||||
+ object to have been mapped or relocated, with new->l_next pointing
|
||||
+ to the link-map of the next new object to have been mapped or
|
||||
+ relocated, and so on. Note that because `new' is an entry in a
|
||||
+ larger list, new->l_prev (if not NULL) will point to what was the
|
||||
+ last link-map in the link-map list prior to the new objects being
|
||||
+ mapped or relocated.
|
||||
+
|
||||
+The following probes are available:
|
||||
+
|
||||
+ init_start:
|
||||
+ This is called once, when the linker is about to fill in the main
|
||||
+ r_debug structure at application startup. init_start always has
|
||||
+ lmid set to LM_ID_BASE and r_debug set to the value stored in
|
||||
+ DT_DEBUG. r_debug is not guaranteed to be consistent until
|
||||
+ init_complete is fired.
|
||||
+
|
||||
+ init_complete:
|
||||
+ This is called once, when the linker has filled in the main
|
||||
+ r_debug structure at application startup. init_complete always
|
||||
+ has lmid set to LM_ID_BASE and r_debug set to the value stored
|
||||
+ in DT_DEBUG. The r_debug structure is consistent and may be
|
||||
+ inspected, and all objects in the link-map are guaranteed to
|
||||
+ have been relocated.
|
||||
+
|
||||
+ map_start:
|
||||
+ The linker is about to map new objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is not guaranteed
|
||||
+ to be consistent until a corresponding map_complete is fired.
|
||||
+
|
||||
+ map_complete:
|
||||
+ The linker has finished mapping new objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is consistent and
|
||||
+ may be inspected, although objects in the namespace's link-map
|
||||
+ are not guaranteed to have been relocated.
|
||||
+
|
||||
+ map_failed:
|
||||
+ The linker failed while attempting to map new objects into
|
||||
+ the specified namespace. The namespace's r_debug structure
|
||||
+ is consistent and may be inspected.
|
||||
+
|
||||
+ reloc_start:
|
||||
+ The linker is about to relocate all unrelocated objects in the
|
||||
+ specified namespace. The namespace's r_debug structure is not
|
||||
+ guaranteed to be consistent until a corresponding reloc_complete
|
||||
+ is fired.
|
||||
+
|
||||
+ reloc_complete:
|
||||
+ The linker has relocated all objects in the specified namespace.
|
||||
+ The namespace's r_debug structure is consistent and may be
|
||||
+ inspected, and all objects in the namespace's link-map are
|
||||
+ guaranteed to have been relocated.
|
||||
+
|
||||
+ unmap_start:
|
||||
+ The linker is about to remove objects from the specified
|
||||
+ namespace. The namespace's r_debug structure is not guaranteed to
|
||||
+ be consistent until a corresponding unmap_complete is fired.
|
||||
+
|
||||
+ unmap_complete:
|
||||
+ The linker has finished removing objects into the specified
|
||||
+ namespace. The namespace's r_debug structure is consistent and
|
||||
+ may be inspected.
|
||||
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||
index 6bcf224..06c4220 100644
|
||||
--- a/elf/rtld.c
|
||||
+++ b/elf/rtld.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <dl-osinfo.h>
|
||||
#include <dl-procinfo.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
#include <stackinfo.h>
|
||||
|
||||
#include <assert.h>
|
||||
@@ -1683,6 +1684,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
/* We start adding objects. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
|
||||
|
||||
/* Auditing checkpoint: we are ready to signal that the initial map
|
||||
is being constructed. */
|
||||
@@ -2402,6 +2404,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
r = _dl_debug_initialize (0, LM_ID_BASE);
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
@ -1,12 +0,0 @@
|
||||
diff -rup a/manual/stdio.texi b/manual/stdio.texi
|
||||
--- a/manual/stdio.texi 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ b/manual/stdio.texi 2012-02-09 23:46:31.660912211 -0700
|
||||
@@ -2324,6 +2324,8 @@ the @var{size} argument specifies the ma
|
||||
produce. The trailing null character is counted towards this limit, so
|
||||
you should allocate at least @var{size} characters for the string @var{s}.
|
||||
|
||||
+The trailing null byte is added to @var{s}, unless @var{size} is zero.
|
||||
+
|
||||
The return value is the number of characters which would be generated
|
||||
for the given input, excluding the trailing null. If this value is
|
||||
greater or equal to @var{size}, not all characters from the result have
|
@ -1,19 +0,0 @@
|
||||
commit 8fa26d571d4b87a1c7a7f19f1365f7e5d2995933
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Wed Dec 21 18:57:18 2011 -0500
|
||||
|
||||
Fix one typo
|
||||
|
||||
diff --git a/time/tzfile.c b/time/tzfile.c
|
||||
index 402389c..a8c1c0e 100644
|
||||
--- a/time/tzfile.c
|
||||
+++ b/time/tzfile.c
|
||||
@@ -278,7 +278,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
||||
if (__builtin_expect (tzspec_len < num_isstd, 0))
|
||||
goto lose;
|
||||
tzspec_len -= num_isstd;
|
||||
- if (__builtin_expect (tzspec == 0 || tzspec_len - 1 < num_isgmt, 0))
|
||||
+ if (__builtin_expect (tzspec_len == 0 || tzspec_len - 1 < num_isgmt, 0))
|
||||
goto lose;
|
||||
tzspec_len -= num_isgmt + 1;
|
||||
if (__builtin_expect (SIZE_MAX - total_size < tzspec_len, 0))
|
@ -1,216 +0,0 @@
|
||||
2012-08-09 Jeff Law <law@redhat.com>
|
||||
|
||||
[BZ #13939]
|
||||
* malloc.c/arena.c (reused_arena): New parameter, avoid_arena.
|
||||
When avoid_arena is set, don't retry in the that arena. Pick the
|
||||
next one, whatever it might be.
|
||||
(arena_get2): New parameter avoid_arena, pass through to reused_arena.
|
||||
(arena_lock): Pass in new parameter to arena_get2.
|
||||
* malloc/malloc.c (__libc_memalign): Pass in new parameter to
|
||||
arena_get2.
|
||||
(__libc_malloc): Unify retrying after main arena failure with
|
||||
__libc_memalign version.
|
||||
(__libc_valloc, __libc_pvalloc, __libc_calloc): Likewise.
|
||||
|
||||
diff --git a/malloc/arena.c b/malloc/arena.c
|
||||
index 33c4ff3..7270bbe 100644
|
||||
--- a/malloc/arena.c
|
||||
+++ b/malloc/arena.c
|
||||
@@ -120,14 +120,14 @@ int __malloc_initialized = -1;
|
||||
if(ptr) \
|
||||
(void)mutex_lock(&ptr->mutex); \
|
||||
else \
|
||||
- ptr = arena_get2(ptr, (size)); \
|
||||
+ ptr = arena_get2(ptr, (size), NULL); \
|
||||
} while(0)
|
||||
#else
|
||||
# define arena_lock(ptr, size) do { \
|
||||
if(ptr && !mutex_trylock(&ptr->mutex)) { \
|
||||
THREAD_STAT(++(ptr->stat_lock_direct)); \
|
||||
} else \
|
||||
- ptr = arena_get2(ptr, (size)); \
|
||||
+ ptr = arena_get2(ptr, (size), NULL); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
@@ -778,9 +778,11 @@ get_free_list (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
-
|
||||
+/* Lock and return an arena that can be reused for memory allocation.
|
||||
+ Avoid AVOID_ARENA as we have already failed to allocate memory in
|
||||
+ it and it is currently locked. */
|
||||
static mstate
|
||||
-reused_arena (void)
|
||||
+reused_arena (mstate avoid_arena)
|
||||
{
|
||||
mstate result;
|
||||
static mstate next_to_use;
|
||||
@@ -797,6 +799,11 @@ reused_arena (void)
|
||||
}
|
||||
while (result != next_to_use);
|
||||
|
||||
+ /* Avoid AVOID_ARENA as we have already failed to allocate memory
|
||||
+ in that arena and it is currently locked. */
|
||||
+ if (result == avoid_arena)
|
||||
+ result = result->next;
|
||||
+
|
||||
/* No arena available. Wait for the next in line. */
|
||||
(void)mutex_lock(&result->mutex);
|
||||
|
||||
@@ -811,7 +818,7 @@ reused_arena (void)
|
||||
|
||||
static mstate
|
||||
internal_function
|
||||
-arena_get2(mstate a_tsd, size_t size)
|
||||
+arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
|
||||
{
|
||||
mstate a;
|
||||
|
||||
@@ -856,7 +863,7 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
catomic_decrement (&narenas);
|
||||
}
|
||||
else
|
||||
- a = reused_arena ();
|
||||
+ a = reused_arena (avoid_arena);
|
||||
}
|
||||
#else
|
||||
if(!a_tsd)
|
||||
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||
index 28039b4..1e4f929 100644
|
||||
--- a/malloc/malloc.c
|
||||
+++ b/malloc/malloc.c
|
||||
@@ -2865,9 +2865,11 @@ __libc_malloc(size_t bytes)
|
||||
victim = _int_malloc(ar_ptr, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
} else {
|
||||
- /* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
|
||||
- (void)mutex_unlock(&main_arena.mutex);
|
||||
+ /* ... or sbrk() has failed and there is still a chance to mmap()
|
||||
+ Grab ar_ptr->next prior to releasing its lock. */
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes, ar_ptr);
|
||||
if(ar_ptr) {
|
||||
victim = _int_malloc(ar_ptr, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3043,10 +3045,11 @@ __libc_memalign(size_t alignment, size_t bytes)
|
||||
p = _int_memalign(ar_ptr, alignment, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
} else {
|
||||
- /* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
+ /* ... or sbrk() has failed and there is still a chance to mmap()
|
||||
+ Grab ar_ptr->next prior to releasing its lock. */
|
||||
mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
- ar_ptr = arena_get2(prev, bytes);
|
||||
+ ar_ptr = arena_get2(prev, bytes, ar_ptr);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, alignment, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3083,23 +3086,27 @@ __libc_valloc(size_t bytes)
|
||||
if(!ar_ptr)
|
||||
return 0;
|
||||
p = _int_valloc(ar_ptr, bytes);
|
||||
- (void)mutex_unlock(&ar_ptr->mutex);
|
||||
if(!p) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
ar_ptr = &main_arena;
|
||||
(void)mutex_lock(&ar_ptr->mutex);
|
||||
p = _int_memalign(ar_ptr, pagesz, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
} else {
|
||||
- /* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
|
||||
+ /* ... or sbrk() has failed and there is still a chance to mmap()
|
||||
+ Grab ar_ptr->next prior to releasing its lock. */
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes, ar_ptr);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
}
|
||||
}
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock (&ar_ptr->mutex);
|
||||
assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
|
||||
ar_ptr == arena_for_chunk(mem2chunk(p)));
|
||||
|
||||
@@ -3127,24 +3134,27 @@ __libc_pvalloc(size_t bytes)
|
||||
|
||||
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
|
||||
p = _int_pvalloc(ar_ptr, bytes);
|
||||
- (void)mutex_unlock(&ar_ptr->mutex);
|
||||
if(!p) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
ar_ptr = &main_arena;
|
||||
(void)mutex_lock(&ar_ptr->mutex);
|
||||
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
} else {
|
||||
- /* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0,
|
||||
- bytes + 2*pagesz + MINSIZE);
|
||||
+ /* ... or sbrk() has failed and there is still a chance to mmap()
|
||||
+ Grab ar_ptr->next prior to releasing its lock. */
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE, ar_ptr);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
}
|
||||
}
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
|
||||
ar_ptr == arena_for_chunk(mem2chunk(p)));
|
||||
|
||||
@@ -3209,8 +3219,6 @@ __libc_calloc(size_t n, size_t elem_size)
|
||||
#endif
|
||||
mem = _int_malloc(av, sz);
|
||||
|
||||
- /* Only clearing follows, so we can unlock early. */
|
||||
- (void)mutex_unlock(&av->mutex);
|
||||
|
||||
assert(!mem || chunk_is_mmapped(mem2chunk(mem)) ||
|
||||
av == arena_for_chunk(mem2chunk(mem)));
|
||||
@@ -3218,21 +3226,24 @@ __libc_calloc(size_t n, size_t elem_size)
|
||||
if (mem == 0) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(av != &main_arena) {
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
mem = _int_malloc(&main_arena, sz);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
} else {
|
||||
- /* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- (void)mutex_lock(&main_arena.mutex);
|
||||
- av = arena_get2(av->next ? av : 0, sz);
|
||||
- (void)mutex_unlock(&main_arena.mutex);
|
||||
+ /* ... or sbrk() has failed and there is still a chance to mmap()
|
||||
+ Grab av->next prior to releasing its lock. */
|
||||
+ mstate prev = av->next ? av : 0;
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
+ av = arena_get2(prev, sz, av);
|
||||
if(av) {
|
||||
mem = _int_malloc(av, sz);
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
}
|
||||
}
|
||||
if (mem == 0) return 0;
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
p = mem2chunk(mem);
|
||||
|
||||
/* Two optional cases in which clearing not necessary */
|
@ -1,14 +0,0 @@
|
||||
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
|
||||
index 25a9be0..6f758eb 100644
|
||||
--- a/iconvdata/ibm930.c
|
||||
+++ b/iconvdata/ibm930.c
|
||||
@@ -162,7 +162,8 @@ enum
|
||||
while (ch > rp2->end) \
|
||||
++rp2; \
|
||||
\
|
||||
- if (__builtin_expect (ch < rp2->start, 0) \
|
||||
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
|
||||
+ || __builtin_expect (ch < rp2->start, 0) \
|
||||
|| (res = __ibm930db_to_ucs4[ch + rp2->idx], \
|
||||
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
|
||||
{ \
|
@ -1,110 +0,0 @@
|
||||
commit 7e66ee5142deda977163d0a858c3d2883cae3f07
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue Jul 24 13:45:59 2012 +0200
|
||||
|
||||
* posix/unistd.h (setuid, setreuid, seteuid, setresuid):
|
||||
Declare with warn_unused_result.
|
||||
(setgid, setregid, setegid, setresgid): Likewise.
|
||||
* sysdeps/unix/sysv/linux/sys/fsuid.h (setfsuid, setfsgid):
|
||||
Likewise.
|
||||
* WUR-REPORT: Remove set*id functions.
|
||||
|
||||
diff --git a/WUR-REPORT b/WUR-REPORT
|
||||
index ef407cf..d997bd0 100644
|
||||
--- a/WUR-REPORT
|
||||
+++ b/WUR-REPORT
|
||||
@@ -4,17 +4,6 @@ lssek: Probably should be __wur but lseek(fd,SEEK_SET,0) will succeed if
|
||||
the descriptor is fine.
|
||||
lseek64: same
|
||||
|
||||
-setuid: will always succeed given correct privileges, so there might
|
||||
- be places which don't check for it.
|
||||
-setreuid: same
|
||||
-seteuid: same
|
||||
-setgid: same
|
||||
-setregid: same
|
||||
-setegid: same
|
||||
-setresuid: same
|
||||
-setresgid: same
|
||||
-
|
||||
-
|
||||
<stdio.h>:
|
||||
|
||||
setvbuf: if stream and buffer are fine and other parameters constant,
|
||||
diff --git a/posix/unistd.h b/posix/unistd.h
|
||||
index 9839761..88d711a 100644
|
||||
--- a/posix/unistd.h
|
||||
+++ b/posix/unistd.h
|
||||
@@ -719,34 +719,34 @@ extern int group_member (__gid_t __gid) __THROW;
|
||||
If the calling process is the super-user, set the real
|
||||
and effective user IDs, and the saved set-user-ID to UID;
|
||||
if not, the effective user ID is set to UID. */
|
||||
-extern int setuid (__uid_t __uid) __THROW;
|
||||
+extern int setuid (__uid_t __uid) __THROW __wur;
|
||||
|
||||
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
|
||||
/* Set the real user ID of the calling process to RUID,
|
||||
and the effective user ID of the calling process to EUID. */
|
||||
-extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
|
||||
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
|
||||
#endif
|
||||
|
||||
#if defined __USE_BSD || defined __USE_XOPEN2K
|
||||
/* Set the effective user ID of the calling process to UID. */
|
||||
-extern int seteuid (__uid_t __uid) __THROW;
|
||||
+extern int seteuid (__uid_t __uid) __THROW __wur;
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Set the group ID of the calling process to GID.
|
||||
If the calling process is the super-user, set the real
|
||||
and effective group IDs, and the saved set-group-ID to GID;
|
||||
if not, the effective group ID is set to GID. */
|
||||
-extern int setgid (__gid_t __gid) __THROW;
|
||||
+extern int setgid (__gid_t __gid) __THROW __wur;
|
||||
|
||||
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
|
||||
/* Set the real group ID of the calling process to RGID,
|
||||
and the effective group ID of the calling process to EGID. */
|
||||
-extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
|
||||
+extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
|
||||
#endif
|
||||
|
||||
#if defined __USE_BSD || defined __USE_XOPEN2K
|
||||
/* Set the effective group ID of the calling process to GID. */
|
||||
-extern int setegid (__gid_t __gid) __THROW;
|
||||
+extern int setegid (__gid_t __gid) __THROW __wur;
|
||||
#endif /* Use BSD. */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
@@ -763,12 +763,12 @@ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
|
||||
/* Set the real user ID, effective user ID, and saved-set user ID,
|
||||
of the calling process to RUID, EUID, and SUID, respectively. */
|
||||
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
|
||||
- __THROW;
|
||||
+ __THROW __wur;
|
||||
|
||||
/* Set the real group ID, effective group ID, and saved-set group ID,
|
||||
of the calling process to RGID, EGID, and SGID, respectively. */
|
||||
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
|
||||
- __THROW;
|
||||
+ __THROW __wur;
|
||||
#endif
|
||||
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/sys/fsuid.h b/sysdeps/unix/sysv/linux/sys/fsuid.h
|
||||
index 2fd512e..4494baf 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sys/fsuid.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sys/fsuid.h
|
||||
@@ -25,10 +25,10 @@ __BEGIN_DECLS
|
||||
|
||||
/* Change uid used for file access control to UID, without affecting
|
||||
other privileges (such as who can send signals at the process). */
|
||||
-extern int setfsuid (__uid_t __uid) __THROW;
|
||||
+extern int setfsuid (__uid_t __uid) __THROW __wur;
|
||||
|
||||
/* Ditto for group id. */
|
||||
-extern int setfsgid (__gid_t __gid) __THROW;
|
||||
+extern int setfsgid (__gid_t __gid) __THROW __wur;
|
||||
|
||||
__END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user