[Lldb-commits] [lldb] [lldb][Linux] Mark memory regions used for shadow stacks (PR #117861)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 13 02:57:57 PST 2025
DavidSpickett wrote:
I do this using 1 build that is a host build, with no options changed from the usual recipe. Then a second cross compilation build done like https://lldb.llvm.org/resources/build.html#example-1-cross-compiling-for-linux-arm64-on-ubuntu-host
in which I just build `ninja lldb-server`.
1. Use existing scripts to build rootfs and kernel - https://lldb.llvm.org/resources/qemu-testing.html#create-ubuntu-root-file-system-image-for-qemu-system-emulation-with-rootfs-sh
I did not check whether GCS requires compiler support, might want to double check that. I know userspace doesn't but kernel might.
3. Install shrinkwrap (for running the model) - https://shrinkwrap.docs.arm.com/en/latest/userguide/quickstart.html#install-shrinkwrap
4. Apply the following diff to shrinkwrap, to open ports on the model to the host machine:
```
diff --git a/config/FVP_Base_RevC-2xAEMvA-base.yaml b/config/FVP_Base_RevC-2xAEMvA-base.yaml
index 86d8cf9..443bd38 100644
--- a/config/FVP_Base_RevC-2xAEMvA-base.yaml
+++ b/config/FVP_Base_RevC-2xAEMvA-base.yaml
@@ -41,7 +41,8 @@ run:
# enables ssh.
-C bp.smsc_91c111.enabled: 1
-C bp.hostbridge.userNetworking: 1
- -C bp.hostbridge.userNetPorts: ${rtvar:LOCAL_NET_PORT}=22
+ -C bp.hostbridge.userNetPorts: ${rtvar:LOCAL_NET_PORT}=22,1234=1234,49140=49140
+
# FVP Performance tweaks.
-C cache_state_modelled: 0 # Disable d-cache and i-cache state for all components
```
5. Build the Armv9.5-a model:
```
$ shrinkwrap build --overlay=arch/v9.5.yaml ns-edk2.yaml
```
6. Run the model (note the IP address that it prints at the start):
```
$ shrinkwrap run --rtvar=KERNEL=/home/davspi01/work/open_source/linux.build/arm64/arch/arm64/boot/Image --rtvar=ROOTFS=/home/davspi01/work/open_source/jammy-arm64-rootfs.img ns-edk2.yaml
<...>
Environment ip address: 172.17.0.2.
```
You will see GCS detected in early boot, or you can `cat /proc/cpuinfo` once logged in.
7. The rootfs is mounted read-only, for reasons I don't understand, so:
```
$ sudo mount -o remount,rw /
```
8. Copy over ldb-server:
```
$ ninja lldb-server && scp -P 8022 -i ~/.ssh/id_fm_vm ./bin/lldb-server davspi01 at 172.17.0.2:/home/davspi01/
```
9. Start platform:
```
$ ./lldb-server platform --server --listen 0.0.0.0:1234 --gdbserver-port 49140
```
10. Set test compiler in the host lldb build:
```
LLDB_TEST_COMPILER=aarch64-none-linux-gnu-gcc
```
11. Run tests:
```
$ ./bin/lldb-dotest --platform-name remote-linux --platform-url connect://172.17.0.2:1234 --platform-working-dir /tmp/test_lldb --arch aarch64 -p TestAArch64LinuxGCS.py
```
The latter bits could be added to the qemu testing page, I'll see if any of it overlaps.
https://github.com/llvm/llvm-project/pull/117861
More information about the lldb-commits
mailing list