plctlab / PLCT-Weekly

软件所PLCT实验室在开源领域的不定期简报

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PLCT 2023 许愿池计划(继续把愿望评论在这里)

qjivy opened this issue · comments

commented

欢迎把愿望写在issue回复中,或者直接发PR到:
https://github.com/plctlab/PLCT-Weekly/blob/master/Open-Wishlist-2023.md

一键可以用gcc和llvm编译不同benchmark, 获得codesize,指令数(可能还有其他信息暂时没想到)的对比结果。

commented

感谢大家的参与,包括通过issues、邮件、微信等提交许愿的伙伴们。PLCT路线图2023将在本月发布。

DynamoRIO的移植有进展吗?

DynamoRIO的移植有进展吗?

现状是能够编译但是还无法正常运行.
截止 2022 年末, DynamoRIO 实现了在 RISC-V 64 下的编译. 这部分工作主要由 https://github.com/semihalf-kardach-stanislaw 完成.
后续是我负责 DynamoRIO 的移植, 目前的主要贡献是提供 RISC-V 64 编译 CI 并修复一些阻碍运行的小问题,欢迎交流和指点.

后续有计划让它运行起来吗?有时间点吗?链接里的这位外国友人,也是你们团队的吗?

后续有计划让它运行起来吗?有时间点吗?链接里的这位外国友人,也是你们团队的吗?

我们当前的计划是在今年 2023 年将它运行起来.
链接中的这位外国友人不是我们团队的, 他是 RIVOS 的, 目前已经不再参与移植.

你好,你们在什么模拟器/硬件上编译的啊?为什么能编译不能运行啊,编译完不是就有可执行文件了吗?

你好,你们在什么模拟器/硬件上编译的啊?为什么能编译不能运行啊,编译完不是就有可执行文件了吗?

你好。这是因为移植工作是分阶段执行的。此前移植的过程中,目的是为了编译,所以一些复杂的基础指令只做了定义未做实现。此外单元测试也是关闭的,仅当实现一项后会打开。

我们目前和上游行为一致使用交叉编译, qemu 上运行。由于缺少一些基础的指令实现(这部分主要是 RISC-V 汇编),即使使用 drrun 运行一个基本的 demo 也会出现段错误。

交叉编译使用的什么工具啊,能给个步骤吗?qemu使用的是系统态吗?我是计算所的,方便加个微信吗?fzhang1991

交叉编译使用的什么工具啊,能给个步骤吗?

交叉编译可以参考以下内容:

编译环境的准备

安装 docker

参考 https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/

使用 docker 准备编译环境

此处我的选型是 Ubuntu (22.04) , 基于上游 Github action 和其他依赖选择.

$ sudo docker pull ubuntu:22.04

拉取 github 的源码到本地后映射到容器内部

$ git clone git@github.com:DynamoRIO/dynamorio.git
$ cd dynamorio
# 映射源码路径到容器内部
$ sudo docker run -idt -v $(pwd):/root/dynamorio --name dynamorio-compile ubuntu:22.04
$ sudo docker exec -it osg-compile bash

安装依赖以及交叉编译

# 官方的依赖包
$ sudo apt-get install cmake g++ g++-multilib doxygen git zlib1g-dev libunwind-dev libsnappy-dev liblz4-dev3 crossbuild-essential-riscv64 python3 -y
# Make a separate build directory. Building in the source directory is not supported.
$ cd /root/dynamorio && mkdir build && cd build
# Generate makefiles with CMake. Pass in the path to your source directory.
$ cmake -DCMAKE_TOOLCHAIN_FILE=../make/toolchain-riscv64.cmake ../
# Build.
$ make -j
# Run echo under DR to see if it works. If you configured for a debug or 32-bit
# build, your path will be different. For example, a 32-bit debug build would put drrun in ./bin32/ and need -debug flag to run debug build.
$ ./bin64/drrun echo hello -v 

测试环境的准备

qemu 下方便测试的办法
常见的 qemu 映射文件中我选择了 9p
只需要在我的 qemu 启动脚本中加入

-fsdev local,security_model=passthrough,id=fsdev0,path=/path/dynamorio/ -device virtio-9p-device,id=fs0,fsdev=fsdev0,mount_tag=hostshare

# 然后在 qemu 中通过 
sudo mount -t 9p -o trans=virtio hostshare /home/shiptux/dynamorio -oversion=9p2000.L

sudo mount -t 9p -o trans=virtio hostshare /root/dynamorio -oversion=9p2000.L

Reference:

https://wiki.qemu.org/Documentation/9psetup

qemu使用的是系统态吗?

qemu 官方的测试使用的是 qemu-user. 实际上我在移植过程中使用 qemu-system 测试.

@fzhang1991 你好,现在有了一点进展,请见:DynamoRIO/dynamorio#3544 (comment)

@ksco 收到,好像还没merge吧,从https://github.com/ruyisdk/dynamorio下载了,可以运行hello world。好像还没有做分析吧,只是运行了吧

目前只合并了一部分,计划是今年底达到可用的状态。

@ksco 你好,你们也是先导项目吗?我们是先导A3-2课题,请问你们是哪个课题?另外dynamorio在riscv上能测试重用距离了吗?

@ksco 你好,你们也是先导项目吗?我们是先导A3-2课题,请问你们是哪个课题?另外dynamorio在riscv上能测试重用距离了吗?

你好,请邮件联系我:liuyang22@iscas.ac.cn

Hi all

Thank you for your contributions! We've moved all the wishes to #829

Happy New Year!