|
|
147e83 |
commit a1b85ae88b1a664e93ca0182c82f7763dd5a1754
|
|
|
147e83 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
147e83 |
Date: Mon Nov 9 16:52:31 2015 +0100
|
|
|
147e83 |
|
|
|
147e83 |
ld.so: Add original DSO name if overridden by audit module [BZ #18251]
|
|
|
147e83 |
|
|
|
147e83 |
Index: b/elf/Makefile
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- a/elf/Makefile
|
|
|
147e83 |
+++ b/elf/Makefile
|
|
|
147e83 |
@@ -119,7 +119,8 @@ $(inst_auditdir)/sotruss-lib.so: $(objpf
|
|
|
147e83 |
endif
|
|
|
147e83 |
|
|
|
147e83 |
tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
|
|
|
147e83 |
- tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
|
|
|
147e83 |
+ tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
|
|
|
147e83 |
+ tst-audit11 tst-audit12
|
|
|
147e83 |
tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
|
|
|
147e83 |
tst-leaks1-static tst-array1-static tst-array5-static \
|
|
|
147e83 |
tst-ptrguard1-static
|
|
|
147e83 |
@@ -216,7 +217,9 @@ modules-names = testobj1 testobj2 testob
|
|
|
147e83 |
tst-initorder2a tst-initorder2b tst-initorder2c \
|
|
|
147e83 |
tst-initorder2d \
|
|
|
147e83 |
tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
|
|
|
147e83 |
- tst-array5dep
|
|
|
147e83 |
+ tst-array5dep \
|
|
|
147e83 |
+ tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
|
|
|
147e83 |
+ tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12
|
|
|
147e83 |
ifeq (yesyes,$(have-fpie)$(build-shared))
|
|
|
147e83 |
modules-names += tst-piemod1
|
|
|
147e83 |
tests += tst-pie1
|
|
|
147e83 |
@@ -1210,3 +1213,15 @@ $(objpfx)tst-unused-dep.out: $(objpfx)te
|
|
|
147e83 |
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
|
|
|
147e83 |
$< > $@
|
|
|
147e83 |
cmp $@ /dev/null > /dev/null
|
|
|
147e83 |
+
|
|
|
147e83 |
+$(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
|
|
|
147e83 |
+$(objpfx)tst-audit11: $(libdl)
|
|
|
147e83 |
+tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
|
|
|
147e83 |
+$(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
|
|
|
147e83 |
+LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
|
|
|
147e83 |
+
|
|
|
147e83 |
+$(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
|
|
|
147e83 |
+$(objpfx)tst-audit12: $(libdl)
|
|
|
147e83 |
+tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
|
|
|
147e83 |
+$(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
|
|
|
147e83 |
+LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
|
|
|
147e83 |
Index: b/elf/dl-load.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- a/elf/dl-load.c
|
|
|
147e83 |
+++ b/elf/dl-load.c
|
|
|
147e83 |
@@ -909,9 +909,10 @@ lose (int code, int fd, const char *name
|
|
|
147e83 |
static
|
|
|
147e83 |
#endif
|
|
|
147e83 |
struct link_map *
|
|
|
147e83 |
-_dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
|
|
147e83 |
- char *realname, struct link_map *loader, int l_type,
|
|
|
147e83 |
- int mode, void **stack_endp, Lmid_t nsid)
|
|
|
147e83 |
+_dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
|
|
147e83 |
+ struct filebuf *fbp, char *realname,
|
|
|
147e83 |
+ struct link_map *loader, int l_type, int mode,
|
|
|
147e83 |
+ void **stack_endp, Lmid_t nsid)
|
|
|
147e83 |
{
|
|
|
147e83 |
struct link_map *l = NULL;
|
|
|
147e83 |
const ElfW(Ehdr) *header;
|
|
|
147e83 |
@@ -1582,6 +1583,17 @@ cannot enable executable stack as shared
|
|
|
147e83 |
l->l_dev = st.st_dev;
|
|
|
147e83 |
l->l_ino = st.st_ino;
|
|
|
147e83 |
|
|
|
147e83 |
+#ifdef SHARED
|
|
|
147e83 |
+ /* When auditing is used the recorded names might not include the
|
|
|
147e83 |
+ name by which the DSO is actually known. Add that as well. */
|
|
|
147e83 |
+ if (__glibc_unlikely (origname != NULL))
|
|
|
147e83 |
+ add_name_to_object (l, origname);
|
|
|
147e83 |
+#else
|
|
|
147e83 |
+ /* Audit modules only exist when linking is dynamic so ORIGNAME
|
|
|
147e83 |
+ cannot be non-NULL. */
|
|
|
147e83 |
+ assert (origname == NULL);
|
|
|
147e83 |
+#endif
|
|
|
147e83 |
+
|
|
|
147e83 |
/* When we profile the SONAME might be needed for something else but
|
|
|
147e83 |
loading. Add it right away. */
|
|
|
147e83 |
if (__builtin_expect (GLRO(dl_profile) != NULL, 0)
|
|
|
147e83 |
@@ -2081,6 +2093,7 @@ _dl_map_object (struct link_map *loader,
|
|
|
147e83 |
int type, int trace_mode, int mode, Lmid_t nsid)
|
|
|
147e83 |
{
|
|
|
147e83 |
int fd;
|
|
|
147e83 |
+ const char *origname = NULL;
|
|
|
147e83 |
char *realname;
|
|
|
147e83 |
char *name_copy;
|
|
|
147e83 |
struct link_map *l;
|
|
|
147e83 |
@@ -2144,6 +2157,7 @@ _dl_map_object (struct link_map *loader,
|
|
|
147e83 |
{
|
|
|
147e83 |
if (afct->objsearch != NULL)
|
|
|
147e83 |
{
|
|
|
147e83 |
+ const char *before = name;
|
|
|
147e83 |
name = afct->objsearch (name, &loader->l_audit[cnt].cookie,
|
|
|
147e83 |
LA_SER_ORIG);
|
|
|
147e83 |
if (name == NULL)
|
|
|
147e83 |
@@ -2152,6 +2166,15 @@ _dl_map_object (struct link_map *loader,
|
|
|
147e83 |
fd = -1;
|
|
|
147e83 |
goto no_file;
|
|
|
147e83 |
}
|
|
|
147e83 |
+ if (before != name && strcmp (before, name) != 0)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
|
|
|
147e83 |
+ _dl_debug_printf ("audit changed filename %s -> %s\n",
|
|
|
147e83 |
+ before, name);
|
|
|
147e83 |
+
|
|
|
147e83 |
+ if (origname == NULL)
|
|
|
147e83 |
+ origname = before;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
afct = afct->next;
|
|
|
147e83 |
@@ -2371,8 +2394,8 @@ _dl_map_object (struct link_map *loader,
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
void *stack_end = __libc_stack_end;
|
|
|
147e83 |
- return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode,
|
|
|
147e83 |
- &stack_end, nsid);
|
|
|
147e83 |
+ return _dl_map_object_from_fd (name, origname, fd, &fb, realname, loader,
|
|
|
147e83 |
+ type, mode, &stack_end, nsid);
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
|
|
|
147e83 |
Index: b/elf/tst-audit11.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit11.c
|
|
|
147e83 |
@@ -0,0 +1,36 @@
|
|
|
147e83 |
+/* Test version symbol binding can find a DSO replaced by la_objsearch.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#include <dlfcn.h>
|
|
|
147e83 |
+#include <stdio.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+int
|
|
|
147e83 |
+do_test (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ puts ("Start");
|
|
|
147e83 |
+ if (dlopen ("$ORIGIN/tst-audit11mod1.so", RTLD_LAZY) == NULL)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ printf ("module not loaded: %s\n", dlerror ());
|
|
|
147e83 |
+ return 1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ puts ("OK");
|
|
|
147e83 |
+ return 0;
|
|
|
147e83 |
+}
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define TEST_FUNCTION do_test ()
|
|
|
147e83 |
+#include "../test-skeleton.c"
|
|
|
147e83 |
Index: b/elf/tst-audit11mod1.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit11mod1.c
|
|
|
147e83 |
@@ -0,0 +1,24 @@
|
|
|
147e83 |
+/* DSO directly opened by tst-audit11.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+extern int f2 (void);
|
|
|
147e83 |
+int
|
|
|
147e83 |
+f1 (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return f2 ();
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-audit11mod2.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit11mod2.c
|
|
|
147e83 |
@@ -0,0 +1,23 @@
|
|
|
147e83 |
+/* DSO indirectly opened by tst-audit11, with symbol versioning.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+int
|
|
|
147e83 |
+f2 (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return 42;
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-audit11mod2.map
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit11mod2.map
|
|
|
147e83 |
@@ -0,0 +1,22 @@
|
|
|
147e83 |
+/* Symbol versioning for the DSO indirectly opened by tst-audit11.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+V1 {
|
|
|
147e83 |
+ global: f2;
|
|
|
147e83 |
+ local: *;
|
|
|
147e83 |
+};
|
|
|
147e83 |
Index: b/elf/tst-audit12.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit12.c
|
|
|
147e83 |
@@ -0,0 +1,49 @@
|
|
|
147e83 |
+/* Test that symbol is bound to a DSO replaced by la_objsearch.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#include <dlfcn.h>
|
|
|
147e83 |
+#include <stdio.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+int
|
|
|
147e83 |
+do_test (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ puts ("Start");
|
|
|
147e83 |
+ void *h = dlopen ("$ORIGIN/tst-audit12mod1.so", RTLD_LAZY);
|
|
|
147e83 |
+ if (h == NULL)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ printf ("module not loaded: %s\n", dlerror ());
|
|
|
147e83 |
+ return 1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ int (*fp) (void) = (int (*) (void)) dlsym (h, "f1");
|
|
|
147e83 |
+ if (fp == NULL)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ printf ("function f1 not found: %s\n", dlerror ());
|
|
|
147e83 |
+ return 1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ int res = fp ();
|
|
|
147e83 |
+ if (res != 43)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ puts ("incorrect function f2 called");
|
|
|
147e83 |
+ return 1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ printf ("%d is OK\n", res);
|
|
|
147e83 |
+ return 0;
|
|
|
147e83 |
+}
|
|
|
147e83 |
+
|
|
|
147e83 |
+#define TEST_FUNCTION do_test ()
|
|
|
147e83 |
+#include "../test-skeleton.c"
|
|
|
147e83 |
Index: b/elf/tst-audit12mod1.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit12mod1.c
|
|
|
147e83 |
@@ -0,0 +1,24 @@
|
|
|
147e83 |
+/* DSO directly opened by tst-audit12.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+extern int f2 (void);
|
|
|
147e83 |
+int
|
|
|
147e83 |
+f1 (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return f2 ();
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-audit12mod2.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit12mod2.c
|
|
|
147e83 |
@@ -0,0 +1,23 @@
|
|
|
147e83 |
+/* Replaced DSO referenced by tst-audit12mod1.so, for tst-audit12.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+int
|
|
|
147e83 |
+f2 (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return 42;
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-audit12mod2.map
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit12mod2.map
|
|
|
147e83 |
@@ -0,0 +1,22 @@
|
|
|
147e83 |
+/* Symbol versioning for tst-audit12mod2.so used by tst-audit12.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+V1 {
|
|
|
147e83 |
+ global: f2;
|
|
|
147e83 |
+ local: *;
|
|
|
147e83 |
+};
|
|
|
147e83 |
Index: b/elf/tst-audit12mod3.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-audit12mod3.c
|
|
|
147e83 |
@@ -0,0 +1,23 @@
|
|
|
147e83 |
+/* Replacement DSO loaded by the audit module, for tst-audit12.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+int
|
|
|
147e83 |
+f2 (void)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return 43;
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-auditmod11.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-auditmod11.c
|
|
|
147e83 |
@@ -0,0 +1,39 @@
|
|
|
147e83 |
+/* Audit module for tst-audit11.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#include <link.h>
|
|
|
147e83 |
+#include <stdio.h>
|
|
|
147e83 |
+#include <stdlib.h>
|
|
|
147e83 |
+#include <string.h>
|
|
|
147e83 |
+#include <unistd.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+unsigned int
|
|
|
147e83 |
+la_version (unsigned int version)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return version;
|
|
|
147e83 |
+}
|
|
|
147e83 |
+
|
|
|
147e83 |
+char *
|
|
|
147e83 |
+la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ if (strcmp (name, "tst-audit11mod2.so") == 0)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ return (char *) "$ORIGIN/tst-audit11mod2.so";
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ return (char *) name;
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/elf/tst-auditmod12.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- /dev/null
|
|
|
147e83 |
+++ b/elf/tst-auditmod12.c
|
|
|
147e83 |
@@ -0,0 +1,43 @@
|
|
|
147e83 |
+/* Audit module for tst-audit12.
|
|
|
147e83 |
+ Copyright (C) 2015 Free Software Foundation, Inc.
|
|
|
147e83 |
+ This file is part of the GNU C Library.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
147e83 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
147e83 |
+ License as published by the Free Software Foundation; either
|
|
|
147e83 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
147e83 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
147e83 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
147e83 |
+ Lesser General Public License for more details.
|
|
|
147e83 |
+
|
|
|
147e83 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
147e83 |
+ License along with the GNU C Library; if not, see
|
|
|
147e83 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+#include <link.h>
|
|
|
147e83 |
+#include <stdio.h>
|
|
|
147e83 |
+#include <stdlib.h>
|
|
|
147e83 |
+#include <string.h>
|
|
|
147e83 |
+#include <unistd.h>
|
|
|
147e83 |
+
|
|
|
147e83 |
+unsigned int
|
|
|
147e83 |
+la_version (unsigned int version)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ return version;
|
|
|
147e83 |
+}
|
|
|
147e83 |
+
|
|
|
147e83 |
+char *
|
|
|
147e83 |
+la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
|
|
|
147e83 |
+{
|
|
|
147e83 |
+ const char target[] = "tst-audit12mod2.so";
|
|
|
147e83 |
+
|
|
|
147e83 |
+ size_t namelen = strlen (name);
|
|
|
147e83 |
+ if (namelen >= sizeof (target) - 1
|
|
|
147e83 |
+ && strcmp (name + namelen - (sizeof (target) - 1), target) == 0)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ return (char *) "$ORIGIN/tst-audit12mod3.so";
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ return (char *) name;
|
|
|
147e83 |
+}
|
|
|
147e83 |
Index: b/sysdeps/mach/hurd/dl-sysdep.c
|
|
|
147e83 |
===================================================================
|
|
|
147e83 |
--- a/sysdeps/mach/hurd/dl-sysdep.c
|
|
|
147e83 |
+++ b/sysdeps/mach/hurd/dl-sysdep.c
|
|
|
147e83 |
@@ -187,7 +187,7 @@ unfmh(); /* XXX */
|
|
|
147e83 |
assert_perror (err);
|
|
|
147e83 |
|
|
|
147e83 |
lastslash = strrchr (p, '/');
|
|
|
147e83 |
- l = _dl_map_object_from_fd (lastslash ? lastslash + 1 : p,
|
|
|
147e83 |
+ l = _dl_map_object_from_fd (lastslash ? lastslash + 1 : p, NULL,
|
|
|
147e83 |
memobj, strdup (p), 0);
|
|
|
147e83 |
|
|
|
147e83 |
/* Squirrel away the memory object port where it
|