From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R1oRN-00076e-DB for garchives@archives.gentoo.org; Thu, 08 Sep 2011 23:55:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29BF421C174; Thu, 8 Sep 2011 23:55:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D677721C172 for ; Thu, 8 Sep 2011 23:55:06 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6EEF11B4020 for ; Thu, 8 Sep 2011 23:55:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id BBEDA8004A for ; Thu, 8 Sep 2011 23:55:05 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <5e1ed43892b658d2a022f50d55510343c3a8bb44.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:paxmark-libs commit in: / X-VCS-Repository: proj/elfix X-VCS-Files: Makefile.am libmypax.c testdlpax.c X-VCS-Directories: / X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 5e1ed43892b658d2a022f50d55510343c3a8bb44 Date: Thu, 8 Sep 2011 23:55:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 589d7956cbcf13d9ac11fffda167f7d1 commit: 5e1ed43892b658d2a022f50d55510343c3a8bb44 Author: Anthony G. Basile gentoo org> AuthorDate: Mon Sep 5 22:17:15 2011 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Mon Sep 5 22:17:15 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/elfix.git;a=3D= commit;h=3D5e1ed438 testdlpax.c: add dlopen test --- Makefile.am | 43 ++++++++++++++++++++++++++++++++++++++++++- libmypax.c | 2 -- testdlpax.c | 17 +++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d4f46c8..9edea4e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,11 @@ ACLOCAL_AMFLAGS =3D -I m4 +AM_CPPFLAGS =3D -DPLUGIN=3D'"$(libdir)/libmypax.so"' =20 -bin_PROGRAMS =3D testpax +bin_PROGRAMS =3D testpax testdlpax testpax_SOURCES =3D testpax.c testpax_LDFLAGS =3D -lmypax +testdlpax_SOURCES =3D testdlpax.c +testdlpax_LDFLAGS =3D -ldl =20 lib_LTLIBRARIES =3D libmypax.la libmypax_la_SOURCES =3D libmypax.c @@ -12,6 +15,7 @@ check_SCRIPTS =3D poc.sh poc.sh: @/sbin/ldconfig @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D" + @echo "=3D TESTING DYNAMIC LINKING =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" @echo @/sbin/paxctl -z $(libdir)/libmypax.so $(bindir)/testpax @/sbin/paxctl -M $(libdir)/libmypax.so @@ -49,4 +53,41 @@ poc.sh: @echo @echo @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D" + @echo "=3D TESTING DLOPENING =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" + @echo + @/sbin/paxctl -z $(libdir)/libmypax.so $(bindir)/testdlpax + @/sbin/paxctl -M $(libdir)/libmypax.so + @/sbin/paxctl -M $(bindir)/testdlpax + @/sbin/paxctl -Qv $(libdir)/libmypax.so $(bindir)/testdlpax 2>/dev/null + @echo + $(bindir)/testdlpax + @echo + @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" + @echo + @/sbin/paxctl -z $(libdir)/libmypax.so $(bindir)/testdlpax + @/sbin/paxctl -m $(libdir)/libmypax.so + @/sbin/paxctl -M $(bindir)/testdlpax + @/sbin/paxctl -Qv $(libdir)/libmypax.so $(bindir)/testdlpax 2>/dev/null + @echo + $(bindir)/testdlpax + @echo + @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" + @echo + @/sbin/paxctl -z $(libdir)/libmypax.so $(bindir)/testdlpax + @/sbin/paxctl -M $(libdir)/libmypax.so + @/sbin/paxctl -m $(bindir)/testdlpax + @/sbin/paxctl -Qv $(libdir)/libmypax.so $(bindir)/testdlpax 2>/dev/null + @echo + $(bindir)/testdlpax + @echo + @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" + @echo + @/sbin/paxctl -z $(libdir)/libmypax.so $(bindir)/testdlpax + @/sbin/paxctl -m $(libdir)/libmypax.so + @/sbin/paxctl -m $(bindir)/testdlpax + @/sbin/paxctl -Qv $(libdir)/libmypax.so $(bindir)/testdlpax 2>/dev/null + @echo + $(bindir)/testdlpax + @echo + @echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D" =20 diff --git a/libmypax.c b/libmypax.c index ab5b0f7..cdb0ff4 100644 --- a/libmypax.c +++ b/libmypax.c @@ -1,5 +1,3 @@ -#include -#include #include #include #include diff --git a/testdlpax.c b/testdlpax.c new file mode 100644 index 0000000..fde3245 --- /dev/null +++ b/testdlpax.c @@ -0,0 +1,17 @@ +#include + +#ifndef PLUGIN +#define PLUGIN "/usr/local/lib/libmypax.so" +#endif + +int +main() { + void *handle; + void (*doit)(); + + handle =3D dlopen(PLUGIN, RTLD_LAZY); + doit =3D dlsym(handle, "doit"); + (*doit)(); + dlclose(handle); + return 0; +}