Skip to content

Commit f455e46

Browse files
committed
Auto merge of #73550 - RalfJung:rollup-5huj1k1, r=RalfJung
Rollup of 9 pull requests Successful merges: - #72600 (Properly encode AnonConst into crate metadata) - #73055 (remove leftover mentions of `skol` and `int` from the compiler) - #73058 (Support sanitizers on aarch64-unknown-linux-gnu) - #73171 (RISC-V Emulated Testing) - #73404 (Update CFGuard syntax) - #73444 (ci: disable alt build during try builds) - #73471 (Prevent attacker from manipulating FPU tag word used in SGX enclave) - #73539 (Deprecate `Vec::remove_item`) - #73543 (Clean up E0695 explanation) Failed merges: r? @ghost
2 parents 033013c + bb0016b commit f455e46

File tree

57 files changed

+545
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+545
-299
lines changed

Diff for: .github/workflows/ci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ jobs:
152152
- name: dist-x86_64-linux
153153
os: ubuntu-latest-xl
154154
env: {}
155-
- name: dist-x86_64-linux-alt
156-
env:
157-
IMAGE: dist-x86_64-linux
158-
os: ubuntu-latest-xl
159155
timeout-minutes: 600
160156
runs-on: "${{ matrix.os }}"
161157
steps:

Diff for: src/bootstrap/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ impl<'a> Builder<'a> {
12061206
);
12071207
}
12081208

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

12231223
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs

Diff for: src/bootstrap/configure.py

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def v(*args):
141141
"rootfs in qemu testing, you probably don't want to use this")
142142
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
143143
"rootfs in qemu testing, you probably don't want to use this")
144+
v("qemu-riscv64-rootfs", "target.riscv64gc-unknown-linux-gnu.qemu-rootfs",
145+
"rootfs in qemu testing, you probably don't want to use this")
144146
v("experimental-targets", "llvm.experimental-targets",
145147
"experimental LLVM targets to build")
146148
v("release-channel", "rust.channel", "the name of the release channel to build")

Diff for: src/bootstrap/native.rs

+30-37
Original file line numberDiff line numberDiff line change
@@ -689,48 +689,41 @@ fn supported_sanitizers(
689689
target: Interned<String>,
690690
channel: &str,
691691
) -> Vec<SanitizerRuntime> {
692-
let mut result = Vec::new();
692+
let darwin_libs = |os: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
693+
components
694+
.into_iter()
695+
.map(move |c| SanitizerRuntime {
696+
cmake_target: format!("clang_rt.{}_{}_dynamic", c, os),
697+
path: out_dir
698+
.join(&format!("build/lib/darwin/libclang_rt.{}_{}_dynamic.dylib", c, os)),
699+
name: format!("librustc-{}_rt.{}.dylib", channel, c),
700+
})
701+
.collect()
702+
};
703+
704+
let common_libs = |os: &str, arch: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
705+
components
706+
.into_iter()
707+
.map(move |c| SanitizerRuntime {
708+
cmake_target: format!("clang_rt.{}-{}", c, arch),
709+
path: out_dir.join(&format!("build/lib/{}/libclang_rt.{}-{}.a", os, c, arch)),
710+
name: format!("librustc-{}_rt.{}.a", channel, c),
711+
})
712+
.collect()
713+
};
714+
693715
match &*target {
694-
"x86_64-apple-darwin" => {
695-
for s in &["asan", "lsan", "tsan"] {
696-
result.push(SanitizerRuntime {
697-
cmake_target: format!("clang_rt.{}_osx_dynamic", s),
698-
path: out_dir
699-
.join(&format!("build/lib/darwin/libclang_rt.{}_osx_dynamic.dylib", s)),
700-
name: format!("librustc-{}_rt.{}.dylib", channel, s),
701-
});
702-
}
716+
"aarch64-fuchsia" => common_libs("fuchsia", "aarch64", &["asan"]),
717+
"aarch64-unknown-linux-gnu" => {
718+
common_libs("linux", "aarch64", &["asan", "lsan", "msan", "tsan"])
703719
}
720+
"x86_64-apple-darwin" => darwin_libs("osx", &["asan", "lsan", "tsan"]),
721+
"x86_64-fuchsia" => common_libs("fuchsia", "x86_64", &["asan"]),
704722
"x86_64-unknown-linux-gnu" => {
705-
for s in &["asan", "lsan", "msan", "tsan"] {
706-
result.push(SanitizerRuntime {
707-
cmake_target: format!("clang_rt.{}-x86_64", s),
708-
path: out_dir.join(&format!("build/lib/linux/libclang_rt.{}-x86_64.a", s)),
709-
name: format!("librustc-{}_rt.{}.a", channel, s),
710-
});
711-
}
712-
}
713-
"x86_64-fuchsia" => {
714-
for s in &["asan"] {
715-
result.push(SanitizerRuntime {
716-
cmake_target: format!("clang_rt.{}-x86_64", s),
717-
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-x86_64.a", s)),
718-
name: format!("librustc-{}_rt.{}.a", channel, s),
719-
});
720-
}
721-
}
722-
"aarch64-fuchsia" => {
723-
for s in &["asan"] {
724-
result.push(SanitizerRuntime {
725-
cmake_target: format!("clang_rt.{}-aarch64", s),
726-
path: out_dir.join(&format!("build/lib/fuchsia/libclang_rt.{}-aarch64.a", s)),
727-
name: format!("librustc-{}_rt.{}.a", channel, s),
728-
});
729-
}
723+
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
730724
}
731-
_ => {}
725+
_ => Vec::new(),
732726
}
733-
result
734727
}
735728

