Skip to content

Commit

Permalink
[Scripts] Add static linking to avoid issues with binaries needing
Browse files Browse the repository at this point in the history
libaries in Panda VM. Fix few install script things too
  • Loading branch information
Andrew F. Quijano authored and AndrewQuijano committed Aug 17, 2024
1 parent 9604908 commit 3f4f46f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi

curl -LJO https://github.com/panda-re/panda/releases/download/v1.8.23/pandare_22.04.deb
mv *.deb /tmp
$SUDO apt install /tmp/pandare_22.04.deb
$SUDO apt-get -y install /tmp/pandare_22.04.deb
rm /tmp/*.deb

progress "Installed build dependencies"
Expand Down
15 changes: 13 additions & 2 deletions scripts/bug_mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,26 @@
# https://github.com/panda-re/panda/blob/dev/panda/python/core/pandare/panda.py#L2595-L2645
@panda.queue_blocking
def create_recording():
# I assume qemu_path is just 'panda-system-i386', `panda-system-x86_64`, etc
global command_args
global installdir
global isoname
print("args", command_args)
print("install dir", installdir)
print("isoname", isoname)
guest_command = subprocess.list2cmdline(command_args)
panda.record_cmd(guest_command=guest_command, copy_directory=installdir, iso_name=isoname)
# Technically the first two steps of record_cmd, but running executable ONLY works with absolute paths
panda.revert_sync('root')
panda.copy_to_guest(installdir, iso_name=isoname, absolute_paths=True)
# print("Checking ./lava-install\n")
# print(panda.run_serial_cmd("ls -la lava-install") + '\n')
# print("Checking ./lava-install/bin\n")
# print(panda.run_serial_cmd("ls -la lava-install/bin") + '\n')
# print(panda.run_serial_cmd("md5sum lava-install/bin/toy") + '\n')
# print(panda.run_serial_cmd("./lava-install/bin/toy ./toy-testsmall.bin.iso") + '\n')
# print(panda.run_serial_cmd(guest_command))

# Pass in None for snap_name since I already did the revert_sync already and copied directory in
panda.record_cmd(guest_command=guest_command, snap_name=None)
panda.stop_run()


Expand Down
3 changes: 2 additions & 1 deletion scripts/lava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ if [ $make -eq 1 ]; then
progress "everything" 1 "Make step -- making 32-bit version with queries"
lf="$logs/make.log"
truncate "$lf"
run_remote "$buildhost" "cd $sourcedir && CC=/usr/lib/llvm-11/bin/clang CXX=/usr/lib/llvm-11/bin/clang++ CFLAGS='-O0 -m32 -DHAVE_CONFIG_H -g -gdwarf-2 -fno-stack-protector -D_FORTIFY_SOURCE=0 -I. -I.. -I../include -I./src/' $makecmd" "$lf"
# Note, adding the static flag is important. We are running the binaries on a PANDA VM, so we have no idea if it will have any libraries we need.
run_remote "$buildhost" "cd $sourcedir && CC=/usr/lib/llvm-11/bin/clang CXX=/usr/lib/llvm-11/bin/clang++ CFLAGS='-O0 -m32 -DHAVE_CONFIG_H -g -gdwarf-2 -fno-stack-protector -D_FORTIFY_SOURCE=0 -I. -I.. -I../include -I./src/ -static' $makecmd" "$lf"

run_remote "$buildhost" "cd $sourcedir && rm -rf lava-install" "$lf"
if [ "$install_simple" == "null" ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_postgres.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ echo "host all all 0.0.0.0/0 md5" >> $PG_HBA
sed -i 's/scram-sha-256/md5/g' $PG_HBA

# Restart PostgreSQL service
service postgresql restart
service postgresql restart
Empty file modified setup_container.sh
100644 → 100755
Empty file.

0 comments on commit 3f4f46f

Please sign in to comment.