public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/elfix:elfix-0.8.x commit in: scripts/
@ 2013-01-06 17:21 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2013-01-06 17:21 UTC (permalink / raw
  To: gentoo-commits

commit:     b5bfa198c864e678eaec69a63d57bf9830ed6267
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  6 17:19:10 2013 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jan  6 17:20:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=b5bfa198

scripts/migrate-pax: do not create XATTR_PAX for default flags

---
 scripts/migrate-pax |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/migrate-pax b/scripts/migrate-pax
index 1460c71..429d45c 100755
--- a/scripts/migrate-pax
+++ b/scripts/migrate-pax
@@ -132,6 +132,7 @@ def main():
 
             if do_migration:
                 flags = re.sub('-','',flags)
+                if flags == 'e': continue # Don't create XATTR_PAX for default
                 pax.setstrflags(elf, flags)
 
             if do_deleteall:


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/elfix:elfix-0.8.x commit in: scripts/
@ 2013-05-20 20:02 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2013-05-20 20:02 UTC (permalink / raw
  To: gentoo-commits

commit:     0c653589e99499bb74a5918290148ef4994fde5f
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 14 02:38:52 2013 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon May 20 19:57:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=0c653589

scripts/setup.py: fix version number

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

---
 scripts/setup.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/setup.py b/scripts/setup.py
index f428db2..0a1bf5c 100755
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -103,7 +103,7 @@ else:
 
 setup(
 	name = 'PaxPython',
-	version = '0.6.1',
+	version = '0.8',
 	author = 'Anthony G. Basile',
 	author_email = 'blueness@gentoo.org',
 	url = 'http://dev.gentoo.org/~blueness/elfix',


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/elfix:elfix-0.8.x commit in: scripts/
@ 2013-05-20 20:02 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2013-05-20 20:02 UTC (permalink / raw
  To: gentoo-commits

commit:     80ecc4d567d711e11702c900a407cb252d937c34
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon May 20 19:46:38 2013 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon May 20 20:01:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=80ecc4d5

scripts/pax-mark: bash utility to do what the eclass does

---
 scripts/Makefile.am |    2 +-
 scripts/pax-mark    |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 1 deletions(-)

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 6728a83..5cef3e1 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,4 +1,4 @@
 ACLOCAL_AMFLAGS = -I m4
 
-dist_sbin_SCRIPTS = pypaxctl migrate-pax revdep-pax
+dist_sbin_SCRIPTS = migrate-pax pax-mark pypaxctl revdep-pax
 EXTRA_DIST = paxmodule.c setup.py

diff --git a/scripts/pax-mark b/scripts/pax-mark
new file mode 100755
index 0000000..c8fc7ed
--- /dev/null
+++ b/scripts/pax-mark
@@ -0,0 +1,111 @@
+#!/bin/bash -l
+
+has() {
+	[[ "${2/$1/}" != "$2" ]] && return 0
+	return 1
+}
+
+pax-mark() {
+
+	local f					# loop over paxables
+	local flags				# pax flags
+	local pt_fail=0 pt_failures=""		# record PT_PAX failures
+	local xt_fail=0 xt_failures=""		# record xattr PAX marking failures
+	local ret=0				# overal return code of this function
+
+	# Only the actual PaX flags and z are accepted
+	# 1. The leading '-' is optional
+	# 2. -C -c only make sense for paxctl, but are unnecessary
+	#    because we progressively do -q -qc -qC
+	# 3. z is allowed for the default
+
+	flags="${1//[!zPpEeMmRrSs]}"
+	[[ "${flags}" ]] || return 0
+	shift
+
+	# z = default. For XATTR_PAX, the default is no xattr field at all
+	local dodefault=""
+	[[ "${flags//[!z]}" ]] && dodefault="yes"
+
+	if has PT "${PAX_MARKINGS}"; then
+
+		#First try paxctl -> this might try to create/convert program headers
+		if type -p paxctl > /dev/null; then
+			for f in "$@"; do
+				# First, try modifying the existing PAX_FLAGS header
+				paxctl -q${flags} "${f}" >/dev/null 2>&1 && continue
+				# Second, try creating a PT_PAX header (works on ET_EXEC)
+				# Even though this is less safe, most exes need it, eg bug #463170
+				paxctl -qC${flags} "${f}" >/dev/null 2>&1 && continue
+				# Third, try stealing the (unused under PaX) PT_GNU_STACK header
+				paxctl -qc${flags} "${f}" >/dev/null 2>&1 && continue
+				pt_fail=1
+				pt_failures="${pt_failures} ${f}"
+			done
+
+		#Next try paxctl-ng -> this will not create/convert any program headers
+		elif type -p paxctl-ng > /dev/null && paxctl-ng -L ; then
+			flags="${flags//z}"
+			for f in "$@"; do
+				[[ ${dodefault} == "yes" ]] && paxctl-ng -L -z "${f}" >/dev/null 2>&1
+				[[ "${flags}" ]] || continue
+				paxctl-ng -L -${flags} "${f}" >/dev/null 2>&1 && continue
+				pt_fail=1
+				pt_failures="${pt_failures} ${f}"
+			done
+
+		#Finally fall back on scanelf
+		elif type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then
+			scanelf -Xxz ${flags} "$@" >/dev/null 2>&1
+
+		#We failed to set PT_PAX flags
+		elif [[ ${PAX_MARKINGS} != "none" ]]; then
+			pt_failures="$*"
+			pt_fail=1
+		fi
+
+		if [[ ${pt_fail} == 1 ]]; then
+			ret=1
+		fi
+	fi
+
+	if has XT "${PAX_MARKINGS}"; then
+
+		flags="${flags//z}"
+
+		#First try paxctl-ng
+		if type -p paxctl-ng > /dev/null && paxctl-ng -l ; then
+			for f in "$@"; do
+				[[ ${dodefault} == "yes" ]] && paxctl-ng -d "${f}" >/dev/null 2>&1
+				[[ "${flags}" ]] || continue
+				paxctl-ng -l -${flags} "${f}" >/dev/null 2>&1 && continue
+				xt_fail=1
+				xt_failures="${tx_failures} ${f}"
+			done
+
+		#Next try setfattr
+		elif type -p setfattr > /dev/null; then
+			[[ "${flags//[!Ee]}" ]] || flags+="e" # bug 447150
+			for f in "$@"; do
+				[[ ${dodefault} == "yes" ]] && setfattr -x "user.pax.flags" "${f}" >/dev/null 2>&1
+				setfattr -n "user.pax.flags" -v "${flags}" "${f}" >/dev/null 2>&1 && continue
+				xt_fail=1
+				xt_failures="${tx_failures} ${f}"
+			done
+
+		#We failed to set XATTR_PAX flags
+		elif [[ ${PAX_MARKINGS} != "none" ]]; then
+			xt_failures="$*"
+			xt_fail=1
+		fi
+
+		if [[ ${xt_fail} == 1 ]]; then
+			ret=1
+		fi
+	fi
+
+	return ${ret}
+}
+
+PAX_MARKINGS=${PAX_MARKINGS:="PT XT"}
+pax-mark "$@"


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-20 20:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 20:02 [gentoo-commits] proj/elfix:elfix-0.8.x commit in: scripts/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2013-05-20 20:02 Anthony G. Basile
2013-01-06 17:21 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox