|
| 1 | +# pbuilder specific vars |
| 2 | +DISTRIBUTION=buster |
| 3 | +BUILDRESULT=debs |
| 4 | +BUILDPLACE=builder/build |
| 5 | +BASEPATH=builder/base.cow |
| 6 | +APTCACHE="$(pwd)/builder/aptcache" |
| 7 | +MIRRORSITE=http://deb.debian.org/debian/ |
| 8 | +OTHERMIRROR="deb http://security.debian.org/ buster/updates main|deb http://deb.debian.org/debian buster-updates main|deb http://http.debian.net/debian buster-backports main" |
| 9 | +HOOKDIR=hooks |
| 10 | +EATMYDATA=yes |
| 11 | +DEBBUILDOPTS="--build=binary" # Builds the architecture specific binary packages |
| 12 | +EXTRAPACKAGES="clang-8 lld-8 llvm-8-dev" |
| 13 | +#APTCONFDIR="" |
| 14 | +#NO_COWDANCER_UPDATE=1 |
| 15 | +#DEBOOTSTRAPOPTS="" |
| 16 | + |
| 17 | +# pbuilder undocumented vars... |
| 18 | +BIN_NMU=yes |
| 19 | +BINNMU_MESSAGE="rebuild with clang and hardening options" |
| 20 | +BINNMU_MAINTAINER="Paul Grandperrin < [email protected]>" |
| 21 | +BINNMU_VERSION="hardened1" |
| 22 | +#BINARY_ARCH=binary |
| 23 | + |
| 24 | +# dpkg-buildpackage specific vars |
| 25 | +#export DEB_VENDOR ? |
| 26 | +export DEB_BUILD_PROFILES="nocheck nodoc noudeb nobiarch" |
| 27 | +export DEB_BUILD_OPTIONS="nocheck nodoc hardening=+all" |
| 28 | + |
| 29 | +# Toolchain selection |
| 30 | +export CC=clang |
| 31 | +export CPP=clang-cpp |
| 32 | +export CXX=clang++ |
| 33 | +export LD=lld |
| 34 | + |
| 35 | +# Toolchain flags |
| 36 | +FLAGS="$FLAGS -flto -fPIE -fPIC -pie" |
| 37 | + |
| 38 | +# Safe Stack |
| 39 | +FLAGS="$FLAGS -fsanitize=safe-stack" |
| 40 | + |
| 41 | +# CFI |
| 42 | +#FLAGS="$FLAGS -fvisibility=hidden" # if it fails, use default |
| 43 | +FLAGS="$FLAGS -fvisibility=default" |
| 44 | +FLAGS="$FLAGS -fsanitize=cfi-cast-strict" |
| 45 | +FLAGS="$FLAGS -fsanitize=cfi-derived-cast" |
| 46 | +FLAGS="$FLAGS -fsanitize=cfi-unrelated-cast" |
| 47 | +FLAGS="$FLAGS -fsanitize=cfi-nvcall" |
| 48 | +FLAGS="$FLAGS -fsanitize=cfi-vcall" |
| 49 | +FLAGS="$FLAGS -fsanitize=cfi-icall" # if it fails, try with -fsanitize-cfi-icall-generalize-pointers (incompat with cross-dso) and -fno-sanitize-cfi-canonical-jump-tables or replace with -fsanitize=function (slower, included in -fsanitize=undefined) |
| 50 | +FLAGS="$FLAGS -fsanitize=cfi-mfcall" |
| 51 | + |
| 52 | +# UBSAN |
| 53 | +FLAGS="$FLAGS -fsanitize-trap=integer" |
| 54 | +FLAGS="$FLAGS -fsanitize-trap=nullability" |
| 55 | +FLAGS="$FLAGS -fsanitize-trap=function" |
| 56 | +FLAGS="$FLAGS -fsanitize-trap=bounds" |
| 57 | +FLAGS="$FLAGS -fsanitize-trap=pointer-overflow" |
| 58 | + |
| 59 | +# customize dpkg-buildflags |
| 60 | +export DEB_CFLAGS_APPEND="$FLAGS" |
| 61 | +export DEB_CXXFLAGS_APPEND="$FLAGS" |
| 62 | +export DEB_LDFLAGS_APPEND="$FLAGS" |
0 commit comments