736729
struct HashStamp {

Diff for: src/ci/azure-pipelines/try.yml

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
strategy:
2727
matrix:
2828
dist-x86_64-linux: {}
29-
dist-x86_64-linux-alt:
30-
IMAGE: dist-x86_64-linux
3129

3230
# The macOS and Windows builds here are currently disabled due to them not being
3331
# overly necessary on `try` builds. We also don't actually have anything that
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
From c820da85c65c7f3aa9e9cb3ed71ada69bf9b783e Mon Sep 17 00:00:00 2001
2+
From: Alistair Francis <[email protected]>
3+
Date: Tue, 19 Nov 2019 13:06:40 +0100
4+
Subject: [PATCH] Remove stime() function calls
5+
6+
stime() has been deprecated in glibc 2.31 and replaced with
7+
clock_settime(). Let's replace the stime() function calls with
8+
clock_settime() in preperation.
9+
10+
function old new delta
11+
rdate_main 197 224 +27
12+
clock_settime - 27 +27
13+
date_main 926 941 +15
14+
stime 37 - -37
15+
------------------------------------------------------------------------------
16+
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes
17+
18+
Signed-off-by: Alistair Francis <[email protected]>
19+
Signed-off-by: Denys Vlasenko <[email protected]>
20+
21+
[Tom Eccles: adjust patch context to apply on top of 1.31.1-stable]
22+
Signed-off-by: Tom Eccles <[email protected]>
23+
---
24+
coreutils/date.c | 6 +++++-
25+
libbb/missing_syscalls.c | 8 --------
26+
util-linux/rdate.c | 8 ++++++--
27+
3 files changed, 11 insertions(+), 11 deletions(-)
28+
29+
diff --git a/coreutils/date.c b/coreutils/date.c
30+
index 3414d38ae..4ade6abb4 100644
31+
--- a/coreutils/date.c
32+
+++ b/coreutils/date.c
33+
@@ -279,6 +279,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
34+
time(&ts.tv_sec);
35+
#endif
36+
}
37+
+#if !ENABLE_FEATURE_DATE_NANO
38+
+ ts.tv_nsec = 0;
39+
+#endif
40+
localtime_r(&ts.tv_sec, &tm_time);
41+
42+
/* If date string is given, update tm_time, and maybe set date */
43+
@@ -301,9 +304,10 @@ int date_main(int argc UNUSED_PARAM, char **argv)
44+
if (date_str[0] != '@')
45+
tm_time.tm_isdst = -1;
46+
ts.tv_sec = validate_tm_time(date_str, &tm_time);
47+
+ ts.tv_nsec = 0;
48+
49+
/* if setting time, set it */
50+
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
51+
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
52+
bb_perror_msg("can't set date");
53+
}
54+
}
55+
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
56+
index 87cf59b3d..dc40d9155 100644
57+
--- a/libbb/missing_syscalls.c
58+
+++ b/libbb/missing_syscalls.c
59+
@@ -15,14 +15,6 @@ pid_t getsid(pid_t pid)
60+
return syscall(__NR_getsid, pid);
61+
}
62+
63+
-int stime(const time_t *t)
64+
-{
65+
- struct timeval tv;
66+
- tv.tv_sec = *t;
67+
- tv.tv_usec = 0;
68+
- return settimeofday(&tv, NULL);
69+
-}
70+
-
71+
int sethostname(const char *name, size_t len)
72+
{
73+
return syscall(__NR_sethostname, name, len);
74+
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
75+
index 70f829e7f..878375d78 100644
76+
--- a/util-linux/rdate.c
77+
+++ b/util-linux/rdate.c
78+
@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
79+
if (!(flags & 2)) { /* no -p (-s may be present) */
80+
if (time(NULL) == remote_time)
81+
bb_error_msg("current time matches remote time");
82+
- else
83+
- if (stime(&remote_time) < 0)
84+
+ else {
85+
+ struct timespec ts;
86+
+ ts.tv_sec = remote_time;
87+
+ ts.tv_nsec = 0;
88+
+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
89+
bb_perror_msg_and_die("can't set time of day");
90+
+ }
91+
}
92+
93+
if (flags != 1) /* not lone -s */
94+
--
95+
2.25.1
96+

Diff for: src/ci/docker/disabled/riscv64gc-linux/Dockerfile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# based on armhf-gnu/Dockerfile
2+
FROM ubuntu:20.04
3+
4+
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
5+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
6+
bc \
7+
bison \
8+
ca-certificates \
9+
cmake \
10+
cpio \
11+
curl \
12+
debian-ports-archive-keyring \
13+
debootstrap \
14+
flex \
15+
gcc \
16+
gcc-riscv64-linux-gnu \
17+
git \
18+
g++-riscv64-linux-gnu \
19+
g++ \
20+
libc6-dev \
21+
libc6-dev-riscv64-cross \
22+
make \
23+
patch \
24+
python3 \
25+
qemu-system-misc \
26+
xz-utils
27+
28+
ENV ARCH=riscv
29+
ENV CROSS_COMPILE=riscv64-linux-gnu-
30+
31+
WORKDIR /build
32+
33+
# From https://github.com/michaeljclark/busybear-linux/blob/master/conf/linux.config
34+
COPY riscv64gc-linux/linux.config /build
35+
36+
# Compile the kernel that we're going to be emulating with. This is
37+
# basically just done to be compatible with the QEMU target that we're going
38+
# to be using when running tests.
39+
RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar xJf - && \
40+
cp linux.config linux-5.6.16/.config && \
41+
cd /build/linux-5.6.16 && \
42+
make olddefconfig && \
43+
make -j$(nproc) vmlinux
44+
RUN cp linux-5.6.16/vmlinux /tmp
45+
RUN rm -rf linux-5.6.16
46+
47+
# Compile an instance of busybox as this provides a lightweight system and init
48+
# binary which we will boot into. Only trick here is configuring busybox to
49+
# build static binaries.
50+
RUN curl https://busybox.net/downloads/busybox-1.31.1.tar.bz2 | tar xjf -
51+
COPY riscv64gc-linux/0001-Remove-stime-function-calls.patch /build/busybox-1.31.1/
52+
RUN cd /build/busybox-1.31.1 && \
53+
patch -p1 -i 0001-Remove-stime-function-calls.patch && \
54+
make defconfig && \
55+
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
56+
make -j$(nproc) && \
57+
make install && \
58+
mv _install /tmp/rootfs && \
59+
cd /build && \
60+
rm -rf busybox-1.31.1
61+
62+
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests
63+
# This is only needed to provide /lib/* and /usr/lib/*
64+
WORKDIR /tmp
65+
RUN debootstrap --variant=minbase --arch=riscv64 --foreign focal /tmp/rootfs/ubuntu
66+
RUN cd rootfs && mkdir proc sys dev etc etc/init.d
67+
# rootfs/ubuntu/proc is in a weird state (access fails with ELOOP) until
68+
# rootfs/ubuntu/debootstrap/debootstrap --second-stage is run (under emulation),
69+
# but this takes ages. Instead hack it into a good enough state.
70+
# /proc is used by std::env::current_exe() (which is roughly
71+
# `readlink /proc/self/exe`)
72+
RUN cd rootfs/ubuntu && rm -rf proc && mkdir proc
73+
74+
# Copy over our init script, which starts up our test server and also a few other
75+
# misc tasks
76+
COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
77+
RUN chmod +x rootfs/etc/init.d/rcS
78+
79+
# Helper to quickly fill the entropy pool in the kernel
80+
COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
81+
RUN riscv64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static
82+
83+
# download and build the riscv bootloader
84+
RUN git clone https://github.com/riscv/riscv-pk
85+
WORKDIR /tmp/riscv-pk
86+
# nothing special about this revision: it is just master at the time of writing
87+
# v1.0.0 doesn't build
88+
RUN git checkout 5d9ed238e1cabfbca3c47f50d32894ce94bfc304
89+
RUN mkdir build && cd build && \
90+
../configure --with-payload=/tmp/vmlinux --host=riscv64-linux-gnu && \
91+
make -j$(nproc) && \
92+
cp bbl /tmp
93+
WORKDIR /tmp
94+
RUN rm -rf /tmp/riscv-pk
95+
96+
COPY scripts/sccache.sh /scripts/
97+
RUN sh /scripts/sccache.sh
98+
99+
ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
100+
ENV SCRIPT python3 ../x.py test --target riscv64gc-unknown-linux-gnu
101+
102+
ENV NO_CHANGE_USER=1

Diff for: src/ci/docker/disabled/riscv64gc-linux/linux.config

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
CONFIG_DEFAULT_HOSTNAME="busybear"
2+
CONFIG_SYSVIPC=y
3+
CONFIG_POSIX_MQUEUE=y
4+
CONFIG_IKCONFIG=y
5+
CONFIG_IKCONFIG_PROC=y
6+
CONFIG_CGROUPS=y
7+
CONFIG_CGROUP_SCHED=y
8+
CONFIG_CFS_BANDWIDTH=y
9+
CONFIG_CGROUP_BPF=y
10+
CONFIG_NAMESPACES=y
11+
CONFIG_USER_NS=y
12+
CONFIG_CHECKPOINT_RESTORE=y
13+
CONFIG_BLK_DEV_INITRD=y
14+
CONFIG_EXPERT=y
15+
CONFIG_BPF_SYSCALL=y
16+
CONFIG_SMP=y
17+
CONFIG_MODULES=y
18+
CONFIG_NET=y
19+
CONFIG_PACKET=y
20+
CONFIG_PACKET_DIAG=y
21+
CONFIG_UNIX=y
22+
CONFIG_INET=y
23+
CONFIG_NETLINK_DIAG=y
24+
# CONFIG_WIRELESS is not set
25+
CONFIG_PCI=y
26+
CONFIG_DEVTMPFS=y
27+
CONFIG_BLK_DEV_LOOP=y
28+
CONFIG_VIRTIO_BLK=y
29+
CONFIG_NETDEVICES=y
30+
CONFIG_VIRTIO_NET=y
31+
# CONFIG_ETHERNET is not set
32+
# CONFIG_WLAN is not set
33+
CONFIG_SERIAL_8250=y
34+
CONFIG_SERIAL_8250_CONSOLE=y
35+
CONFIG_SERIAL_OF_PLATFORM=y
36+
CONFIG_HVC_RISCV_SBI=y
37+
# CONFIG_HW_RANDOM is not set
38+
# CONFIG_USB_SUPPORT is not set
39+
CONFIG_VIRTIO_MMIO=y
40+
CONFIG_SIFIVE_PLIC=y
41+
CONFIG_RAS=y
42+
CONFIG_EXT2_FS=y
43+
CONFIG_EXT3_FS=y
44+
CONFIG_EXT4_FS_POSIX_ACL=y
45+
CONFIG_AUTOFS4_FS=y
46+
CONFIG_MSDOS_FS=y
47+
CONFIG_VFAT_FS=y
48+
CONFIG_TMPFS=y
49+
# CONFIG_CRYPTO_ECHAINIV is not set
50+
# CONFIG_CRYPTO_HW is not set
51+
CONFIG_PRINTK_TIME=y

Diff for: src/ci/docker/dist-aarch64-linux/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ ENV HOSTS=aarch64-unknown-linux-gnu
3535
ENV RUST_CONFIGURE_ARGS \
3636
--enable-full-tools \
3737
--enable-profiler \
38+
--enable-sanitizers \
3839
--disable-docs
3940
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

Diff for: src/ci/github-actions/ci.yml

-5
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ jobs:
281281
- name: dist-x86_64-linux
282282
<<: *job-linux-xl
283283

284-
- name: dist-x86_64-linux-alt
285-
env:
286-
IMAGE: dist-x86_64-linux
287-
<<: *job-linux-xl
288-
289284
auto:
290285
<<: *base-ci-job
291286
name: auto

0 commit comments

Comments
 (0)