-
Notifications
You must be signed in to change notification settings - Fork 1
Dev/alex/cfi tests #3
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
Open
AlexGhiti
wants to merge
2
commits into
main
Choose a base branch
from
dev/alex/cfi_tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,7 @@ RUN apt-get update && apt-get install --yes --no-install-recommends \ | |
| texinfo \ | ||
| time \ | ||
| traceroute \ | ||
| ubuntu-keyring \ | ||
| unzip \ | ||
| uuid-dev \ | ||
| vim \ | ||
|
|
@@ -118,9 +119,17 @@ RUN . /build/.env/bin/activate && pip install -U tuxrun | |
| COPY mkqemu.sh /usr/local/bin/mkqemu.sh | ||
| RUN cd /tmp && /usr/local/bin/mkqemu.sh | ||
|
|
||
| RUN mkdir -p /rootfs | ||
| COPY systemd-debian-autologin.sh /usr/local/bin/systemd-debian-autologin.sh | ||
| COPY mkext4_rv64_ubuntu.sh /usr/local/bin/mkext4_rv64_ubuntu.sh | ||
| RUN cd /rootfs && /usr/local/bin/mkext4_rv64_ubuntu.sh | ||
|
|
||
| RUN mkdir -p /build | ||
| WORKDIR /build | ||
|
|
||
| RUN git clone https://github.com/riscv-software-src/opensbi -b v1.6 | ||
| RUN cd opensbi && make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic | ||
|
|
||
| RUN git clone https://github.com/linux-riscv/tuxrun -b dev/alex/riscv64 | ||
|
|
||
| RUN git clone https://github.com/linux-riscv/test-definitions -b dev/alex/riscv64 | ||
|
|
@@ -138,4 +147,46 @@ RUN mkdir -p /build/libhugetlbfs | |
| RUN make ARCH=riscv64 PREFIX=/build/ install | ||
| RUN cd /build && tar --transform "s/build/\/opt/" -cJvf libhugetlbfs.tar.xz /build/libhugetlbfs | ||
|
|
||
| # xfs | ||
| WORKDIR /build | ||
| RUN git clone git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git | ||
| RUN dpkg --add-architecture riscv64 | ||
| RUN apt-get update && apt-get install --yes --no-install-recommends \ | ||
| acl:riscv64 attr:riscv64 libacl1-dev:riscv64 libaio-dev:riscv64 \ | ||
| libcap-dev:riscv64 libgdbm-dev:riscv64 libtool:riscv64 xfslibs-dev:riscv64 \ | ||
| libtool-bin:riscv64 liburing-dev:riscv64 libuuid1:riscv64 quota:riscv64 \ | ||
| uuid-dev:riscv64 uuid-runtime:riscv64 libgdbm-compat-dev:riscv64 | ||
| # FIXME have to install twice because the first one fails... | ||
| RUN cd xfstests-dev && make CC=riscv64-linux-gnu-gcc LD=riscv64-linux-gnu-ld PKG_LIB_DIR=/build/xfstests install | ||
| RUN cd xfstests-dev && make CC=riscv64-linux-gnu-gcc LD=riscv64-linux-gnu-ld PKG_LIB_DIR=/build/xfstests install | ||
| RUN cd /build && tar --transform "s/build/\/opt/" -cJvf xfstests.tar.xz /build/xfstests | ||
| # FIXME python3:riscv64 overwrites host python3... | ||
| RUN apt remove --yes python3.13-minimal:riscv64 | ||
| RUN apt-get install --yes --no-install-recommends \ | ||
| python3-setproctitle python3-yaml python3-guestfs python3-netifaces python3-requests python3-pexpect | ||
|
|
||
| # cfi | ||
| # We need a cfi enabled toolchain, so let's build it | ||
| # Build fails for now, so instead use an already built toolchain un /build | ||
| # from here https://gitlab.ba.rivosinc.com/api/v4/projects/704/packages/generic/cfi_toolchain/sept2024/cfi_sept2024.tar.gz | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this. |
||
| # It must be downloaded beforehand. | ||
| #WORKDIR /build | ||
| #RUN git clone https://github.com/sifive/riscv-gnu-toolchain -b cfi-dev | ||
| #WORKDIR /build/riscv-gnu-toolchain | ||
| #RUN git config --global url."https://github.com/".insteadOf "git@github.com:" | ||
| #RUN mkdir build | ||
| #RUN ./configure --prefix=/build/riscv-gnu-toolchain/build --with-arch=rv64gc --enable-linux --disable-gdb | ||
| #RUN make | ||
| #RUN make build-qemu | ||
| WORKDIR /build | ||
| COPY cfi_sept2024.tar.gz /build | ||
| RUN tar xvf cfi_sept2024.tar.gz | ||
| RUN mkdir -p /build/cfi | ||
| COPY tests/cfi/main.c /build/cfi | ||
| WORKDIR /build/cfi | ||
| RUN riscv64-linux-gnu-gcc main.c -o not_cfi_compiled_should_fail -static | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang nightly has support: Maybe start with that instead? |
||
| RUN PATH=/build/INSTALL_Sept24/bin:$PATH riscv64-unknown-linux-gnu-gcc main.c -o cfi_compiled_should_succeed -static | ||
| RUN cd /build && tar --transform "s/build/\/opt/" -cJvf isolated-cfi.tar.xz /build/cfi | ||
|
|
||
| WORKDIR /build | ||
| RUN mkdir -p /build/squad_json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: 2025 Rivos Inc. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Builds an RV64 Ubuntu rootfs. | ||
|
|
||
| set -euo pipefail | ||
| set -x | ||
|
|
||
| d=$(dirname "${BASH_SOURCE[0]}") | ||
| distro=noble | ||
|
|
||
| packages=( | ||
| arping | ||
| bc | ||
| binutils | ||
| btrfs-progs | ||
| dosfstools | ||
| elfutils | ||
| ethtool | ||
| exfatprogs | ||
| f2fs-tools | ||
| fsverity | ||
| iproute2 | ||
| iptables | ||
| jq | ||
| keyutils | ||
| libasound2t64 | ||
| libcap2 | ||
| libelf1 | ||
| libnuma1 | ||
| net-tools | ||
| netsniff-ng | ||
| openssl | ||
| psmisc | ||
| smcroute | ||
| socat | ||
| strace | ||
| systemd-sysv | ||
| tcpdump | ||
| udev | ||
| uuid-runtime | ||
| xfsprogs | ||
| zlib1g | ||
| ) | ||
| packages=$(IFS=, && echo "${packages[*]}") | ||
|
|
||
| name="rootfs_rv64_ubuntu_$(date +%Y.%m.%d).ext4" | ||
|
|
||
| mmdebstrap --include="$packages" \ | ||
| --architecture=riscv64 \ | ||
| --format=ext4 \ | ||
| --components="main restricted multiverse universe" \ | ||
| --customize-hook=$d/systemd-debian-autologin.sh \ | ||
| --skip=cleanup/reproducible \ | ||
| "${distro}" \ | ||
| "${name}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need the python3 risc-v binary on the host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a dependency of xfsprogs, needed to compile xfstests