Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #73550

Merged
merged 27 commits into from
Jun 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ebe5a91
Properly encode AnonConst into crate metadata
Aaron1011 May 26, 2020
a008a55
Add a disabled builder for riscv64 emulated tests
tblah May 18, 2020
253112d
Mark tests whcih don't work under riscv emulation
tblah Jun 9, 2020
086eaf8
tools: remote-test-client: fix typo
tblah Jun 10, 2020
83e6c0e
Update CFGuard syntax
ajpaverd Jun 16, 2020
afde860
ci: disable alt build during try builds
pietroalbini Jun 17, 2020
daedb79
Prevent attacker from manipulating FPU tag word used in SGX enclave
raoulstrackx Jun 17, 2020
33b304c
Using xsave restore to restore complete FPU state
raoulstrackx Jun 19, 2020
2851c9f
Support sanitizers on aarch64-unknown-linux-gnu
tmiasko Jun 4, 2020
a3e88be
bootstrap: Build sanitizer runtimes for aarch64-unknown-linux-gnu
tmiasko Jun 6, 2020
d2e6e93
ci: Enable sanitizers on dist-aarch64-linux
tmiasko Jun 4, 2020
66e7a14
bootstrap: Factor out common code in supported_sanitizers
tmiasko Jun 8, 2020
c4840db
skol -> placeholder
lcnr Jun 6, 2020
a24c897
int -> i32
lcnr Jun 6, 2020
180334c
remove `pop_placeholders`
lcnr Jun 6, 2020
ef10694
Deprecate `Vec::remove_item`
LukasKalbertodt Jun 20, 2020
1e6e082
Remove uses of `Vec::remove_item`
LukasKalbertodt Jun 20, 2020
59d8c45
Clean up E0695 explanation
GuillaumeGomez Jun 20, 2020
5431ef6
Rollup merge of #72600 - Aaron1011:fix/anon-const-encoding, r=varkor
RalfJung Jun 20, 2020
b015b28
Rollup merge of #73055 - lcnr:skol-no-more, r=matthewjasper
RalfJung Jun 20, 2020
913aac8
Rollup merge of #73058 - tmiasko:aarch64-san, r=nagisa
RalfJung Jun 20, 2020
77efcab
Rollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbini
RalfJung Jun 20, 2020
91bd333
Rollup merge of #73404 - ajpaverd:cfguard_syntax, r=Mark-Simulacrum
RalfJung Jun 20, 2020
7930ee6
Rollup merge of #73444 - pietroalbini:ci-remove-try-alt, r=Mark-Simul…
RalfJung Jun 20, 2020
96b86ea
Rollup merge of #73471 - raoulstrackx:raoul/fpu_tag_word, r=jethrogb
RalfJung Jun 20, 2020
c1cad70
Rollup merge of #73539 - LukasKalbertodt:deprecate-vec-remove-item, r…
RalfJung Jun 20, 2020
bb0016b
Rollup merge of #73543 - GuillaumeGomez:cleanup-e0695, r=Dylan-DPC
RalfJung Jun 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ jobs:
- name: dist-x86_64-linux
os: ubuntu-latest-xl
env: {}
- name: dist-x86_64-linux-alt
env:
IMAGE: dist-x86_64-linux
os: ubuntu-latest-xl
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
steps:
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ impl<'a> Builder<'a> {
);
}

// If Control Flow Guard is enabled, pass the `control_flow_guard=checks` flag to rustc
// If Control Flow Guard is enabled, pass the `control-flow-guard` flag to rustc
// when compiling the standard library, since this might be linked into the final outputs
// produced by rustc. Since this mitigation is only available on Windows, only enable it
// for the standard library in case the compiler is run on a non-Windows platform.
Expand All @@ -1217,7 +1217,7 @@ impl<'a> Builder<'a> {
&& self.config.control_flow_guard
&& compiler.stage >= 1
{
rustflags.arg("-Zcontrol_flow_guard=checks");
rustflags.arg("-Zcontrol-flow-guard");
}

// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def v(*args):
"rootfs in qemu testing, you probably don't want to use this")
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
"rootfs in qemu testing, you probably don't want to use this")
v("qemu-riscv64-rootfs", "target.riscv64gc-unknown-linux-gnu.qemu-rootfs",
"rootfs in qemu testing, you probably don't want to use this")
v("experimental-targets", "llvm.experimental-targets",
"experimental LLVM targets to build")
v("release-channel", "rust.channel", "the name of the release channel to build")
Expand Down
67 changes: 30 additions & 37 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,48 +689,41 @@ fn supported_sanitizers(
target: Interned<String>,
channel: &str,
) -> Vec<SanitizerRuntime> {
let mut result = Vec::new();
let darwin_libs = |os: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
components
.into_iter()
.map(move |c| SanitizerRuntime {
cmake_target: format!("clang_rt.{}_{}_dynamic", c, os),
path: out_dir
.join(&format!("build/lib/darwin/libclang_rt.{}_{}_dynamic.dylib", c, os)),
name: format!("librustc-{}_rt.{}.dylib", channel, c),
})
.collect()
};

