[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 2/3] build: Add option to toggle the stack protection


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Wed, 4 Dec 2019 15:14:37 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DyqjwRMD4+NsU7RfO/cgqoPXVIlX2QhvmYVtnWcIMpU=; b=iaxK5lca0RasmD1SaIrjGpfkAxiZ5ntbdYQEhjQen9ER++cF7LsW6ODl7rqXINQWj0IEvOH3X/cXcywRrUFm8Xen0P/16g+bws/zSGZVOjagY4K3zdLnkVOmzF7ovAaTrix1h8xoe14xRp9THcfH2ngjwQEa7TDMuGqQDQDmUFreO4xcFaz/VHCITWxrJao3P1JT6hqqKBvkIWZuecPnGDtwezcauc8TgFQYzXikfzNVetISGzx2AHdZVo2TkO6fYx5C5wcG6+l/pjLPR1KqJ3+cSsOs3fj1eKcSwb/d2ghozYO2zBflwQvsm6lwm/MVcivUpkza9uBCyFt12He4NQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RyC8GC8JVyas3nsnLi3cr3t2JrL56svWTntQywdK22P18ducguTd23hwvG/2I/ToE2vlljU/MfrOGzXj2aK6QMr8KnQyToc2BO6PK3vnjd79o9+F+bQJj6dDkS87WcWGiHCnxPmXB4KF+AYiJoG3PMp450KxIBvEfIu6xt3Ccln/zk869ARzqOMPNy6gZDaQnxsoaGzSBSSqFLtYiZg54qceM4dKfNebHsLiV+z5opxjKkcNEeyueTFd0dZGBAunERCIetaA0MB5mK9qUjSY2exCIZchPh4n3gbzzr6vNQIh0Pw4+TrmFHXUOQ/MMtw+T3M/3kFYVrANAJdeBCqL0g==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "felipe.huici@xxxxxxxxx" <felipe.huici@xxxxxxxxx>, "simon.kuenzer@xxxxxxxxx" <simon.kuenzer@xxxxxxxxx>, Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>, "sharan.santhanam@xxxxxxxxx" <sharan.santhanam@xxxxxxxxx>, "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>
  • Delivery-date: Wed, 04 Dec 2019 15:14:52 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVqrWLgxTiOKNXmEO3L8MGGCZxlw==
  • Thread-topic: [UNIKRAFT PATCH v3 2/3] build: Add option to toggle the stack protection

From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

This patch adds build option to select different stack protection
levels.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 Config.uk   | 30 ++++++++++++++++++++++++++++++
 Makefile.uk | 13 +++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/Config.uk b/Config.uk
index 3235b914..daa76c53 100644
--- a/Config.uk
+++ b/Config.uk
@@ -64,6 +64,36 @@ config OPTIMIZE_SIZE
                Optimize code for size.
 endchoice
 
+choice
+       prompt "Stack protector level"
+       default STACKPROTECTOR_NONE
+       help
+         Set the stack protector level
+
+config STACKPROTECTOR_NONE
+       bool "None"
+       help
+               Do not use stack protector, use -fno-stack-protector.
+
+config STACKPROTECTOR_REGULAR
+       bool "Regular"
+       select LIBUKSP
+       help
+               Regulat stack protector, use -fstack-protector.
+
+config STACKPROTECTOR_STRONG
+       bool "Strong"
+       select LIBUKSP
+       help
+               Strong stack protector, use -fstack-protector-strong.
+
+config STACKPROTECTOR_ALL
+       bool "All"
+       select LIBUKSP
+       help
+               Protect all functions, use -fstack-protector-all.
+endchoice
+
 comment "Hint: Specify a CPU type to get most benefits from performance 
optimization"
        depends on OPTIMIZE_PERF && (MARCH_X86_64_GENERIC || 
MARCH_ARM64_GENERIC)
 
diff --git a/Makefile.uk b/Makefile.uk
index 67c372e5..d8138d4c 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -8,12 +8,12 @@ ASFLAGS     += -U __linux__ -U __FreeBSD__ -U __sun__ 
-D__ASSEMBLY__
 ASINCLUDES  += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include
 
 CFLAGS      += -U __linux__ -U __FreeBSD__ -U __sun__
-CFLAGS      += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
+CFLAGS      += -fno-omit-frame-pointer -fno-tree-sra
 CFLAGS      += -Wall -Wextra
 CINCLUDES   += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include
 
 CXXFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__
-CXXFLAGS    += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
+CXXFLAGS    += -fno-omit-frame-pointer -fno-tree-sra
 CXXFLAGS    += -Wall -Wextra
 CXXINCLUDES += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include
 
@@ -28,6 +28,15 @@ GOCINCLUDES += -nostdinc -nostdlib 
-I$(CONFIG_UK_BASE)/include
 LIBLDFLAGS  += -nostdinc -nostdlib -Wl,--omagic -Wl,-r -Wl,-d 
-Wl,--build-id=none
 LDFLAGS     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
 
+CFLAGS-$(CONFIG_STACKPROTECTOR_NONE)      += -fno-stack-protector
+CXXFLAGS-$(CONFIG_STACKPROTECTOR_NONE)    += -fno-stack-protector
+CFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)   += -fstack-protector 
-mstack-protector-guard=global
+CXXFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR) += -fstack-protector 
-mstack-protector-guard=global
+CFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)    += -fstack-protector-strong 
-mstack-protector-guard=global
+CXXFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)  += -fstack-protector-strong 
-mstack-protector-guard=global
+CFLAGS-$(CONFIG_STACKPROTECTOR_ALL)       += -fstack-protector-all 
-mstack-protector-guard=global
+CXXFLAGS-$(CONFIG_STACKPROTECTOR_ALL)     += -fstack-protector-all 
-mstack-protector-guard=global
+
 CFLAGS-$(CONFIG_OPTIMIZE_NONE)            += -O0 -fno-optimize-sibling-calls 
-fno-tree-vectorize
 CXXFLAGS-$(CONFIG_OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls 
-fno-tree-vectorize
 GOCFLAGS-$(CONFIG_OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls 
-fno-tree-vectorize
-- 
2.20.1

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.