Skip to content

Support for Ubuntu 24.04 Noble #1569

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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5412,9 +5412,9 @@ if test "$llvm" != "no"; then

llvm_components=""
llvm_cxxflags=$($llvm_config $llvm_components --cxxflags 2> /dev/null)
llvm_ldflags=$($llvm_config $llvm_components --ldflags 2> /dev/null)
# Add ltinfo for fixing LLVM linking error [Maybe i just messed up with LLVM compiling]
llvm_ldflags="$($llvm_config $llvm_components --ldflags 2> /dev/null) -ltinfo"
llvm_libs=$($llvm_config $llvm_components --libs 2> /dev/null)

if compile_prog_clangxx "$llvm_cxxflags -Wno-unused-variable" "$llvm_libs $llvm_ldflags" ; then
: LLVM found
elif test "$llvm" = "yes"; then
Expand Down
90 changes: 90 additions & 0 deletions panda/dependencies/ubuntu_24.04_base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Panda dependencies
# Note that libcapstone >= v4.1 is also required, but that's not available in apt
git
libdwarf1
libjsoncpp-dev
# libllvm11
libprotobuf-c-dev
libvte-2.91-0
libwireshark-dev
libwiretap-dev
# Fixes config.h build error
wireshark-dev
libxen-dev
libz3-dev
python3
python3-pip
wget

# pyperipheral (only needed for armel)
libpython3-dev

# pypanda dependencies
genisoimage
libffi-dev
python3-protobuf
python3-colorama

# Not sure what this one is needed for
liblzo2-2

# apt-rdepends qemu-system-common
acl
libc6
libcap-ng0
libcap2
libgbm1
libglib2.0-0
libglib2.0-dev
zlib1g-dev
libgnutls30
libnettle8
libpixman-1-0
libvirglrenderer1

# apt-rdepends qemu-block-extra
libcurl3-gnutls
libglib2.0-0
libiscsi7
librados2
librbd1
libssh-4

# apt-rdepends qemu-system-arm, seems most of the system-[arch]es have same dependencies
libaio1t64
libasound2t64
libbrlapi-dev
libc6
libcacard0
libepoxy0
libfdt1
libgbm1
libgcc-s1
libglib2.0-0
libgnutls30
libibverbs1
libjpeg8
libncursesw6
libnuma1
libpixman-1-0
libpmem1
libpng16-16
librdmacm1
libsasl2-2
libseccomp2
libslirp0
libspice-server1
libstdc++6
libtinfo6
libusb-1.0-0
libusbredirparser1
libvirglrenderer1
zlib1g

# rr2 dependencies
libarchive-dev
libssl-dev

# libosi build dependecies
pkg-config
libglib2.0-dev
90 changes: 90 additions & 0 deletions panda/dependencies/ubuntu_24.04_build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
libc++-dev
libelf-dev
libtool-bin
libwireshark-dev
libwiretap-dev
# lsb-core
zip

# panda build deps
# Note libcapstone-dev is required, but we need v4 + which isn't in apt
build-essential
chrpath
# clang-11
gcc
libdwarf-dev
libprotoc-dev
# llvm-11-dev
protobuf-c-compiler
protobuf-compiler
python3-dev
libpixman-1-dev
zip

# pypanda dependencies
python3-setuptools
python3-wheel

# pypanda test dependencies
gcc-multilib
libc6-dev-i386
nasm

# Qemu build deps
debhelper
device-tree-compiler
libgnutls28-dev
libaio-dev
libasound2-dev
libattr1-dev
libbrlapi-dev
libcacard-dev
libcap-dev
libcap-ng-dev
libcurl4-gnutls-dev
libdrm-dev
libepoxy-dev
libfdt-dev
libgbm-dev
libibumad-dev
libibverbs-dev
libiscsi-dev
libjpeg-dev
libncursesw5-dev
libnuma-dev
libpmem-dev
libpng-dev
libpulse-dev
librbd-dev
librdmacm-dev
libsasl2-dev
libseccomp-dev
libslirp-dev
libspice-protocol-dev
libspice-server-dev
libssh-dev
libudev-dev
libusb-1.0-0-dev
libusbredirparser-dev
libvirglrenderer-dev
nettle-dev
python3
python3-sphinx
texinfo
uuid-dev
xfslibs-dev
zlib1g-dev
libc6.1-dev-alpha-cross

