[PATCH] libbbb: mark stack in assembly files read-only

Ludwig Nussel ludwig.nussel at suse.de
Thu Aug 25 10:48:07 UTC 2022


Signed-off-by: Ludwig Nussel <ludwig.nussel at suse.de>
---
 libbb/hash_md5_sha256_x86-32_shaNI.S | 3 +++
 libbb/hash_md5_sha256_x86-64_shaNI.S | 3 +++
 libbb/hash_md5_sha_x86-32_shaNI.S    | 3 +++
 libbb/hash_md5_sha_x86-64.S          | 3 +++
 libbb/hash_md5_sha_x86-64.S.sh       | 3 +++
 libbb/hash_md5_sha_x86-64_shaNI.S    | 3 +++
 6 files changed, 18 insertions(+)

diff --git a/libbb/hash_md5_sha256_x86-32_shaNI.S b/libbb/hash_md5_sha256_x86-32_shaNI.S
index 3905bad9a..5b79e847b 100644
--- a/libbb/hash_md5_sha256_x86-32_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-32_shaNI.S
@@ -19,6 +19,9 @@
 // We do not check SSSE3 in cpuid,
 // all SHA-capable CPUs support it as well.
 
+#ifdef __linux__
+	.section	.note.GNU-stack,"", at progbits
+#endif
 	.section	.text.sha256_process_block64_shaNI, "ax", @progbits
 	.globl	sha256_process_block64_shaNI
 	.hidden	sha256_process_block64_shaNI
diff --git a/libbb/hash_md5_sha256_x86-64_shaNI.S b/libbb/hash_md5_sha256_x86-64_shaNI.S
index 082ceafe4..f89abb91a 100644
--- a/libbb/hash_md5_sha256_x86-64_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-64_shaNI.S
@@ -19,6 +19,9 @@
 // We do not check SSSE3 in cpuid,
 // all SHA-capable CPUs support it as well.
 
+#ifdef __linux__
+	.section	.note.GNU-stack,"", at progbits
+#endif
 	.section	.text.sha256_process_block64_shaNI, "ax", @progbits
 	.globl	sha256_process_block64_shaNI
 	.hidden	sha256_process_block64_shaNI
diff --git a/libbb/hash_md5_sha_x86-32_shaNI.S b/libbb/hash_md5_sha_x86-32_shaNI.S
index 2366b046a..3ef2b8469 100644
--- a/libbb/hash_md5_sha_x86-32_shaNI.S
+++ b/libbb/hash_md5_sha_x86-32_shaNI.S
@@ -25,6 +25,9 @@
 // We do not check SSSE3/SSE4.1 in cpuid,
 // all SHA-capable CPUs support them as well.
 
+#ifdef __linux__
+	.section	.note.GNU-stack,"", at progbits
+#endif
 	.section	.text.sha1_process_block64_shaNI, "ax", @progbits
 	.globl	sha1_process_block64_shaNI
 	.hidden	sha1_process_block64_shaNI
diff --git a/libbb/hash_md5_sha_x86-64.S b/libbb/hash_md5_sha_x86-64.S
index 1d55b91f8..2e8a0cfcd 100644
--- a/libbb/hash_md5_sha_x86-64.S
+++ b/libbb/hash_md5_sha_x86-64.S
@@ -1,6 +1,9 @@
 ### Generated by hash_md5_sha_x86-64.S.sh ###
 
 #if CONFIG_SHA1_SMALL == 0 && defined(__GNUC__) && defined(__x86_64__)
+#ifdef __linux__
+	.section	.note.GNU-stack,"", at progbits
+#endif
 	.section	.text.sha1_process_block64, "ax", @progbits
 	.globl	sha1_process_block64
 	.hidden	sha1_process_block64
diff --git a/libbb/hash_md5_sha_x86-64.S.sh b/libbb/hash_md5_sha_x86-64.S.sh
index 40c979d35..2eab1c0ba 100755
--- a/libbb/hash_md5_sha_x86-64.S.sh
+++ b/libbb/hash_md5_sha_x86-64.S.sh
@@ -127,6 +127,9 @@ echo \
 "### Generated by hash_md5_sha_x86-64.S.sh ###
 
 #if CONFIG_SHA1_SMALL == 0 && defined(__GNUC__) && defined(__x86_64__)
+#ifdef __linux__
+	.section	.note.GNU-stack,\"\", at progbits
+#endif
 	.section	.text.sha1_process_block64, \"ax\", @progbits
 	.globl	sha1_process_block64
 	.hidden	sha1_process_block64
diff --git a/libbb/hash_md5_sha_x86-64_shaNI.S b/libbb/hash_md5_sha_x86-64_shaNI.S
index 794e97040..97435e3c2 100644
--- a/libbb/hash_md5_sha_x86-64_shaNI.S
+++ b/libbb/hash_md5_sha_x86-64_shaNI.S
@@ -25,6 +25,9 @@
 // We do not check SSSE3/SSE4.1 in cpuid,
 // all SHA-capable CPUs support them as well.
 
+#ifdef __linux__
+	.section	.note.GNU-stack,"", at progbits
+#endif
 	.section	.text.sha1_process_block64_shaNI, "ax", @progbits
 	.globl	sha1_process_block64_shaNI
 	.hidden	sha1_process_block64_shaNI
-- 
2.37.2



More information about the busybox mailing list