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