[PATCH] Add .note.GNU-stack to suppress executable stack in x86_32 assembly.

Kp <[email protected]> Sat, 10 May 2008 12:30:25 -0500
Newsgroups gmane.network.silc.devel
Message-ID <[email protected]>
Hello,

The silc 1.1 branch contains handwritten assembly in 
lib/silccrypt/aes_x86.asm to provide an optimized version of AES for 
IA32 CPUs.  However, this file does not include a .note.GNU-stack 
marker.  The GNU toolchain uses the presence of the .note.GNU-stack 
marker to decide whether a file requires an executable stack.  If no 
such marker is present, it assumes that an executable stack is required. 
  This patch adds a marker to inform the toolchain that the stack should 
be non-executable.  This patch is based on silc.1.1.branch.  I have run 
silc for many weeks with the executable stack disabled and have seen no 
problems.

The attached patch should be suitable for direct consumption with git am.

_______________________________________________________________________
Info:    https://lists.silcnet.org/mailman/listinfo/silc-announce
Archive: https://lists.silcnet.org/pipermail/silc-announce
FAQ:     http://silcnet.org/support/faq/
0001-Add-.note.GNU-stack-to-suppress-executable-stack-in.patch (text/plain, 948 B)
From 2c119b1edf27557c29c75e1d6e3c84e2ed40389a Mon Sep 17 00:00:00 2001
From: Kp <[email protected]>
Date: Sun, 27 Apr 2008 15:05:14 -0500
Subject: [PATCH] Add .note.GNU-stack to suppress executable stack in x86_32 assembly.

The GNU toolchain uses the presence of the .note.GNU-stack marker to
decide whether a file requires an executable stack.  If no such marker
is present, it assumes that an executable stack is required.  Add a
marker to inform the toolchain that the stack should be non-executable.
---
 lib/silccrypt/aes_x86.asm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/silccrypt/aes_x86.asm b/lib/silccrypt/aes_x86.asm
index cb426a1..2742c1c 100644
--- a/lib/silccrypt/aes_x86.asm
+++ b/lib/silccrypt/aes_x86.asm
@@ -595,3 +595,7 @@ stk_spc equ    20   ; stack space
 %endif
 
     end
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
-- 
1.5.3.7