summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2011-06-20 05:23:29 +0000
committerPeter Volkov <pva@gentoo.org>2011-06-20 05:23:29 +0000
commit87ff1828c6f7d1900fdcf41f6232f31e4114b7b0 (patch)
treea926cf1b42a178dd73c4309f2936d2530d6a13d1 /dev-util/oprofile
parentMask dev-util/oprofile-0.9.7 release candidate (diff)
downloadhistorical-87ff1828c6f7d1900fdcf41f6232f31e4114b7b0.tar.gz
historical-87ff1828c6f7d1900fdcf41f6232f31e4114b7b0.tar.bz2
historical-87ff1828c6f7d1900fdcf41f6232f31e4114b7b0.zip
Fixes privilege escalation with sudo (CVE-2011-1760), bug #366699 thank Tim Sammut for report. Bump release candidate: new qt4 gui added java support. Took maintaining.
Package-Manager: portage-2.1.10.3/cvs/Linux x86_64
Diffstat (limited to 'dev-util/oprofile')
-rw-r--r--dev-util/oprofile/ChangeLog18
-rw-r--r--dev-util/oprofile/Manifest23
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch74
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch46
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch19
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch182
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch35
-rw-r--r--dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch97
-rw-r--r--dev-util/oprofile/metadata.xml2
-rw-r--r--dev-util/oprofile/oprofile-0.9.6-r1.ebuild77
-rw-r--r--dev-util/oprofile/oprofile-0.9.7_rc1.ebuild68
11 files changed, 627 insertions, 14 deletions
diff --git a/dev-util/oprofile/ChangeLog b/dev-util/oprofile/ChangeLog
index c411de3f1b6d..acd922dc53b3 100644
--- a/dev-util/oprofile/ChangeLog
+++ b/dev-util/oprofile/ChangeLog
@@ -1,6 +1,22 @@
# ChangeLog for dev-util/oprofile
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.68 2011/06/18 17:15:07 spock Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/ChangeLog,v 1.69 2011/06/20 05:23:29 pva Exp $
+
+*oprofile-0.9.7_rc1 (20 Jun 2011)
+*oprofile-0.9.6-r1 (20 Jun 2011)
+
+ 20 Jun 2011; Peter Volkov <pva@gentoo.org> +oprofile-0.9.6-r1.ebuild,
+ +files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch,
+ +files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch,
+ +files/oprofile-0.9.6-Avoid-using-bash.patch,
+ +files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch,
+ +files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch
+ ,
+ +files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch
+ , +oprofile-0.9.7_rc1.ebuild, metadata.xml:
+ Fixes privilege escalation with sudo (CVE-2011-1760), bug #366699 thank Tim
+ Sammut for report. Bump release candidate: new qt4 gui added java support.
+ Took maintaining.
18 Jun 2011; Michał Januszewski <spock@gentoo.org> metadata.xml:
Reassigning to maintainer-needed.
diff --git a/dev-util/oprofile/Manifest b/dev-util/oprofile/Manifest
index 00da31218439..4e19cf9813c5 100644
--- a/dev-util/oprofile/Manifest
+++ b/dev-util/oprofile/Manifest
@@ -1,15 +1,14 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
+AUX oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch 1727 RMD160 2f5149c1ffdf17e5c13e32590a68915fc02ba39d SHA1 7f5db1e9cf472781c6f92ea296d927236d017215 SHA256 6179ba1053213dfc96848d0a280e93dd2860bdca8a101bf4ed0f4fe5bb909d4b
+AUX oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch 1348 RMD160 edf2e753c5467179300c5e6c435a134e79e6e38c SHA1 8fdf35b82c2e2ea49402b0fc5bb91bfd3ac8a66d SHA256 4a36023ef354921c19bf8f97541b6cfeca3b5c216f53c0a160778d59244e9076
+AUX oprofile-0.9.6-Avoid-using-bash.patch 565 RMD160 540bef839f86e54c55d43da8d3dce2b760ec19fc SHA1 a06e2e09252e205fb20fef0006412cf2c01f24a3 SHA256 771368546670af34fcd912b0acd22c016ff700f9f8e383b1a8992cd0178101d4
+AUX oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch 4626 RMD160 dab60a332b2b3650c18e76b05560933b99f86c8a SHA1 9d3aae9a974391854b1a32d97e838285704239d5 SHA256 f5cd01ad47d4eb5666926bfb8324360329db158303ec7a4ea06def6e94bf834e
+AUX oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch 785 RMD160 60d95e815d1d7b633444165dc1aa9c10e43c0630 SHA1 5fce288c7093586cf13223ae12fc4092d295ed2e SHA256 927d20e11768b66e04b2b0bc86973d54833dea21eea1217773bd6d5b06ced4f7
+AUX oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch 3081 RMD160 aad171f329a919d0218a991b5857c66666493b31 SHA1 d44a49aa4fa05ad4a6ad065e242c772e2ecbdda1 SHA256 d9a3b5ac5718466355b53ba0ff5d27f4b4ab3e22c9b7c78d055f71e33bdce939
AUX oprofile-0.9.6-mutable.patch 537 RMD160 a10427d2ac352250f8dbc40a242ca5477688c37b SHA1 eb1706977c60abf079f1f418f83cf51fa6c76d1d SHA256 0d0d4394408a5392854cdec9453b51a3347a4350c503c7a1eb2ef1ae83dff413
DIST oprofile-0.9.6.tar.gz 1321536 RMD160 95af7d4b698ac9f93567e7906e501f29949e96a0 SHA1 cc62cc58c574e235bc146c8ddc9d9a9af0972fd1 SHA256 3f0dd40a7749fc650d25d79d42ebbff8f3b6db310c36e7c3839696cc09077880
+DIST oprofile-0.9.7-rc1.tar.gz 1390300 RMD160 362adf5c456038e6d56ed2c2f67b1e9b8f51f1a7 SHA1 4b501a7233f7b94ba3df1ff18c92033dff49e2b0 SHA256 5539a0050cf0a20bdba2d1b01a7c7a8d7334960a3ff61b3dccf3b70354da3543
+EBUILD oprofile-0.9.6-r1.ebuild 2260 RMD160 22a902a9986b0e8fc6fa0dd9a5ef09889f729204 SHA1 12ff0b77fc00eb93631319e262310d2a5e7459a4 SHA256 1120320fb458bef2722a3f4bb6ca051360be2635af9e8e371778b31f03f60d44
EBUILD oprofile-0.9.6.ebuild 1809 RMD160 dcb7bb09292efacbb68f56d8f8c3fbd5112b071b SHA1 d22e1789d366300158d25be797bd19007aa80080 SHA256 7ad310cf0c5e8b47a7f37dc9ec3dc6d14fe5f8d98aa04fb9521672b7574989bd
-MISC ChangeLog 9436 RMD160 d804709b4471f3bb5415d55626c3cfa4637ce7df SHA1 7b998f8411c7bf5ff9dc33bb0a10f67d1bc45321 SHA256 1f953f2ec80c80acadc97686e05f11b0d63ff15e1f372eb26d3925fe5de0637b
-MISC metadata.xml 232 RMD160 854b06094287201d0b98f2b21d36054db25d81cd SHA1 cc4f98e9ee0102aea687d71cf3af924cf156edbb SHA256 21382e863647add08888c924279a4b931b2b90ccd0cf5e526ee74a3d5e1fd0df
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.17 (GNU/Linux)
-
-iEYEARECAAYFAk383SUACgkQchej4aZK9/fJFQCfRxUjrvxAf8eN0Xigsq65XHxF
-YfIAnjtqn5BJ4z0mVQsUVEu2wJcEXkfo
-=0Jk8
------END PGP SIGNATURE-----
+EBUILD oprofile-0.9.7_rc1.ebuild 1787 RMD160 2122ed113a8799f955d353a7d092b73b917f4db9 SHA1 013d01f67282ce2c614466be78d74ce79e9ed31d SHA256 9695e1c8b898a337a2bac27a5bfb093510b928dd2d8cf2557a4f8f91af643749
+MISC ChangeLog 10232 RMD160 186290cdf8e30fb99bdd42ad9c5b29158ac4ba42 SHA1 44dfe8f935b0d4f01e60d515d5716b8376cb2434 SHA256 b6812dbe7d780b4f65c2b1245e0466fa8994c3064679404a0e83eb3adc0a91c1
+MISC metadata.xml 218 RMD160 d2e48b731e46401f5b1b97dd0b4a2d0547b03b3f SHA1 5a8b83455850a99338ac7ca6cbcda42e63e2d1a1 SHA256 3923875856fd069560f8e30179d0cafb975018d73fd18e2af8339d3927cbc2ba
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch b/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch
new file mode 100644
index 000000000000..2e38a65628a8
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Add-argument-checking-for-numerical-arguments.patch
@@ -0,0 +1,74 @@
+commit 96c0ac657c59609d58c47d7ff2206d85a970f20b
+Author: Maynard johnson <maynardj@us.ibm.com>
+Date: Wed Jan 5 21:16:08 2011 +0000
+
+ Add argument checking for numerical arguments
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index dc85c53..8c64af9 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -49,6 +49,31 @@ error_if_empty()
+ fi
+ }
+
++# guess_number_base() checks if string is a valid octal(8), hexidecimal(16),
++# or decimal number(10). The value is returned in $?. Returns 0, if string
++# isn't a octal, hexidecimal, or decimal number.
++guess_number_base()
++{
++ if [[ "$1" =~ ^0[0-7]*$ ]] ; then
++ return 8;
++ elif [[ "$1" =~ ^0x[0-9a-fA-F]+$ ]] ; then
++ return 16;
++ elif [[ "$1" =~ ^[1-9][0-9]*$ ]] ; then
++ return 10;
++ else
++ return 0;
++ fi
++}
++
++# check value is a valid number
++error_if_not_number()
++{
++ guess_number_base $2
++ if test "$?" -eq 0 ; then
++ echo "Argument for $1, $2, is not a valid number." >&2
++ exit 1
++ fi
++}
+
+ # rm_device arguments $1=file_name
+ rm_device()
+@@ -754,6 +779,7 @@ do_options()
+ ;;
+ --buffer-size)
+ error_if_empty $arg $val
++ error_if_not_number $arg $val
+ BUF_SIZE=$val
+ DO_SETUP=yes
+ ;;
+@@ -763,6 +789,7 @@ do_options()
+ exit 1
+ fi
+ error_if_empty $arg $val
++ error_if_not_number $arg $val
+ BUF_WATERSHED=$val
+ DO_SETUP=yes
+ ;;
+@@ -772,6 +799,7 @@ do_options()
+ exit 1
+ fi
+ error_if_empty $arg $val
++ error_if_not_number $arg $val
+ CPU_BUF_SIZE=$val
+ DO_SETUP=yes
+ ;;
+@@ -802,6 +830,7 @@ do_options()
+ echo "Call-graph profiling unsupported on this kernel/hardware" >&2
+ exit 1
+ fi
++ error_if_not_number $arg $val
+ CALLGRAPH=$val
+ DO_SETUP=yes
+ ;;
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch
new file mode 100644
index 000000000000..1892cc3e007a
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-blindly-source-SETUP_FILE-with.patch
@@ -0,0 +1,46 @@
+commit f427df4ed4b2ec540d496abc4afa984b2dd677b4
+Author: William Cohen <wcohen@redhat.com>
+Date: Thu Jun 2 09:44:38 2011 -0400
+
+ Avoid blindly source $SETUP_FILE with '.' (PR3303383)
+
+ There could be arbitrary commands in the $SETUP_FILE. The '.' command
+ would blindly execute them. This change limits do_load_setup to only
+ assigning values to variables.
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index cdff19f..b981427 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -496,12 +496,25 @@ do_load_setup()
+ || mv "$SEC_SETUP_FILE" "$SETUP_FILE"
+ fi
+
+- if test -f "$SETUP_FILE"; then
+- # load the actual information from file
+- # FIXME this is insecure, arbitrary commands could be added to
+- # $SETUP_FILE and be executed as root
+- . $SETUP_FILE
+- fi
++ if test ! -f "$SETUP_FILE"; then return; fi
++
++ while IFS== read -r arg val; do
++ case "$arg" in
++ # The following catches anything that is not
++ # 0-9, a-z, A-Z, or an '_'
++ *[![:alnum:]_]*)
++ echo "Invalid variable \"$arg\" in $SETUP_FILE."
++ exit 1;;
++ esac
++ case "$val" in
++ # The following catches anything that is not
++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/'
++ *[!-[:alnum:]_:,./]*)
++ echo "Invalid value \"$val\" for $arg in $SETUP_FILE."
++ exit 1;;
++ esac
++ eval "${arg}=${val}"
++ done < $SETUP_FILE
+ }
+
+
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch
new file mode 100644
index 000000000000..49d06f4bc0ca
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Avoid-using-bash.patch
@@ -0,0 +1,19 @@
+commit 7cb560b4d52f27f9ccb86a9cd643d0288514335f
+Author: William Cohen <wcohen@redhat.com>
+Date: Thu May 26 11:21:39 2011 -0400
+
+ Avoid using [[ in error_if_not_basename() to improve posix compliance.
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index f002f01..cdff19f 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -89,7 +89,7 @@ error_if_not_number()
+ error_if_not_basename()
+ {
+ bname=`basename "$2"`
+- if [[ "x$2" != "x$bname" ]] ; then
++ if test "$2" != "$bname"; then
+ echo "Argument for $1, $2, is not a base filename." >&2
+ exit 1
+ fi
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch b/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch
new file mode 100644
index 000000000000..25ed342f5126
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Do-additional-checks-on-user-supplied-arguments.patch
@@ -0,0 +1,182 @@
+commit 9578aed0a51f5c77fd20fd40cead126c7cdd5030
+Author: William Cohen <wcohen@redhat.com>
+Date: Thu Jun 2 10:24:26 2011 -0400
+
+ Do additional checks on user supplied arguments
+
+ Avoid blindly setting variable to user-supplied values. Check to the values
+ to make sure they do not contain odd punctuation.
+
+ Signed-off-by: William Cohen <wcohen@redhat.com>
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index 8f584ad..92baa0d 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -78,7 +78,8 @@ guess_number_base()
+ # check value is a valid number
+ error_if_not_number()
+ {
+- guess_number_base $2
++ error_if_empty "$1" "$2"
++ guess_number_base "$2"
+ if test "$?" -eq 0 ; then
+ echo "Argument for $1, $2, is not a valid number." >&2
+ exit 1
+@@ -86,13 +87,33 @@ error_if_not_number()
+ }
+
+ # check value is a base filename
+-error_if_not_basename()
++error_if_not_valid_savename()
+ {
++ error_if_empty "$1" "$2"
+ bname=`basename "$2"`
+ if test "$2" != "$bname"; then
+- echo "Argument for $1, $2, is not a base filename." >&2
++ echo "Argument for $1, $2, cannot change directory." >&2
+ exit 1
+ fi
++ case "$2" in
++ # The following catches anything that is not
++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/'
++ *[!-[:alnum:]_:,./]*)
++ echo "Argument for $1, $2, not allow to have special characters" >&2
++ exit 1;;
++ esac
++}
++
++error_if_invalid_arg()
++{
++ error_if_empty "$1" "$2"
++ case "$2" in
++ # The following catches anything that is not
++ # 0-9, a-z, A-Z, an '-', ':', ',', '.', or '/'
++ *[!-[:alnum:]_:,./]*)
++ echo "Argument for $1, $2, is not valid argument." >&2
++ exit 1;;
++ esac
+ }
+
+ # rm_device arguments $1=file_name
+@@ -814,8 +835,7 @@ do_options()
+ ;;
+
+ --save)
+- error_if_empty $arg $val
+- error_if_not_basename $arg $val
++ error_if_not_valid_savename "$arg" "$val"
+ DUMP=yes
+ SAVE_SESSION=yes
+ SAVE_NAME=$val
+@@ -840,8 +860,7 @@ do_options()
+ # already processed
+ ;;
+ --buffer-size)
+- error_if_empty $arg $val
+- error_if_not_number $arg $val
++ error_if_not_number "$arg" "$val"
+ BUF_SIZE=$val
+ DO_SETUP=yes
+ ;;
+@@ -850,8 +869,7 @@ do_options()
+ echo "$arg unsupported for this kernel version"
+ exit 1
+ fi
+- error_if_empty $arg $val
+- error_if_not_number $arg $val
++ error_if_not_number "$arg" "$val"
+ BUF_WATERSHED=$val
+ DO_SETUP=yes
+ ;;
+@@ -860,13 +878,12 @@ do_options()
+ echo "$arg unsupported for this kernel version"
+ exit 1
+ fi
+- error_if_empty $arg $val
+- error_if_not_number $arg $val
++ error_if_not_number "$arg" "$val"
+ CPU_BUF_SIZE=$val
+ DO_SETUP=yes
+ ;;
+ -e|--event)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ # reset any read-in defaults from daemonrc
+ if test "$SEEN_EVENT" = "0"; then
+ NR_CHOSEN=0
+@@ -887,17 +904,16 @@ do_options()
+ DO_SETUP=yes
+ ;;
+ -c|--callgraph)
+- error_if_empty $arg $val
+ if test ! -f $MOUNT/backtrace_depth; then
+ echo "Call-graph profiling unsupported on this kernel/hardware" >&2
+ exit 1
+ fi
+- error_if_not_number $arg $val
++ error_if_not_number "$arg" "$val"
+ CALLGRAPH=$val
+ DO_SETUP=yes
+ ;;
+ --vmlinux)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ VMLINUX=$val
+ DO_SETUP=yes
+ ;;
+@@ -906,32 +922,32 @@ do_options()
+ DO_SETUP=yes
+ ;;
+ --kernel-range)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ KERNEL_RANGE=$val
+ DO_SETUP=yes
+ ;;
+ --xen)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ XENIMAGE=$val
+ DO_SETUP=yes
+ ;;
+ --active-domains)
+- error_if_empty $arg $val
++ error_if_invalid_arg $arg $val
+ ACTIVE_DOMAINS=$val
+ DO_SETUP=yes
+ ;;
+ --note-table-size)
+- error_if_empty $arg $val
+ if test "$KERNEL_SUPPORT" = "yes"; then
+ echo "\"$arg\" meaningless on this kernel" >&2
+ exit 1
+ else
++ error_if_not_number "$arg" "$val"
+ NOTE_SIZE=$val
+ fi
+ DO_SETUP=yes
+ ;;
+ -i|--image)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ if test "$val" = "all"; then
+ IMAGE_FILTER=
+ else
+@@ -944,6 +960,7 @@ do_options()
+ if test -z "$val"; then
+ VERBOSE="all"
+ else
++ error_if_invalid_arg "$arg" "$val"
+ VERBOSE=$val
+ fi
+ ;;
+@@ -1898,7 +1915,7 @@ check_options_early()
+ exit 0
+ ;;
+ --session-dir)
+- error_if_empty $arg $val
++ error_if_invalid_arg "$arg" "$val"
+ SESSION_DIR="$val"
+ DO_SETUP=yes
+ # do not exit early
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch b/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch
new file mode 100644
index 000000000000..3e0de57389ae
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch
@@ -0,0 +1,35 @@
+commit 022cc07e4140c1ba1b9824124b29f36fd44d6040
+Author: William Cohen <wcohen@redhat.com>
+Date: Mon May 23 14:59:41 2011 -0500
+
+ Ensure that --save only saves things in $SESSION_DIR
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index e908f1f..0f04354 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -75,6 +75,16 @@ error_if_not_number()
+ fi
+ }
+
++# check value is a base filename
++error_if_not_basename()
++{
++ bname=`basename "$2"`
++ if [[ "x$2" != "x$bname" ]] ; then
++ echo "Argument for $1, $2, is not a base filename." >&2
++ exit 1
++ fi
++}
++
+ # rm_device arguments $1=file_name
+ rm_device()
+ {
+@@ -753,6 +763,7 @@ do_options()
+
+ --save)
+ error_if_empty $arg $val
++ error_if_not_basename $arg $val
+ DUMP=yes
+ SAVE_SESSION=yes
+ SAVE_NAME=$val
diff --git a/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch b/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch
new file mode 100644
index 000000000000..f29b79f7f848
--- /dev/null
+++ b/dev-util/oprofile/files/oprofile-0.9.6-Fix-opcontrol-status-to-show-accurate-information.patch
@@ -0,0 +1,97 @@
+commit a5012d86e87e1c59be4a221b7d47cc791b102555
+Author: Maynard Johnson <maynardj@us.ibm.com>
+Date: Wed May 25 16:10:46 2011 -0500
+
+ Fix opcontrol --status to show accurate information for running daemon
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index 0f04354..f002f01 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -38,6 +38,16 @@ do_sysctl()
+ echo $val > /proc/sys/$dev_name
+ }
+
++# Helper function to check if oprofile daemon is active.
++# Takes one argument: the "lock file" for the oprofile daemon.
++# The lock file may exist even if the daemon was killed or died in
++# some way. So we do a kill SIG_DFL to test whether the daemon is
++# truly alive. If the lock file is stale (daemon dead), the kill will
++# not return '0'.
++is_oprofiled_active()
++{
++ [ -f "$1" ] && kill -0 `cat "$1"` 2>/dev/null
++}
+
+ # check value is set
+ error_if_empty()
+@@ -355,6 +365,7 @@ do_init()
+ # location for daemon setup information
+ SETUP_DIR="/root/.oprofile"
+ SETUP_FILE="$SETUP_DIR/daemonrc"
++ SEC_SETUP_FILE="$SETUP_DIR/daemonrc_new"
+
+ # initialize daemon vars
+ decide_oprofile_device_mount
+@@ -408,6 +419,19 @@ set_event()
+ do_save_setup()
+ {
+ create_dir "$SETUP_DIR"
++ SAVE_SETUP_FILE="$SETUP_FILE"
++
++# If the daemon is currently running, we want changes to the daemon config
++# stored in the secondary cache file so that 'opcontrol --status' will
++# show actual config data for the running daemon. The next time the
++# daemon is restarted, we'll reload the config data from this secondary
++# cache file.
++
++ if is_oprofiled_active "$LOCK_FILE"; then
++ SETUP_FILE="$SEC_SETUP_FILE"
++ echo "The profiling daemon is currently active, so changes to the configuration"
++ echo "will be used the next time you restart oprofile after a --shutdown or --deinit."
++ fi
+
+ touch $SETUP_FILE
+ chmod 644 $SETUP_FILE
+@@ -451,12 +475,27 @@ do_save_setup()
+ if test "$XEN_RANGE"; then
+ echo "XEN_RANGE=$XEN_RANGE" >> $SETUP_FILE
+ fi
++ SETUP_FILE="$SAVE_SETUP_FILE"
+ }
+
+
+ # reload all the setup-related information
+ do_load_setup()
+ {
++# If a secondary setup file exists and the daemon is not running,
++# then we'll move the data from the secondary file to the actual
++# setup file to prepare for daemon startup.
++ if test -z "$SESSION_DIR"; then
++ __TMP_SESSION_DIR="/var/lib/oprofile"
++ else
++ __TMP_SESSION_DIR="$SESSION_DIR"
++ fi
++
++ if test -f "$SEC_SETUP_FILE"; then
++ is_oprofiled_active "$__TMP_SESSION_DIR/lock" \
++ || mv "$SEC_SETUP_FILE" "$SETUP_FILE"
++ fi
++
+ if test -f "$SETUP_FILE"; then
+ # load the actual information from file
+ # FIXME this is insecure, arbitrary commands could be added to
+@@ -1572,7 +1611,12 @@ do_status()
+ {
+ OPROFILED_PID=`cat $SESSION_DIR/lock 2>/dev/null`
+ if test -n "$OPROFILED_PID" -a -d "/proc/$OPROFILED_PID"; then
+- echo "Daemon running: pid $OPROFILED_PID"
++ if test "$KERNEL_SUPPORT" = yes \
++ && test 0 != $(cat /dev/oprofile/enable); then
++ echo "Daemon running: pid $OPROFILED_PID"
++ else
++ echo "Daemon paused: pid $OPROFILED_PID"
++ fi
+ else
+ echo "Daemon not running"
+ fi
diff --git a/dev-util/oprofile/metadata.xml b/dev-util/oprofile/metadata.xml
index 616f0488f72e..6aba3ff95ba5 100644
--- a/dev-util/oprofile/metadata.xml
+++ b/dev-util/oprofile/metadata.xml
@@ -3,6 +3,6 @@
<pkgmetadata>
<herd>no-herd</herd>
<maintainer>
- <email>maintainer-needed@gentoo.org</email>
+ <email>pva@gentoo.org</email>
</maintainer>
</pkgmetadata>
diff --git a/dev-util/oprofile/oprofile-0.9.6-r1.ebuild b/dev-util/oprofile/oprofile-0.9.6-r1.ebuild
new file mode 100644
index 000000000000..dd388d349b1e
--- /dev/null
+++ b/dev-util/oprofile/oprofile-0.9.6-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.6-r1.ebuild,v 1.1 2011/06/20 05:23:29 pva Exp $
+
+EAPI=4
+inherit eutils linux-info
+
+DESCRIPTION="A transparent low-overhead system-wide profiler"
+HOMEPAGE="http://oprofile.sourceforge.net"
+SRC_URI="mirror://sourceforge/oprofile/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/popt-1.7-r1
+ >=sys-devel/binutils-2.14.90.0.6-r3
+ >=sys-libs/glibc-2.3.2-r1"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ if ! linux_config_exists || ! linux_chkconfig_present OPROFILE; then
+ elog "In order for oprofile to work, you need to configure your kernel"
+ elog "with CONFIG_OPROFILE set to 'm' or 'y'."
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-mutable.patch"
+ epatch "${FILESDIR}/${P}-Ensure-that-save-only-saves-things-in-SESSION_DIR.patch"
+ epatch "${FILESDIR}/${P}-Fix-opcontrol-status-to-show-accurate-information.patch"
+ epatch "${FILESDIR}/${P}-Avoid-blindly-source-SETUP_FILE-with.patch"
+ epatch "${FILESDIR}/${P}-Add-argument-checking-for-numerical-arguments.patch"
+ epatch "${FILESDIR}/${P}-Avoid-using-bash.patch"
+ epatch "${FILESDIR}/${P}-Do-additional-checks-on-user-supplied-arguments.patch"
+}
+
+src_configure() {
+ local myconf="--with-qt-dir=/void --with-x"
+
+ case ${KV_FULL} in
+ 2.2.*|2.4.*) myconf="${myconf} --with-linux=${KV_DIR}";;
+ 2.5.*|2.6.*) myconf="${myconf} --with-kernel-support";;
+ *) die "Kernel version '${KV_FULL}' not supported";;
+ esac
+ econf ${myconf}
+}
+
+src_compile() {
+ local mymake=""
+ sed -i -e "s,depmod -a,:,g" Makefile
+ emake ${mymake} || die
+}
+
+src_install() {
+ local myinst=""
+
+ myinst="${myinst} MODINSTALLDIR=${ED}/lib/modules/${KV_FULL}"
+ make DESTDIR="${D}" ${myinst} htmldir="/usr/share/doc/${PF}" install
+
+ dodoc ChangeLog* README TODO
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == / ]] ; then
+ [[ -x /sbin/update-modules ]] && /sbin/update-modules || /sbin/modules-update
+ fi
+
+ echo
+ elog "Now load the oprofile module by running:"
+ elog " # opcontrol --init"
+ elog "Then read manpages and this html doc:"
+ elog " /usr/share/doc/${PF}/oprofile.html"
+ echo
+}
diff --git a/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild b/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild
new file mode 100644
index 000000000000..c39fe8cb1d33
--- /dev/null
+++ b/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/oprofile/oprofile-0.9.7_rc1.ebuild,v 1.1 2011/06/20 05:23:29 pva Exp $
+
+EAPI=2
+inherit eutils linux-info java-pkg-opt-2
+
+MY_P=${PN}-${PV/_/-}
+DESCRIPTION="A transparent low-overhead system-wide profiler"
+HOMEPAGE="http://oprofile.sourceforge.net"
+SRC_URI="mirror://sourceforge/oprofile/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="java pch qt4"
+
+DEPEND=">=dev-libs/popt-1.7-r1
+ >=sys-devel/binutils-2.14.90.0.6-r3
+ >=sys-libs/glibc-2.3.2-r1
+ qt4? ( x11-libs/qt-gui[qt3support] )
+ java? ( >=virtual/jdk-1.5 )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ linux-info_pkg_setup
+ if ! linux_config_exists || ! linux_chkconfig_present OPROFILE; then
+ elog "In order for oprofile to work, you need to configure your kernel"
+ elog "with CONFIG_OPROFILE set to 'm' or 'y'."
+ fi
+
+ # Required for JIT support, see README_PACKAGERS
+ enewgroup oprofile
+ enewuser oprofile -1 -1 -1 oprofile
+
+ #sed -i -e "s/depmod -a/:/g" Makefile.in
+
+ use java && java-pkg_init
+}
+
+src_configure() {
+ econf \
+ --with-kernel-support \
+ $(use_with qt4 x) \
+ $(use_enable qt4 gui qt4) \
+ $(use_enable pch) \
+ $(use_with java java ${JAVA_HOME})
+}
+
+src_install() {
+ make DESTDIR="${D}" htmldir="/usr/share/doc/${PF}" install || die
+
+ dodoc ChangeLog* README TODO
+
+ dodir /etc/env.d
+ echo "LDPATH=${PREFIX}/usr/$(get_libdir)/oprofile" > "${D}"/etc/env.d/10${PN} || die "env.d failed"
+}
+
+pkg_postinst() {
+ echo
+ elog "Now load the oprofile module by running:"
+ elog " # opcontrol --init"
+ elog "Then read manpages and this html doc:"
+ elog " /usr/share/doc/${PF}/oprofile.html"
+ echo
+}