let common_libs = |os: &str, arch: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
components
.into_iter()
.map(move |c| SanitizerRuntime {
cmake_target: format!("clang_rt.{}-{}", c, arch),
path: out_dir.join(&format!("build/lib/{}/libclang_rt.{}-{}.a", os, c, arch)),
name: format!("librustc-{}_rt.{}.a", channel, c),
})
.collect()
};

match &*target {
"x86_64-apple-darwin" => {
for s in &["asan", "lsan", "tsan"] {
result.push(SanitizerRuntime {
cmake_target: format!("clang_rt.{}_osx_dynamic", s),
path: out_dir
.join(&format!("build/lib/darwin/libclang_rt.{}_osx_dynamic.dylib", s)),
name: format!("librustc-{}_rt.{}.dylib", channel, s),
});
}
"aarch64-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]),
"aarch64-unknown-linux-gnu" => {
common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan"])
}
"x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
"x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
"x86_64-unknown-linux-gnu" => {
for s in &["asan", "lsan", "msan", "tsan"] {
result.push(SanitizerRuntime {
cmake_target: format!("clang_rt.{}-x86_64", s),
path: out_dir.join(&format!("build/lib/linux/libclang_rt.{}-x86_64.a", s)),
name: format!("librustc-{}_rt.{}.a", channel, s),
});
}
}
"x86_64-fuchsia" => {
for s in &["asan"] {
result.push(SanitizerRuntime {
cmake_target: format!("clang_rt.{}-x86_64", s),
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-x86_64.a", s)),
name: format!("librustc-{}_rt.{}.a", channel, s),
});
}
}
"aarch64-fuchsia" => {
for s in &["asan"] {
result.push(SanitizerRuntime {
cmake_target: format!("clang_rt.{}-aarch64", s),
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-aarch64.a", s)),
name: format!("librustc-{}_rt.{}.a", channel, s),
});
}
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
}
_ => {}
_ => Vec::new(),
}
result
}

struct HashStamp {
Expand Down
2 changes: 0 additions & 2 deletions src/ci/azure-pipelines/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
strategy:
matrix:
dist-x86_64-linux: {}
dist-x86_64-linux-alt:
IMAGE: dist-x86_64-linux

# The macOS and Windows builds here are currently disabled due to them not being
# overly necessary on `try` builds. We also don't actually have anything that
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From c820da85c65c7f3aa9e9cb3ed71ada69bf9b783e Mon Sep 17 00:00:00 2001
From: Alistair Francis <[email protected]>
Date: Tue, 19 Nov 2019 13:06:40 +0100
Subject: [PATCH] Remove stime() function calls

stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.

function old new delta
rdate_main 197 224 +27
clock_settime - 27 +27
date_main 926 941 +15
stime 37 - -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Denys Vlasenko <[email protected]>

[Tom Eccles: adjust patch context to apply on top of 1.31.1-stable]
Signed-off-by: Tom Eccles <[email protected]>
---
coreutils/date.c | 6 +++++-
libbb/missing_syscalls.c | 8 --------
util-linux/rdate.c | 8 ++++++--
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/coreutils/date.c b/coreutils/date.c
index 3414d38ae..4ade6abb4 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -279,6 +279,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
time(&ts.tv_sec);
#endif
}
+#if !ENABLE_FEATURE_DATE_NANO
+ ts.tv_nsec = 0;
+#endif
localtime_r(&ts.tv_sec, &tm_time);

/* If date string is given, update tm_time, and maybe set date */
@@ -301,9 +304,10 @@ int date_main(int argc UNUSED_PARAM, char **argv)
if (date_str[0] != '@')
tm_time.tm_isdst = -1;
ts.tv_sec = validate_tm_time(date_str, &tm_time);
+ ts.tv_nsec = 0;

/* if setting time, set it */
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
bb_perror_msg("can't set date");
}
}
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
index 87cf59b3d..dc40d9155 100644
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -15,14 +15,6 @@ pid_t getsid(pid_t pid)
return syscall(__NR_getsid, pid);
}