# qemu build deps that conflict with gcc-multilib
#gcc-alpha-linux-gnu
#gcc-powerpc64-linux-gnu
#gcc-s390x-linux-gnu

# rust install deps
curl

# libosi install deps
cmake
ninja-build
rapidjson-dev
48 changes: 24 additions & 24 deletions panda/plugins/network/network.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* PANDABEGINCOMMENT
*
*
* Authors:
* Tim Leek tleek@ll.mit.edu
* Ryan Whelan rwhelan@ll.mit.edu
* Joshua Hodosh josh.hodosh@ll.mit.edu
* Michael Zhivich mzhivich@ll.mit.edu
* Brendan Dolan-Gavitt brendandg@gatech.edu
*
* This work is licensed under the terms of the GNU GPL, version 2.
* See the COPYING file in the top-level directory.
*
*
* This work is licensed under the terms of the GNU GPL, version 2.
* See the COPYING file in the top-level directory.
*
PANDAENDCOMMENT */
// This needs to be defined before anything is included in order to get
// the PRIx64 macro
Expand All @@ -21,6 +21,7 @@

#include <wireshark/config.h>
#include <wiretap/wtap.h>
#include <wiretap/wtap_opttypes.h>

// These need to be extern "C" so that the ABI is compatible with
// QEMU/PANDA, which is written in C
Expand Down Expand Up @@ -56,7 +57,7 @@ bool init_plugin(void *self) {
.snaplen = 65535,
.shb_hdrs = NULL,
.idb_inf = NULL,
.nrb_hdrs = NULL,
.nrbs_growing = NULL,
.dsbs_initial = NULL,
.dsbs_growing = NULL
};
Expand All @@ -76,20 +77,19 @@ bool init_plugin(void *self) {
fprintf(stderr, "Plugin 'network' needs argument: -panda-arg network:file=<file>\n");
return false;
}

int file_type = wtap_pcapng_file_type_subtype();
#if (VERSION_MAJOR == 2 && VERSION_MINOR >= 6 ) || (VERSION_MAJOR>=3)
wtap_init(false);
#elif VERSION_MAJOR == 2 && VERSION_MINOR == 2 && VERSION_MICRO >= 4
wtap_init();
#endif

