瀏覽代碼

utils/genrandconfig: test full set of hardening options

This patch adds the remaining ssp and relro cases plus both of the
fortify options. The randomization was left consistant between the
options but the order of the conditions placed the most restrictive
hardening options with more priority.

Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Matt Weber 5 年之前
父節點
當前提交
17eb6ae92a
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      utils/genrandconfig

+ 10 - 0
utils/genrandconfig

@@ -370,8 +370,18 @@ def gen_config(args):
         configlines.append("BR2_PIC_PIE=y\n")
         configlines.append("BR2_PIC_PIE=y\n")
     if randint(0, 4) == 0:
     if randint(0, 4) == 0:
         configlines.append("BR2_RELRO_FULL=y\n")
         configlines.append("BR2_RELRO_FULL=y\n")
+    elif randint(0, 4) == 0:
+        configlines.append("BR2_RELRO_PARTIAL=y\n")
     if randint(0, 4) == 0:
     if randint(0, 4) == 0:
         configlines.append("BR2_SSP_ALL=y\n")
         configlines.append("BR2_SSP_ALL=y\n")
+    elif randint(0, 4) == 0:
+        configlines.append("BR2_SSP_REGULAR=y\n")
+    elif randint(0, 4) == 0:
+        configlines.append("BR2_SSP_STRONG=y\n")
+    if randint(0, 4) == 0:
+        configlines.append("BR2_FORTIFY_SOURCE_2=y\n")
+    elif randint(0, 4) == 0:
+        configlines.append("BR2_FORTIFY_SOURCE_1=y\n")
 
 
     # Randomly enable BR2_REPRODUCIBLE 10% of times
     # Randomly enable BR2_REPRODUCIBLE 10% of times
     # also enable tar filesystem images for testing
     # also enable tar filesystem images for testing