Skip to content

Commit

Permalink
Use O_CLOEXEC when loading ld.so cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Sep 5, 2011
1 parent b0fc1ff commit 554881e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-09-05 Ulrich Drepper <drepper@gmail.com>

[BZ #13068]
* elf/dl-misc.c (_dl_sysdep_read_whole_file): Use O_CLOEXEC.

2011-07-20 Liubov Dmitrieva <liubov.dmitrieva@intel.com>

* sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add
Expand Down
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Version 2.15

* The following bugs are resolved with this release:

9696, 12868, 12852, 12874, 12885, 12907, 12922, 12935, 13007, 13021, 13114,
13144
9696, 12868, 12852, 12874, 12885, 12907, 12922, 12935, 13007, 13021,
13068, 13114, 13144

* New program pldd to list loaded object of a process
Implemented by Ulrich Drepper.
Expand Down
10 changes: 7 additions & 3 deletions elf/dl-misc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Miscellaneous support functions for dynamic linker
Copyright (C) 1997-2004, 2006, 2009 Free Software Foundation, Inc.
Copyright (C) 1997-2004, 2006, 2009, 2011 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
Expand Down Expand Up @@ -44,7 +44,11 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
{
void *result = MAP_FAILED;
struct stat64 st;
int fd = __open (file, O_RDONLY);
int flags = O_RDONLY;
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
int fd = __open (file, flags);
if (fd >= 0)
{
if (__fxstat64 (_STAT_VER, fd, &st) >= 0)
Expand Down Expand Up @@ -350,7 +354,7 @@ _dl_higher_prime_number (unsigned long int n)
UINT32_C (536870909),
UINT32_C (1073741789),
UINT32_C (2147483647),
/* 4294967291L */
/* 4294967291L */
UINT32_C (2147483647) + UINT32_C (2147483644)
};

Expand Down

0 comments on commit 554881e

Please sign in to comment.