|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
From da8ea517105fff702f936695dcfae844ac85260d Mon Sep 17 00:00:00 2001
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
From: Natanael Copa <ncopa@alpinelinux.org>
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
Date: Tue, 23 Feb 2016 10:16:54 +0000
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
Subject: [PATCH 7/7] Enable stack protector by default for alpine linux
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
lib/Driver/ToolChains.cpp | 7 +++++++
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
lib/Driver/ToolChains.h | 1 +
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
test/Driver/stack-protector.c | 14 ++++++++++++++
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
3 files changed, 22 insertions(+)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
diff
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
index 1a8ebf5..59b7601 100644
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
@@ -4193,6 +4193,13 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
ToolChain::addProfileRTLibs(Args, CmdArgs);
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
}
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+ StringRef VendorName = Linux::getTriple().getVendorName();
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+ if (VendorName.compare("alpine") == 0)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+ return 2;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+ return 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+}
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple,
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
diff
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
index f940e58..977ea66 100644
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
@@ -796,6 +796,7 @@ public:
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
llvm::opt::ArgStringList &CC1Args) const override;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
bool isPIEDefault() const override;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
SanitizerMask getSupportedSanitizers() const override;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
void addProfileRTLibs(const llvm::opt::ArgList &Args,
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
llvm::opt::ArgStringList &CmdArgs) const override;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
index 487af56..2fbd39a 100644
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+++ b/test/Driver/stack-protector.c
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
@@ -24,6 +24,20 @@
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
// SSP-ALL: "-stack-protector" "3"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
// SSP-ALL-NOT: "-stack-protector-buffer-size"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// RUN: %clang -target x86_64-alpine-linux-musl -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE: "-stack-protector" "2"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE_SPS: "-stack-protector" "2"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector-all -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE_ALL: "-stack-protector" "3"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE_ALL-NOT: "-stack-protector-buffer-size"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// RUN: %clang -target x86_64-alpine-linux-musl -fno-stack-protector -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE_NOSSP-NOT: "-stack-protector"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+// ALPINE_NOSSP-NOT: "-stack-protector-buffer-size"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
+
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
// RUN: %clang -target x86_64-scei-ps4 -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
// RUN: %clang -target x86_64-scei-ps4 -fstack-protector -
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
// SSP-PS4: "-stack-protector" "2"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
--
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
2.7.3
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
585426 |
|