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

Kp <[email protected]> Sun, 1 Jun 2008 11:53:36 -0500
Newsgroups gmane.network.silc.devel
Message-ID <[email protected]>
The silc 1.1 branch contains handwritten assembly in 
lib/silccrypt/aes_x86_64.asm to provide an optimized version of AES for 
AMD64 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.

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, 965 B)
From 022fdf5b330a2c97f26b84b5edcfeddda8b280fb Mon Sep 17 00:00:00 2001
From: [email protected] <[email protected]>
Date: Sun, 27 Apr 2008 15:23:37 -0500
Subject: [PATCH] Add .note.GNU-stack to suppress executable stack in x86_64 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_64.asm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/silccrypt/aes_x86_64.asm b/lib/silccrypt/aes_x86_64.asm
index 1ac3c92..8f346ba 100644
--- a/lib/silccrypt/aes_x86_64.asm
+++ b/lib/silccrypt/aes_x86_64.asm
@@ -864,3 +864,7 @@ aes_decrypt:
 %endif
 
     end
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
-- 
1.5.5.1