diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2011-12-28 19:46:48 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2011-12-28 19:59:44 -0500 |
commit | 2d9bd587c6863c924442f6a9d617afc1163272bb (patch) | |
tree | 0339c6b45b8b6709bc279f1d50487ed1a2e46c0a | |
parent | scripts/revdep-pax: cleanup output (diff) | |
download | elfix-2d9bd587c6863c924442f6a9d617afc1163272bb.tar.gz elfix-2d9bd587c6863c924442f6a9d617afc1163272bb.tar.bz2 elfix-2d9bd587c6863c924442f6a9d617afc1163272bb.zip |
scripts/revdep-pax: do complex markings
-rwxr-xr-x | misc/test-revdep-pax/testrevdeppax.sh | 8 | ||||
-rwxr-xr-x | scripts/revdep-pax | 24 |
2 files changed, 25 insertions, 7 deletions
diff --git a/misc/test-revdep-pax/testrevdeppax.sh b/misc/test-revdep-pax/testrevdeppax.sh index d841fae..8bd3156 100755 --- a/misc/test-revdep-pax/testrevdeppax.sh +++ b/misc/test-revdep-pax/testrevdeppax.sh @@ -1,6 +1,7 @@ #!/bin/bash PAXCTLNG="/usr/sbin/paxctl-ng" +PAXCTL="/sbin/paxctl" BINARY="/usr/bin/testrevdeppax" LIBRARY="/usr/lib/libmyrevdeppax.so.0.0.0" REVDEPPAX="/usr/sbin/revdep-pax" @@ -19,15 +20,20 @@ for i in "R" "r" "Rr" do for j in "R" "r" "Rr" do + echo "============================================================================" $PAXCTLNG -z $BINARY $PAXCTLNG -$i $BINARY $PAXCTLNG -z $LIBRARY - $PAXCTLNG -$j $LIBRARY + $PAXCTLNG -m$j $LIBRARY p=$i; [[ "$p" == "Rr" ]] && p="-" echo "Binary -> $p" p=$j; [[ "$p" == "Rr" ]] && p="-" echo "Library -> $p" $REVDEPPAX -m -y -l $LIBRARY echo + $PAXCTLNG -v $BINARY + $PAXCTLNG -v $LIBRARY + $PAXCTL -v $BINARY 2>/dev/null + $PAXCTL -v $LIBRARY 2>/dev/null done done diff --git a/scripts/revdep-pax b/scripts/revdep-pax index b0d8bcc..76add9c 100755 --- a/scripts/revdep-pax +++ b/scripts/revdep-pax @@ -211,23 +211,35 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags): # Force Off Force On Force Off + Warn # Force Off Nothing Force Off + #See /usr/include/elf.h for these values + pf_flags = { + 'P':1<<4, 'p':1<<5, + 'S':1<<6, 's':1<<7, + 'M':1<<8, 'm':1<<9, + 'X':1<<10, 'x':1<<11, + 'E':1<<12, 'e':1<<13, + 'R':1<<14, 'r':1<<15 + } + ( importer_str_flags, importer_bin_flags ) = pax.getflags(importer) result_bin_flags = exporter_bin_flags for i in range(len(importer_str_flags)): if importer_str_flags[i].isupper() and exporter_str_flags[i].islower(): - print '\t\tWarning: %s has %s, trying to set to %s' % ( + result_bin_flags = result_bin_flags ^ pf_flags[exporter_str_flags[i]] + result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] + print '\t\tWarning: %s has %s, refusing to set to %s' % ( importer, importer_str_flags[i], exporter_str_flags[i] ), if importer_str_flags[i].isupper() and exporter_str_flags[i] == '-': - print '\t\tWarning: %s has %s, trying to set to %s' % ( - importer, importer_str_flags[i], exporter_str_flags[i] ), + result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] if importer_str_flags[i].islower() and exporter_str_flags[i].isupper(): - print '\t\tWarning: %s has %s, trying to set to %s' % ( + result_bin_flags = result_bin_flags ^ pf_flags[exporter_str_flags[i]] + result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] + print '\t\tWarning: %s has %s, refusing to set to %s' % ( importer, importer_str_flags[i], exporter_str_flags[i] ), if importer_str_flags[i].islower() and exporter_str_flags[i] == '-': - print '\t\tWarning: %s has %s, trying to set to %s' % ( - importer, importer_str_flags[i], exporter_str_flags[i] ), + result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] pax.setflags(importer, result_bin_flags) |