Skip to content

Commit 140feb0

Browse files
auREAXgraydon
authored andcommitted
---
yaml --- r: 33063 b: refs/heads/dist-snap c: 0bb437a h: refs/heads/master i: 33061: 0ab4de0 33059: f8bca34 33055: 444dc0d v: v3
1 parent ec8c9cb commit 140feb0

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 5585514c02b1f7c7df2503e3e75814994ccdb8b7
10+
refs/heads/dist-snap: 0bb437aafad7f96ef47e93e299878a60f959821e
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/configure

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ opt manage-submodules 1 "let the build manage the git submodules"
295295
opt mingw-cross 0 "cross-compile for win32 using mingw"
296296
opt clang 0 "prefer clang to gcc for building the runtime"
297297
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
298+
opt pax-marks 0 "apply PaX markings to rustc binaries (required for GRSecurity/PaX-patched kernels)"
298299
valopt prefix "/usr/local" "set installation prefix"
299300
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
300301
valopt llvm-root "" "set LLVM root"
@@ -343,6 +344,8 @@ probe CFG_PDFLATEX pdflatex
343344
probe CFG_XETEX xetex
344345
probe CFG_LUATEX luatex
345346
probe CFG_NODE nodejs node
347+
probe CFG_PAXCTL paxctl /sbin/paxctl
348+
probe CFG_ZCAT zcat
346349

347350
if [ ! -z "$CFG_PANDOC" ]
348351
then
@@ -354,6 +357,52 @@ then
354357
fi
355358
fi
356359

360+
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
361+
then
362+
if [ ! -z "$CFG_ENABLE_PAX_MARKS" -a -z "$CFG_PAXCTL" ]
363+
then
364+
err "enabled PaX markings but no paxctl binary found"
365+
fi
366+
367+
if [ -z "$CFG_DISABLE_PAX_MARKS" ]
368+
then
369+
# GRSecurity/PaX detection. This can be very flaky.
370+
GRSEC_DETECTED=
371+
372+
# /dev/grsec only exists if CONFIG_GRKERNSEC_NO_RBAC is not set.
373+
# /proc is normally only available to root and users in the CONFIG_GRKERNSEC_PROC_GID group,
374+
# and /proc/sys/kernel/grsecurity is not available if ÇONFIG_GRKERNSEC_SYSCTL is not set.
375+
if [ -e /dev/grsec -o -d /proc/sys/kernel/grsecurity ]
376+
then
377+
GRSEC_DETECTED=1
378+
# /proc/config.gz is normally only available to root, and only if CONFIG_IKCONFIG_PROC has been set.
379+
elif [ -r /proc/config.gz -a ! -z "$CFG_ZCAT" ]
380+
then
381+
if "$CFG_ZCAT" /proc/config.gz | grep --quiet "CONFIG_GRKERNSEC=y"
382+
then
383+
GRSEC_DETECTED=1
384+
fi
385+
# Flaky.
386+
elif grep --quiet grsec /proc/version
387+
then
388+
GRSEC_DETECTED=1
389+
fi
390+
391+
if [ ! -z "$GRSEC_DETECTED" ]
392+
then
393+
step_msg "GRSecurity: yes"
394+
if [ ! -z "$CFG_PAXCTL" ]
395+
then
396+
CFG_ENABLE_PAX_MARKS=1
397+
else
398+
warn "GRSecurity kernel detected but no paxctl binary found: not setting CFG_ENABLE_PAX_MARKS"
399+
fi
400+
else
401+
step_msg "GRSecurity: no"
402+
fi
403+
fi
404+
fi
405+
357406
if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ]
358407
then
359408
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
@@ -699,6 +748,12 @@ putvar CFG_C_COMPILER
699748
putvar CFG_LIBDIR
700749
putvar CFG_DISABLE_MANAGE_SUBMODULES
701750

751+
if [ ! -z "$CFG_ENABLE_PAX_MARKS" ]
752+
then
753+
putvar CFG_ENABLE_PAX_MARKS
754+
putvar CFG_PAXCTL
755+
fi
756+
702757
if [ ! -z $BAD_PANDOC ]
703758
then
704759
CFG_PANDOC=

branches/dist-snap/mk/stage0.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ ifdef CFG_ENABLE_LOCAL_RUST
1212
$(Q)$(S)src/etc/local_stage0.sh $(CFG_HOST_TRIPLE) $(CFG_LOCAL_RUST_ROOT)
1313
else
1414
$(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(SNAPSHOT_FILE)
15+
ifdef CFG_ENABLE_PAX_MARKS
16+
@$(call E, apply PaX markings: $@)
17+
@"$(CFG_PAXCTL)" -cm "$@"
18+
endif
1519
endif
1620
$(Q)touch $@
1721

branches/dist-snap/mk/target.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
2929
$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
3030
@$$(call E, compile_and_link: $$@)
3131
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$<
32+
ifdef CFG_ENABLE_PAX_MARKS
33+
@$$(call E, apply PaX markings: $$@)
34+
@"$(CFG_PAXCTL)" -cm "$$@"
35+
endif
3236

3337
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
3438
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \

0 commit comments

Comments
 (0)