Skip to content

Commit 5ea0686

Browse files
[CI] Setup Daemonset to Modify ASLR Sysctl Values (#490)
This patch adds a Daemonset to the clusters that will perform the necessary sysctl call to adjust the vm.mmap_rnd_bits value. This is necessary to pass the libcxx msan and tsan tests. The daemonset is currently only setup on the libcxx nodes as we have not needed to configure the values anywhere else so far. We cannot do this in a startup script because GKE uses the GCE VM instance startup script options to run its own configuration. We also cannot just the GKE system configuration as it does not have support for setting vm.mmap_rnd_bits. A privileged daemonset works just fine.
1 parent 0ba2d0f commit 5ea0686

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

premerge/premerge_resources/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,7 @@ resource "helm_release" "grafana-k8s-monitoring" {
315315

316316
depends_on = [kubernetes_namespace.grafana]
317317
}
318+
319+
resource "kubernetes_manifest" "sysctl-daemonset" {
320+
manifest = yamldecode(file("sysctl_daemonset.yaml"))
321+
}

premerge/sysctl_daemonset.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: sysctl-config-ds
5+
namespace: kube-system
6+
labels:
7+
k8s-app: sysctl-config
8+
spec:
9+
selector:
10+
matchLabels:
11+
name: sysctl-config
12+
template:
13+
metadata:
14+
labels:
15+
name: sysctl-config
16+
spec:
17+
nodeSelector:
18+
cloud.google.com/gke-nodepool: llvm-premerge-libcxx
19+
containers:
20+
- name: sysctl-configure-init
21+
image: alpine
22+
command:
23+
- /bin/sh
24+
- -c
25+
- |
26+
sysctl vm.mmap_rnd_bits=28 \
27+
&& sleep 31536000000
28+
# the sleep is basically forever, to prevent DaemonSet termination
29+
securityContext:
30+
runAsUser: 0
31+
privileged: true
32+
readOnlyRootFilesystem: false
33+
allowPrivilegeEscalation: true

0 commit comments

Comments
 (0)