From ee5fb870ae9fa72448a2bf7ebe100ebbbac5477f521a9d2b9269dd29b84c58cf Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Mon, 30 Nov 2015 08:49:56 +0000 Subject: [PATCH] Accepting request 346800 from home:michel_mno This package is built from prelink sources but contains just the execstack binary. It can be used manipulate ELF binaries to run with or without executable stack. package created for dependencies that only need execstack and prelink do not build for all archis OBS-URL: https://build.opensuse.org/request/show/346800 OBS-URL: https://build.opensuse.org/package/show/devel:tools/execstack?expand=0&rev=1 --- .gitattributes | 23 +++++ .gitignore | 1 + Add-PL_ARCH-for-AArch64.patch | 118 +++++++++++++++++++++++ execstack.changes | 14 +++ execstack.spec | 80 +++++++++++++++ prelink-4c79120.tar.gz | 3 + prelink_add_no_execstack_for_ppc64.patch | 43 +++++++++ prelink_update_fsf_address.patch | 24 +++++ 8 files changed, 306 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Add-PL_ARCH-for-AArch64.patch create mode 100644 execstack.changes create mode 100644 execstack.spec create mode 100644 prelink-4c79120.tar.gz create mode 100644 prelink_add_no_execstack_for_ppc64.patch create mode 100644 prelink_update_fsf_address.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Add-PL_ARCH-for-AArch64.patch b/Add-PL_ARCH-for-AArch64.patch new file mode 100644 index 0000000..7233b68 --- /dev/null +++ b/Add-PL_ARCH-for-AArch64.patch @@ -0,0 +1,118 @@ +From a33b23b9ec5c0733a0ff85dafc46b3df2a6d2249 Mon Sep 17 00:00:00 2001 +From: Mark Salter +Date: Fri, 21 Aug 2015 12:03:30 -0400 +Subject: [PATCH] Add PL_ARCH for AArch64 + +Add a skeleton PL_ARCH for AArch64. Just enough to support +execstack. + +Signed-off-by: Mark Salter +--- + src/Makefile.am | 3 ++- + src/Makefile.in | 9 ++++++--- + src/arch-aarch64.c | 38 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 46 insertions(+), 4 deletions(-) + create mode 100644 src/arch-aarch64.c + +diff --git a/src/Makefile.am b/src/Makefile.am +index d2265aa9c0..a4c65f2e65 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -12,7 +12,8 @@ bin_PROGRAMS = execstack + + arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.c \ + arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \ +- arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c ++ arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c \ ++ arch-aarch64.c + common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \ + hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c + prelink_SOURCES = cache.c conflict.c cxx.c doit.c exec.c execle_open.c get.c \ +diff --git a/src/Makefile.in b/src/Makefile.in +index 85cf84577f..863dc835a0 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -107,7 +107,8 @@ bin_PROGRAMS = execstack + + arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.c \ + arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \ +- arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c ++ arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c \ ++ arch-aarch64.c + + common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \ + hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c +@@ -139,7 +140,8 @@ am__objects_2 = arch-i386.$(OBJEXT) arch-alpha.$(OBJEXT) \ + arch-ppc.$(OBJEXT) arch-ppc64.$(OBJEXT) arch-sparc.$(OBJEXT) \ + arch-sparc64.$(OBJEXT) arch-x86_64.$(OBJEXT) \ + arch-mips.$(OBJEXT) arch-s390.$(OBJEXT) arch-s390x.$(OBJEXT) \ +- arch-arm.$(OBJEXT) arch-sh.$(OBJEXT) arch-ia64.$(OBJEXT) ++ arch-arm.$(OBJEXT) arch-sh.$(OBJEXT) arch-ia64.$(OBJEXT) \ ++ arch-aarch64.$(OBJEXT) + am_execstack_OBJECTS = execstack.$(OBJEXT) $(am__objects_1) \ + $(am__objects_2) + execstack_OBJECTS = $(am_execstack_OBJECTS) +@@ -162,7 +164,7 @@ LIBS = @LIBS@ + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles + @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/arch-alpha.Po \ +-@AMDEP_TRUE@ ./$(DEPDIR)/arch-arm.Po ./$(DEPDIR)/arch-i386.Po \ ++@AMDEP_TRUE@ ./$(DEPDIR)/arch-arm.Po ./$(DEPDIR)/arch-aarch64.Po ./$(DEPDIR)/arch-i386.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/arch-ia64.Po ./$(DEPDIR)/arch-mips.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/arch-ppc.Po ./$(DEPDIR)/arch-ppc64.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/arch-s390.Po ./$(DEPDIR)/arch-s390x.Po \ +@@ -277,6 +279,7 @@ distclean-compile: + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-alpha.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-arm.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-arch64.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-i386.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-ia64.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch-mips.Po@am__quote@ +diff --git a/src/arch-aarch64.c b/src/arch-aarch64.c +new file mode 100644 +index 0000000000..42eb2ececb +--- /dev/null ++++ b/src/arch-aarch64.c +@@ -0,0 +1,38 @@ ++/* Copyright (C) 2015 Red Hat, Inc. ++ Written by Mark Salter , 2015. ++ ++ 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 2, 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, write to the Free Software Foundation, ++ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "prelink.h" ++ ++PL_ARCH = { ++ .name = "AArch64", ++ .class = ELFCLASS64, ++ .machine = EM_AARCH64, ++ .alternate_machine = { EM_NONE }, ++ .max_page_size = 0x10000, ++ .page_size = 0x1000 ++}; +-- +2.1.0 + diff --git a/execstack.changes b/execstack.changes new file mode 100644 index 0000000..e3ab604 --- /dev/null +++ b/execstack.changes @@ -0,0 +1,14 @@ +------------------------------------------------------------------- +Fri Nov 27 17:41:42 UTC 2015 - normand@linux.vnet.ibm.com + +- new prelink_add_no_execstack_for_ppc64.patch + to bypass for ppc64 archi the gcc linker that do not set + a GNU_STACK header in generated elf file. + +------------------------------------------------------------------- +Thu Nov 26 16:11:08 UTC 2015 - normand@linux.vnet.ibm.com + +- Init new execstack package: (similar to fedora) + This package is built from prelink sources but contains just the + execstack binary. It can be used manipulate ELF binaries to run + with or without executable stack. diff --git a/execstack.spec b/execstack.spec new file mode 100644 index 0000000..78aeb08 --- /dev/null +++ b/execstack.spec @@ -0,0 +1,80 @@ +# +# spec file for package mozjs38 +# +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# 2014 Wolfgang Rosenauer +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +Name: execstack +Version: 0.5.0 +Release: 0%{?dist} +Summary: Utility to set/clear/query executable stack bit + +%global commit 4c79120bcdbde0616f592458ccde7035e92ca3d8 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +License: GPL-2.0+ +# work around for missing upstream tarball with latest checkin +Url: https://github.com/keszybz/prelink +Source0: https://github.com/keszybz/prelink/archive/%{commit}.tar.gz#/prelink-%{shortcommit}.tar.gz + +Patch0: Add-PL_ARCH-for-AArch64.patch +Patch1: prelink_update_fsf_address.patch +# bypass where gcc linker do not add the GNU_STACK default header in elf file +%ifarch ppc64 +Patch2: prelink_add_no_execstack_for_ppc64.patch +%endif + +BuildRequires: libelf-devel +BuildRequires: libselinux-devel, selinux-tools +BuildRequires: git +Requires: glibc >= 2.2.4-18, coreutils, findutils +Requires: util-linux, gawk, grep + +%description +This package is built from prelink sources but contains just the +execstack binary. It can be used manipulate ELF binaries to run +with or without executable stack. + +%prep +%autosetup -n prelink-%{commit} -p1 -Sgit + +%build +sed -i -e '/^prelink_LDADD/s/$/ -lpthread/' src/Makefile.{am,in} +%configure +make %{?_smp_mflags} -C gelf +make %{?_smp_mflags} -C gelfx +make %{?_smp_mflags} -C gelfx32 +make %{?_smp_mflags} -C src execstack + +%check +cp src/execstack test +src/execstack -q test | grep '^-' +src/execstack -s test +src/execstack -q test | grep '^X' +src/execstack -c test +src/execstack -q test | grep '^-' + +%install +install -D src/execstack %{buildroot}%{_bindir}/execstack +install -Dm0644 doc/execstack.8 %{buildroot}%{_mandir}/man8/execstack.8 + +%files +%defattr(-,root,root,-) +%{_bindir}/execstack +%{_mandir}/man8/execstack.8.* +%doc ChangeLog NEWS README TODO THANKS COPYING + +%changelog + diff --git a/prelink-4c79120.tar.gz b/prelink-4c79120.tar.gz new file mode 100644 index 0000000..ee21aaa --- /dev/null +++ b/prelink-4c79120.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fab35685d704de83e71b84a6875ce50218bf45ff9e64d114427975489840ff46 +size 1041199 diff --git a/prelink_add_no_execstack_for_ppc64.patch b/prelink_add_no_execstack_for_ppc64.patch new file mode 100644 index 0000000..03378a2 --- /dev/null +++ b/prelink_add_no_execstack_for_ppc64.patch @@ -0,0 +1,43 @@ +From: Michel Normand +Subject: prelink add no execstack for ppc64 +Date: Fri, 27 Nov 2015 18:37:37 +0100 + +prelink add no execstack for ppc64 + +Signed-off-by: Michel Normand +--- + src/Makefile.am | 1 + + src/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +Index: prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/src/Makefile.am +=================================================================== +--- prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8.orig/src/Makefile.am ++++ prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/src/Makefile.am +@@ -25,5 +25,6 @@ prelink_LDADD = @LIBGELF@ + prelink_LDFLAGS = -all-static + + execstack_SOURCES = execstack.c $(common_SOURCES) $(arch_SOURCES) ++execstack_LDFLAGS = -z noexecstack + + extra_DIST = makecrc.c +Index: prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/src/Makefile.in +=================================================================== +--- prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8.orig/src/Makefile.in ++++ prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/src/Makefile.in +@@ -123,6 +123,7 @@ prelink_LDADD = @LIBGELF@ + prelink_LDFLAGS = -all-static + + execstack_SOURCES = execstack.c $(common_SOURCES) $(arch_SOURCES) ++execstack_LDFLAGS = -z noexecstack + + extra_DIST = makecrc.c + subdir = src +@@ -147,7 +148,6 @@ am_execstack_OBJECTS = execstack.$(OBJEX + execstack_OBJECTS = $(am_execstack_OBJECTS) + execstack_LDADD = $(LDADD) + execstack_DEPENDENCIES = +-execstack_LDFLAGS = + am_prelink_OBJECTS = cache.$(OBJEXT) conflict.$(OBJEXT) cxx.$(OBJEXT) \ + doit.$(OBJEXT) exec.$(OBJEXT) execle_open.$(OBJEXT) \ + get.$(OBJEXT) gather.$(OBJEXT) layout.$(OBJEXT) main.$(OBJEXT) \ diff --git a/prelink_update_fsf_address.patch b/prelink_update_fsf_address.patch new file mode 100644 index 0000000..9d02338 --- /dev/null +++ b/prelink_update_fsf_address.patch @@ -0,0 +1,24 @@ +From: Michel Normand +Subject: prelink update fsf address +Date: Thu, 26 Nov 2015 17:07:22 +0100 + +prelink update fsf address + +Signed-off-by: Michel Normand +--- + COPYING | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/COPYING +=================================================================== +--- prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8.orig/COPYING ++++ prelink-4c79120bcdbde0616f592458ccde7035e92ca3d8/COPYING +@@ -2,7 +2,7 @@ + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. +- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +