packages/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch
Jo-Philipp Wich f73e358558 perl: ensure File::Spec::canonpath() preserves taint [CVE-2015-8607]
Beginning in PathTools 3.47 and/or perl 5.20.0, the File::Spec::canonpath()
routine returned untained strings even if passed tainted input. This defect
undermines the guarantee of taint propagation, which is sometimes used to
ensure that unvalidated user input does not reach sensitive code.

This defect was found and reported by David Golden of MongoDB, and a patch
was provided by Tony Cook.

References:

 * https://rt.perl.org/Public/Bug/Display.html?id=126862
 * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8607

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-14 12:17:56 +01:00

81 lines
2.4 KiB
Diff

perl: Skip $0 test on busybox
This test requires a ps which provides the -f option, as well as suitable output.
We can't provide either with busybox. Just skip it for now.
Signed-off-by: Marcel Denia <naoir@gmx.net>
--- a/dist/threads/t/join.t
+++ b/dist/threads/t/join.t
@@ -110,36 +110,41 @@ sub skip {
# We parse ps output so this is OS-dependent.
if ($^O eq 'linux') {
- # First modify $0 in a subthread.
- #print "# mainthread: \$0 = $0\n";
- threads->create(sub{ #print "# subthread: \$0 = $0\n";
- $0 = "foobar";
- #print "# subthread: \$0 = $0\n"
- })->join;
- #print "# mainthread: \$0 = $0\n";
- #print "# pid = $$\n";
- if (open PS, "ps -f |") { # Note: must work in (all) systems.
- my ($sawpid, $sawexe);
- while (<PS>) {
- chomp;
- #print "# [$_]\n";
- if (/^\s*\S+\s+$$\s/) {
- $sawpid++;
- if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
- $sawexe++;
- }
- last;
- }
- }
- close PS or die;
- if ($sawpid) {
- ok($sawpid && $sawexe, 'altering $0 is effective');
- } else {
- skip("\$0 check: did not see pid $$ in 'ps -f |'");
- }
- } else {
- skip("\$0 check: opening 'ps -f |' failed: $!");
- }
+ if (readlink('/bin/ps') ne 'busybox') {
+ # First modify $0 in a subthread.
+ #print "# mainthread: \$0 = $0\n";
+ threads->create(sub{ #print "# subthread: \$0 = $0\n";
+ $0 = "foobar";
+ #print "# subthread: \$0 = $0\n"
+ })->join;
+ #print "# mainthread: \$0 = $0\n";
+ #print "# pid = $$\n";
+ if (open PS, "ps -f |") { # Note: must work in (all) systems.
+ my ($sawpid, $sawexe);
+ while (<PS>) {
+ chomp;
+ #print "# [$_]\n";
+ if (/^\s*\S+\s+$$\s/) {
+ $sawpid++;
+ if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
+ $sawexe++;
+ }
+ last;
+ }
+ }
+ close PS or die;
+ if ($sawpid) {
+ ok($sawpid && $sawexe, 'altering $0 is effective');
+ } else {
+ skip("\$0 check: did not see pid $$ in 'ps -f |'");
+ }
+ } else {
+ skip("\$0 check: opening 'ps -f |' failed: $!");
+ }
+ }
+ else {
+ skip("\$0 check: incompatible with busybox");
+ }
} else {
skip("\$0 check: only on Linux");
}