Bug 752139 - Mark stacks non-executable in the libtheora ARM asm. r=glandium
authorTimothy B. Terriberry <tterribe@vt.edu>
Sat, 05 May 2012 12:43:26 -0400
changeset 93299 7a7c6d1e67e00fd1e712cdcdfcb939c01c3ba9a4
parent 93298 dbc45d173470743bbd9ad5414f8c581449d7c350
child 93300 94ce5f33a9ea3ec93325e484f3c12d1b882554b9
push id22622
push userryanvm@gmail.com
push dateSun, 06 May 2012 03:08:51 +0000
treeherdermozilla-central@94ce5f33a9ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs752139
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 752139 - Mark stacks non-executable in the libtheora ARM asm. r=glandium
media/libtheora/bug752139-r18031.patch
media/libtheora/lib/arm/arm2gnu.pl
media/libtheora/update.sh
new file mode 100644
--- /dev/null
+++ b/media/libtheora/bug752139-r18031.patch
@@ -0,0 +1,53 @@
+diff --git a/media/libtheora/lib/arm/arm2gnu.pl b/media/libtheora/lib/arm/arm2gnu.pl
+--- a/media/libtheora/lib/arm/arm2gnu.pl
++++ b/media/libtheora/lib/arm/arm2gnu.pl
+@@ -1,11 +1,14 @@
+ #!/usr/bin/perl
+ 
+ my $bigend;  # little/big endian
++my $nxstack;
++
++$nxstack = 0;
+ 
+ eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
+     if $running_under_some_shell;
+ 
+ while ($ARGV[0] =~ /^-/) {
+     $_ = shift;
+   last if /^--/;
+     if (/^-n/) {
+@@ -77,16 +80,19 @@ while (<>) {
+     if ( /\bMEND\b/ ) {
+       s/\bMEND\b/.endm/;
+       $n=0;
+     }
+ 
+     # ".rdata" doesn't work in 'as' version 2.13.2, as it is ".rodata" there.
+     #
+     if ( /\bAREA\b/ ) {
++        if ( /CODE/ ) {
++            $nxstack = 1;
++        }
+         s/^(.+)CODE(.+)READONLY(.*)/    .text/;
+         s/^(.+)DATA(.+)READONLY(.*)/    .section .rdata\n    .align 2/;
+         s/^(.+)\|\|\.data\|\|(.+)/    .data\n    .align 2/;
+         s/^(.+)\|\|\.bss\|\|(.+)/    .bss/;
+     }
+ 
+     s/\|\|\.constdata\$(\d+)\|\|/.L_CONST$1/;       # ||.constdata$3||
+     s/\|\|\.bss\$(\d+)\|\|/.L_BSS$1/;               # ||.bss$2||
+@@ -263,9 +269,13 @@ while (<>) {
+ } continue {
+     printf ("%s", $_) if $printit;
+     if ($addPadding != 0)
+     {
+         printf ("   mov r0,r0\n");
+         $addPadding = 0;
+     }
+ }
+-
++#If we had a code section, mark that this object doesn't need an executable
++# stack.
++if ($nxstack) {
++    printf ("    .section\t.note.GNU-stack,\"\",\%\%progbits\n");
++}
--- a/media/libtheora/lib/arm/arm2gnu.pl
+++ b/media/libtheora/lib/arm/arm2gnu.pl
@@ -1,11 +1,14 @@
 #!/usr/bin/perl
 
 my $bigend;  # little/big endian
+my $nxstack;
+
+$nxstack = 0;
 
 eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
     if $running_under_some_shell;
 
 while ($ARGV[0] =~ /^-/) {
     $_ = shift;
   last if /^--/;
     if (/^-n/) {
@@ -77,16 +80,19 @@ while (<>) {
     if ( /\bMEND\b/ ) {
       s/\bMEND\b/.endm/;
       $n=0;
     }
 
     # ".rdata" doesn't work in 'as' version 2.13.2, as it is ".rodata" there.
     #
     if ( /\bAREA\b/ ) {
+        if ( /CODE/ ) {
+            $nxstack = 1;
+        }
         s/^(.+)CODE(.+)READONLY(.*)/    .text/;
         s/^(.+)DATA(.+)READONLY(.*)/    .section .rdata\n    .align 2/;
         s/^(.+)\|\|\.data\|\|(.+)/    .data\n    .align 2/;
         s/^(.+)\|\|\.bss\|\|(.+)/    .bss/;
     }
 
     s/\|\|\.constdata\$(\d+)\|\|/.L_CONST$1/;       # ||.constdata$3||
     s/\|\|\.bss\$(\d+)\|\|/.L_BSS$1/;               # ||.bss$2||
@@ -263,9 +269,13 @@ while (<>) {
 } continue {
     printf ("%s", $_) if $printit;
     if ($addPadding != 0)
     {
         printf ("   mov r0,r0\n");
         $addPadding = 0;
     }
 }
-
+#If we had a code section, mark that this object doesn't need an executable
+# stack.
+if ($nxstack) {
+    printf ("    .section\t.note.GNU-stack,\"\",\%\%progbits\n");
+}
--- a/media/libtheora/update.sh
+++ b/media/libtheora/update.sh
@@ -75,8 +75,9 @@ cp $1/lib/x86_vc/x86cpu.h ./lib/x86_vc/
 cp $1/lib/x86_vc/x86int.h ./lib/x86_vc/
 cp $1/lib/x86_vc/x86state.c ./lib/x86_vc/
 cp $1/include/theora/theora.h ./include/theora/theora.h
 cp $1/include/theora/theoradec.h ./include/theora/theoradec.h
 cp $1/include/theora/theoraenc.h ./include/theora/theoraenc.h
 cp $1/include/theora/codec.h ./include/theora/codec.h
 patch -p3 < ./bug625773-r17780.patch
 patch -p3 < ./bug468275-r18219.patch
+patch -p3 < ./bug752139-r18031.patch