-int stime(const time_t *t)
-{
- struct timeval tv;
- tv.tv_sec = *t;
- tv.tv_usec = 0;
- return settimeofday(&tv, NULL);
-}
-
int sethostname(const char *name, size_t len)
{
return syscall(__NR_sethostname, name, len);
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 70f829e7f..878375d78 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
if (!(flags & 2)) { /* no -p (-s may be present) */
if (time(NULL) == remote_time)
bb_error_msg("current time matches remote time");
- else
- if (stime(&remote_time) < 0)
+ else {
+ struct timespec ts;
+ ts.tv_sec = remote_time;
+ ts.tv_nsec = 0;
+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
bb_perror_msg_and_die("can't set time of day");
+ }
}

if (flags != 1) /* not lone -s */
--
2.25.1

102 changes: 102 additions & 0 deletions src/ci/docker/disabled/riscv64gc-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# based on armhf-gnu/Dockerfile
FROM ubuntu:20.04

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update -y && apt-get install -y --no-install-recommends \
bc \
bison \
ca-certificates \
cmake \
cpio \
curl \
debian-ports-archive-keyring \
debootstrap \
flex \
gcc \
gcc-riscv64-linux-gnu \
git \
g++-riscv64-linux-gnu \
g++ \
libc6-dev \
libc6-dev-riscv64-cross \
make \
patch \
python3 \
qemu-system-misc \
xz-utils

ENV ARCH=riscv
ENV CROSS_COMPILE=riscv64-linux-gnu-

WORKDIR /build

# From https://github.com/michaeljclark/busybear-linux/blob/master/conf/linux.config
COPY riscv64gc-linux/linux.config /build

# Compile the kernel that we're going to be emulating with. This is
# basically just done to be compatible with the QEMU target that we're going
# to be using when running tests.
RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar xJf - && \
cp linux.config linux-5.6.16/.config && \
cd /build/linux-5.6.16 && \
make olddefconfig && \
make -j$(nproc) vmlinux
RUN cp linux-5.6.16/vmlinux /tmp
RUN rm -rf linux-5.6.16

# Compile an instance of busybox as this provides a lightweight system and init
# binary which we will boot into. Only trick here is configuring busybox to
# build static binaries.
RUN curl https://busybox.net/downloads/busybox-1.31.1.tar.bz2 | tar xjf -
COPY riscv64gc-linux/0001-Remove-stime-function-calls.patch /build/busybox-1.31.1/
RUN cd /build/busybox-1.31.1 && \
patch -p1 -i 0001-Remove-stime-function-calls.patch && \
make defconfig && \
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
make -j$(nproc) && \
make install && \
mv _install /tmp/rootfs && \
cd /build && \
rm -rf busybox-1.31.1

# Download the ubuntu rootfs, which we'll use as a chroot for all our tests
# This is only needed to provide /lib/* and /usr/lib/*
WORKDIR /tmp
RUN debootstrap --variant=minbase --arch=riscv64 --foreign focal /tmp/rootfs/ubuntu
RUN cd rootfs && mkdir proc sys dev etc etc/init.d
# rootfs/ubuntu/proc is in a weird state (access fails with ELOOP) until
# rootfs/ubuntu/debootstrap/debootstrap --second-stage is run (under emulation),
# but this takes ages. Instead hack it into a good enough state.
# /proc is used by std::env::current_exe() (which is roughly
# `readlink /proc/self/exe`)
RUN cd rootfs/ubuntu && rm -rf proc && mkdir proc

# Copy over our init script, which starts up our test server and also a few other
# misc tasks
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
RUN chmod +x rootfs/etc/init.d/rcS

# Helper to quickly fill the entropy pool in the kernel
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
RUN riscv64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static

# download and build the riscv bootloader
RUN git clone https://github.com/riscv/riscv-pk
WORKDIR /tmp/riscv-pk
# nothing special about this revision: it is just master at the time of writing
# v1.0.0 doesn't build
RUN git checkout 5d9ed238e1cabfbca3c47f50d32894ce94bfc304
RUN mkdir build && cd build && \
../configure --with-payload=/tmp/vmlinux --host=riscv64-linux-gnu && \
make -j$(nproc) && \
cp bbl /tmp
WORKDIR /tmp
RUN rm -rf /tmp/riscv-pk

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
ENV SCRIPT python3 ../x.py test --target riscv64gc-unknown-linux-gnu

ENV NO_CHANGE_USER=1
51 changes: 51 additions & 0 deletions src/ci/docker/disabled/riscv64gc-linux/linux.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
CONFIG_DEFAULT_HOSTNAME="busybear"
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_CGROUP_BPF=y
CONFIG_NAMESPACES=y
CONFIG_USER_NS=y
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
CONFIG_BPF_SYSCALL=y
CONFIG_SMP=y
CONFIG_MODULES=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_PACKET_DIAG=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_NETLINK_DIAG=y
# CONFIG_WIRELESS is not set
CONFIG_PCI=y
CONFIG_DEVTMPFS=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_VIRTIO_BLK=y
CONFIG_NETDEVICES=y
CONFIG_VIRTIO_NET=y
# CONFIG_ETHERNET is not set
# CONFIG_WLAN is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_HVC_RISCV_SBI=y
# CONFIG_HW_RANDOM is not set
# CONFIG_USB_SUPPORT is not set
CONFIG_VIRTIO_MMIO=y
CONFIG_SIFIVE_PLIC=y
CONFIG_RAS=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_AUTOFS4_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
# CONFIG_CRYPTO_ECHAINIV is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_PRINTK_TIME=y
1 change: 1 addition & 0 deletions src/ci/docker/dist-aarch64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ ENV HOSTS=aarch64-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS \
--enable-full-tools \
--enable-profiler \
--enable-sanitizers \
--disable-docs
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
5 changes: 0 additions & 5 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,6 @@ jobs:
- name: dist-x86_64-linux
<<: *job-linux-xl

- name: dist-x86_64-linux-alt
env:
IMAGE: dist-x86_64-linux
<<: *job-linux-xl

auto:
<<: *base-ci-job
name: auto
Expand Down
Loading