diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2014-07-30 17:17:25 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-07-30 17:17:25 -0400 |
commit | 774ce372e0a21e58541d34035ed15903b4b5b34a (patch) | |
tree | b9afd5764c222ffff052e7ce8b8e5e5ecf766fac | |
parent | Split misc/ into misc/ for production and poc/ for experimental stuff. (diff) | |
download | elfix-774ce372e0a21e58541d34035ed15903b4b5b34a.tar.gz elfix-774ce372e0a21e58541d34035ed15903b4b5b34a.tar.bz2 elfix-774ce372e0a21e58541d34035ed15903b4b5b34a.zip |
Refactor source tree: separate out fix-gnustack
21 files changed, 184 insertions, 69 deletions
@@ -25,7 +25,6 @@ stamp-h1 *.la *.lo # -fix-gnustack paxctl-ng bad-gnustack daemon* @@ -33,11 +32,11 @@ dummy revdepbin # scripts/build -misc/__pycache__ # -misc/change-interp/bash -misc/change-interp/change-interp -misc/elf-manipulate/clear-dt-path -misc/elf-manipulate/parse-elf -misc/elf-manipulate/print-sections -misc/elf-manipulate/remove-ptpax +misc/fix-gnustack/fix-gnustack +# +poc/change-interp/change-interp +poc/elf-manipulate/clear-dt-path +poc/elf-manipulate/parse-elf +poc/elf-manipulate/print-sections +poc/elf-manipulate/remove-ptpax @@ -5,3 +5,6 @@ autoheader && \ autoconf && \ libtoolize --copy && \ automake --add-missing --copy + +cd doc +./make.sh diff --git a/configure.ac b/configure.ac index 2b66eae..179eed5 100644 --- a/configure.ac +++ b/configure.ac @@ -17,8 +17,8 @@ # AC_PREREQ([2.68]) -AC_INIT([elfix], [0.8], [http://bugs.gentoo.org/]) -AC_CONFIG_SRCDIR([src/fix-gnustack.c]) +AC_INIT([elfix], [0.9], [http://bugs.gentoo.org/]) +AC_CONFIG_SRCDIR([src/paxctl-ng.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.12 foreign]) AM_SILENT_RULES([no]) @@ -150,7 +150,6 @@ AC_CONFIG_FILES([ scripts/Makefile doc/Makefile tests/Makefile - tests/gnustack/Makefile tests/pxtpax/Makefile tests/paxmodule/Makefile tests/revdeppaxtest/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index 836014b..4ce1847 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,11 +1,3 @@ ACLOCAL_AMFLAGS = -I m4 dist_man_MANS = paxctl-ng.1 revdep-pax.1 -if BUILD_ELF -dist_man_MANS += fix-gnustack.1 -endif - -# I don't know why I need this, but without it, I don't get fix-gnustack.1 distributed. -# This is since commit 414cfa1770a8cfc46308149deecf9c0eef60a5bb. It will be fixed once -# fix-gnustack is broken out. -EXTRA_DIST = fix-gnustack.1 diff --git a/doc/make.sh b/doc/make.sh index bf29d22..a330f17 100755 --- a/doc/make.sh +++ b/doc/make.sh @@ -17,31 +17,23 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -#Run this on developer side, and distribute troff -#in case the end user doesn't have pod2man +# This is run on the developer side with autogen.sh -rm -f fix-gnustack.1 +PKG=$(cat ../configure.ac | grep ^AC_INIT | sed -e 's/^.*(\[//' -e 's/\].*$//') +VERSION=$(cat ../configure.ac | grep ^AC_INIT | sed -e "s/^.*$PKG\], \[//" -e 's/\].*$//') pod2man \ --official \ --section="1" \ - --release="elfix 0.3" \ + --release="$PKG $VERSION" \ --center="Documentation for elfix" \ - --date="2011-04-14" \ - fix-gnustack.pod > fix-gnustack.1 - -pod2man \ - --official \ - --section="1" \ - --release="elfix 0.3" \ - --center="Documentation for elfix" \ - --date="2011-08-18" \ + --date=$(date +%Y-%m-%d) \ paxctl-ng.pod > paxctl-ng.1 pod2man \ --official \ --section="1" \ - --release="elfix 0.3" \ + --release="$PKG $VERSION" \ --center="Documentation for elfix" \ - --date="2011-10-19" \ + --date=$(date +%Y-%m-%d) \ revdep-pax.pod > revdep-pax.1 diff --git a/doc/paxctl-ng.1 b/doc/paxctl-ng.1 index 744184b..5cb923a 100644 --- a/doc/paxctl-ng.1 +++ b/doc/paxctl-ng.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PAXCTL-NG 1" -.TH PAXCTL-NG 1 "2011-08-18" "elfix 0.3" "Documentation for elfix" +.TH PAXCTL-NG 1 "2014-07-30" "elfix 0.9" "Documentation for elfix" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1 index 58568fa..ee7cfd5 100644 --- a/doc/revdep-pax.1 +++ b/doc/revdep-pax.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "REVDEP-PAX 1" -.TH REVDEP-PAX 1 "2011-10-19" "elfix 0.3" "Documentation for elfix" +.TH REVDEP-PAX 1 "2014-07-30" "elfix 0.9" "Documentation for elfix" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/misc/fix-gnustack/ChangeLog b/misc/fix-gnustack/ChangeLog new file mode 100644 index 0000000..7e6fc49 --- /dev/null +++ b/misc/fix-gnustack/ChangeLog @@ -0,0 +1,46 @@ +2014-07-30 + + * Seperate out fix-gnustack. See: https://bugs.gentoo.org/518524 + +2014-06-07 + + * Switch from error() to errx() make the code portable to musl (and BSD). + +2013-05-20 + + * Add check if ELF_C_RDWR_MMAP is declared in libelf.h. This distinguishes + elfutils from libelf. The former will not build on uclibc, but the later + does not provide ELF_C_RDWR_MMAP. + +2012-07-29 + + * remove unnecessary check for yasm in configure.ac + * make tests/gnustack machine independant by generating + native assembly using gcc + +2012-07-27 + + * switch from yasm to gcc for assembler for arches other than + x86 and amd64 + * opening an ELF_C_RDWR does not work for either libelf or + elfutils, so revert to ELF_C_RDWR_MMAP. This does, however, + break linking against libelf + +2012-07-24 + + * switch from ELF_C_RDWR_MMAP to ELF_C_RDWR to link again libelf + for uclibc systems + +2011-11-26 + + * fix-gnustack and paxctl-ng: fix exit code on success + +2011-04-14 + + * Initial release of fix-gnustack +----- + +Copyright (C) 2011-2014 Anthony G. Basile + +Copying and distribution of this file, with or without modification, are +permitted provided the copyright notice and this notice are preserved. diff --git a/misc/fix-gnustack/Makefile.am b/misc/fix-gnustack/Makefile.am new file mode 100644 index 0000000..821f549 --- /dev/null +++ b/misc/fix-gnustack/Makefile.am @@ -0,0 +1,6 @@ +ACLOCAL_AMFLAGS = -I m4 + +sbin_PROGRAMS = fix-gnustack +fix_gnustack_SOURCES = fix-gnustack.c + +SUBDIRS = doc tests diff --git a/misc/fix-gnustack/autogen.sh b/misc/fix-gnustack/autogen.sh new file mode 100755 index 0000000..0b7b16b --- /dev/null +++ b/misc/fix-gnustack/autogen.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +aclocal && \ +autoheader && \ +autoconf && \ +automake --add-missing --copy + +cd doc +./make.sh diff --git a/misc/fix-gnustack/configure.ac b/misc/fix-gnustack/configure.ac new file mode 100644 index 0000000..2f5a245 --- /dev/null +++ b/misc/fix-gnustack/configure.ac @@ -0,0 +1,58 @@ +# +# configure.ac: this file is part of the elfix package +# Copyright (C) 2011 Anthony G. Basile +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +AC_PREREQ([2.69]) +AC_INIT([fix-gnustack], [0.1], [http://bugs.gentoo.org/]) +AC_CONFIG_SRCDIR([fix-gnustack.c]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([1.12 foreign]) +AM_SILENT_RULES([no]) + +# Checks for programs. +AC_PROG_AWK +AC_PROG_CC +AC_PROG_SED + +# Checks for header files. +AC_CHECK_HEADERS( + [err.h fcntl.h gelf.h libgen.h stdlib.h string.h sys/stat.h sys/types.h unistd.h], + [], + [AC_MSG_ERROR(["Missing necessary header"])] +) + +# Checks for DECLs. +AC_CHECK_DECL([ELF_C_RDWR_MMAP],[],[],[[#include <libelf.h>]]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_CHECK_LIB( + [elf], + [elf_begin], + [], + [AC_MSG_ERROR(["Missing necessary function elf_begin in libelf"])] +) + +AC_CONFIG_FILES([ + Makefile + doc/Makefile + tests/Makefile +]) + +AC_OUTPUT diff --git a/misc/fix-gnustack/doc/Makefile.am b/misc/fix-gnustack/doc/Makefile.am new file mode 100644 index 0000000..b5f33f4 --- /dev/null +++ b/misc/fix-gnustack/doc/Makefile.am @@ -0,0 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 + +dist_man_MANS = fix-gnustack.1 diff --git a/doc/fix-gnustack.1 b/misc/fix-gnustack/doc/fix-gnustack.1 index 3ef26eb..06f720a 100644 --- a/doc/fix-gnustack.1 +++ b/misc/fix-gnustack/doc/fix-gnustack.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23) .\" .\" Standard preamble: .\" ======================================================================== @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "FIX-GNUSTACK 1" -.TH FIX-GNUSTACK 1 "2011-04-14" "elfix 0.3" "Documentation for elfix" +.TH FIX-GNUSTACK 1 "2014-07-30" "fix-gnustack 0.1" "Documentation for fix-gnustack" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/doc/fix-gnustack.pod b/misc/fix-gnustack/doc/fix-gnustack.pod index d94b8b4..d94b8b4 100644 --- a/doc/fix-gnustack.pod +++ b/misc/fix-gnustack/doc/fix-gnustack.pod diff --git a/misc/fix-gnustack/doc/make.sh b/misc/fix-gnustack/doc/make.sh new file mode 100755 index 0000000..f9ed65e --- /dev/null +++ b/misc/fix-gnustack/doc/make.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# make.sh: this file is part of the elfix package +# Copyright (C) 2011 Anthony G. Basile +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# This is run on the developer side with autogen.sh + +PKG=$(cat ../configure.ac | grep ^AC_INIT | sed -e 's/^.*(\[//' -e 's/\].*$//') +VERSION=$(cat ../configure.ac | grep ^AC_INIT | sed -e "s/^.*$PKG\], \[//" -e 's/\].*$//') + +pod2man \ + --official \ + --section="1" \ + --release="$PKG $VERSION" \ + --center="Documentation for fix-gnustack" \ + --date=$(date +%Y-%m-%d) \ + fix-gnustack.pod > fix-gnustack.1 diff --git a/src/fix-gnustack.c b/misc/fix-gnustack/fix-gnustack.c index 59e10be..59e10be 100644 --- a/src/fix-gnustack.c +++ b/misc/fix-gnustack/fix-gnustack.c diff --git a/tests/gnustack/Makefile.am b/misc/fix-gnustack/tests/Makefile.am index 2590ba2..9db0fd7 100644 --- a/tests/gnustack/Makefile.am +++ b/misc/fix-gnustack/tests/Makefile.am @@ -14,7 +14,7 @@ bad-gnustack$(EXEEXT): bad-gnustack.s check_SCRIPTS = gnustacktest TEST = $(check_SCRIPTS) -gnustacktest: - ./gnustacktest.sh 0 +gnustacktest: bad-gnustack + $(top_srcdir)/tests/gnustacktest.sh CLEANFILES = *.o *.s diff --git a/tests/gnustack/bad-gnustack.c b/misc/fix-gnustack/tests/bad-gnustack.c index b6c1f55..b6c1f55 100644 --- a/tests/gnustack/bad-gnustack.c +++ b/misc/fix-gnustack/tests/bad-gnustack.c diff --git a/tests/gnustack/gnustacktest.sh b/misc/fix-gnustack/tests/gnustacktest.sh index 84d8b69..f200baf 100755 --- a/tests/gnustack/gnustacktest.sh +++ b/misc/fix-gnustack/tests/gnustacktest.sh @@ -17,28 +17,13 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -verbose=${1-0} - -echo "================================================================================" -echo -echo " RUNNING GNU_STACK TEST" -before=$(../../src/fix-gnustack -f bad-gnustack) +before=$(../fix-gnustack -f bad-gnustack) before=$(echo ${before} | awk '{ print $2 }') -after=$(../../src/fix-gnustack bad-gnustack) +after=$(../fix-gnustack bad-gnustack) after=$(echo ${after} | awk '{ print $2 }') rm bad-gnustack -if [ "${verbose}" != 0 ]; then - echo " BEFRE=${before}" - echo " AFTER=${after}" -fi if [ "${before}" = "RWX" -a "${after}" = "RW" ]; then - echo " OK" - ret=0 + exit 0 else - echo " NOT OKAY" - ret=1 + exit 1 fi -echo -echo "================================================================================" - -exit $ret diff --git a/src/Makefile.am b/src/Makefile.am index b41f21c..ec2404e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,3 @@ ACLOCAL_AMFLAGS = -I m4 sbin_PROGRAMS = paxctl-ng paxctl_ng_SOURCES = paxctl-ng.c - -if BUILD_ELF -sbin_PROGRAMS += fix-gnustack -fix_gnustack_SOURCES = fix-gnustack.c -endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 02e85b9..5deca02 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,3 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = paxmodule pxtpax revdeppaxtest -if BUILD_ELF -SUBDIRS += gnustack -endif |