#if (VERSION_MAJOR>=3)
#if (VERSION_MAJOR>=4 || VERSION_MINOR>=4)
gchar *write_err_info;
#endif
plugin_log = wtap_dump_open(
tblog_filename,
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
file_type,
WTAP_UNCOMPRESSED, // assuming this...
&wdparams, // the new structure that wraps all the ng params
&err
Expand All @@ -100,15 +100,15 @@ bool init_plugin(void *self) {
#else
plugin_log = wtap_dump_open_ng(
/*filename*/tblog_filename,
/*file_type_subtype*/WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
/*file_type_subtype*/file_type,
/*encap*/WTAP_ENCAP_ETHERNET,
/*snaplen*/65535,
/*compressed*/1,
/*shb_hdrs*/NULL,
/*idb_inf*/NULL,
#if VERSION_MAJOR == 2
#if VERSION_MAJOR == 2
/*nrb_hdrs*/NULL,
#endif
#endif
/*err*/&err);
#endif

Expand All @@ -134,7 +134,8 @@ void uninit_plugin(void *self) {
#endif
#if (VERSION_MAJOR>=4 || (VERSION_MAJOR==3 && VERSION_MINOR>=4))
gchar *write_err_info;
gboolean ret = wtap_dump_close(plugin_log, &err, &write_err_info);
gboolean needs_reload;
gboolean ret = wtap_dump_close(plugin_log, &needs_reload, &err, &write_err_info);
#else
gboolean ret = wtap_dump_close(plugin_log, &err);
#endif
Expand Down Expand Up @@ -163,8 +164,8 @@ void handle_packet(CPUState *env, uint8_t *buf, size_t size, uint8_t direction,
rec.rec_header.packet_header.caplen = size;
rec.rec_header.packet_header.len = size;
rec.rec_header.packet_header.pkt_encap = WTAP_ENCAP_ETHERNET;
rec.opt_comment = comment_buf;
rec.has_comment_changed = true;
wtap_block_t pkt_block = wtap_block_create(WTAP_BLOCK_PACKET);
wtap_block_add_string_option(pkt_block, OPT_COMMENT, comment_buf, strlen(comment_buf) + 1);
ret = wtap_dump(
/*wtap_dumper*/ plugin_log,
/*wtap_rec*/ &rec,
Expand All @@ -173,9 +174,9 @@ void handle_packet(CPUState *env, uint8_t *buf, size_t size, uint8_t direction,
/*err_info*/ &err_info);
#else
struct wtap_pkthdr header;
#if VERSION_MAJOR >= 2
wtap_phdr_init(&header);
#endif
#if VERSION_MAJOR >= 2
wtap_phdr_init(&header);
#endif
header.ts.secs = now_tv.tv_sec;
header.ts.nsecs = now_tv.tv_usec * 1000;
header.caplen = size;
Expand All @@ -187,14 +188,14 @@ void handle_packet(CPUState *env, uint8_t *buf, size_t size, uint8_t direction,
/*wtap_pkthdr*/ &header,
/*buf*/ buf,
/*err*/ &err
#if VERSION_MAJOR >= 2
#if VERSION_MAJOR >= 2
,
/*err_info*/ &err_info
#endif
#endif
);
#if VERSION_MAJOR >= 2
wtap_phdr_cleanup(&header);
#endif
#if VERSION_MAJOR >= 2
wtap_phdr_cleanup(&header);
#endif
#endif
if (!ret) {
fprintf(stderr, "Plugin 'network': failed wtap_dump() with error %d", err);
Expand All @@ -206,4 +207,3 @@ void handle_packet(CPUState *env, uint8_t *buf, size_t size, uint8_t direction,
return;
}
#endif

18 changes: 18 additions & 0 deletions panda/scripts/build_libosi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e
echo "Building libosi..."
if [ ! -d "libosi" ]; then
git clone https://github.com/panda-re/libosi.git
else
echo "Directory 'libosi' already exists. Skipping clone."
fi

pushd libosi
mkdir -p build && cd build
cmake -GNinja ..
ninja
ninja package
sudo dpkg -i libosi-*.deb
popd
rm -rf libosi
45 changes: 45 additions & 0 deletions panda/scripts/build_llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# https://gist.github.com/ouankou/27c1fc22aee9125190492ea126125249
export LLVM_VERSION=11
export LLVM_SRC=$HOME/llvm/llvm_src
export LLVM_PATH=$HOME/llvm/llvm_install
export LLVM_BUILD=$HOME/llvm/llvm_build
export CC=`which clang`
export CXX=`which clang++`

mkdir -p $LLVM_SRC
mkdir -p $LLVM_PATH
mkdir -p $LLVM_BUILD

cd $LLVM_SRC

# Clone the repository from the old URL (replace the $LLVM_VERSION with actual version, e.g., 11)
git clone --depth 1 -b release/$LLVM_VERSION.x https://github.com/llvm/llvm-project .

# siglans-missing-cstdint-include-patch
sed -i '/#include <string>/a #include <cstdint>' $LLVM_SRC/llvm/include/llvm/Support/Signals.h
# fix-missing-header-limits-patch
sed -i '/^#include /a #include <limits>' $LLVM_SRC/llvm/utils/benchmark/src/benchmark_register.cc
sed -i '/^#include /a #include <limits>' $LLVM_SRC/llvm/utils/benchmark/src/benchmark_register.h

cd $LLVM_BUILD

# Configure the build using CMake
cmake -G Ninja -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$LLVM_PATH -DLLVM_ENABLE_PROJECTS="clang" $LLVM_SRC/llvm

# Build and install LLVM
# Use j1 for less memory consumption -> fixes kill clang process
ninja -j2 -l2
ninja install -j2

# Update environment variables for LLVM
export PATH=$LLVM_PATH/bin:$PATH
export LD_LIBRARY_PATH=$LLVM_PATH/libexec:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LLVM_PATH/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$LLVM_PATH/libexec:$LIBRARY_PATH
export LIBRARY_PATH=$LLVM_PATH/lib:$LIBRARY_PATH
export MANPATH=$LLVM_PATH/share/man:$MANPATH
export C_INCLUDE_PATH=$LLVM_PATH/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$LLVM_PATH/include:$CPLUS_INCLUDE_PATH
export LLVM_CONFIG_BINARY=$LLVM_PATH/bin/llvm-config
Loading
Loading