原文:https://nos-ae.github.io/posts/attack-xv6/
思路
被这个实验折磨了两天,可能是2024新出的一个实验内容,网上资料少,参考了一篇仅有的博客,吭哧吭哧分析出来了个大概吧…在此记录一下,以便帮助有需要的人。
attack xv6的ans只有几行代码,根据实验描述,大概能猜到是secret程序结束之后,attack程序复用了它的物理内存,然后读取之前写入内存中的密码。难点在于我们如何定位到那段内存。
在开始之前直接先给出ans,可以看到代码是很简单的:
#include "kernel/types.h"
#include "kernel/fcntl.h"
#include "user/user.h"
#include "kernel/riscv.h"
int
main(int argc, char *argv[])