Skip to content
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

build,scripts,userspace: renamed various occurrencies of "probe" to "driver" and update libs #1832

Merged
merged 1 commit into from
Feb 8, 2022
Merged
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
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ endif()
include(falcosecurity-libs)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(NOT DEFINED PROBE_VERSION)
set(PROBE_VERSION "${FALCOSECURITY_LIBS_VERSION}")
if(NOT DEFINED DRIVER_VERSION)
set(DRIVER_VERSION "${FALCOSECURITY_LIBS_VERSION}")
endif()

if(NOT DEFINED PROBE_NAME)
set(PROBE_NAME "scap")
if(NOT DEFINED DRIVER_NAME)
set(DRIVER_NAME "scap")
endif()

set(DRIVERS_REPO "https://download.sysdig.com/scap-drivers")
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/falcosecurity-libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ else()
# default below In case you want to test against another falcosecurity/libs version just pass the variable - ie., `cmake
# -DFALCOSECURITY_LIBS_VERSION=dev ..`
if(NOT FALCOSECURITY_LIBS_VERSION)
set(FALCOSECURITY_LIBS_VERSION "7e832f61a05df68969697fd603594d65c4e14811")
set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=1a81218425ec105e76a53a8baef0e734abf1b1739567c226e45c3d673f69014e")
set(FALCOSECURITY_LIBS_VERSION "cba4af082af684fdd8622f443f724891ff13b26f")
set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=d93eff86763d5787e5e4f327f8234d7e8556001b3cf5512a97997db1a4e649a8")
endif()

# cd /path/to/build && cmake /path/to/source
Expand All @@ -46,7 +46,7 @@ else()
set(FALCOSECURITY_LIBS_SOURCE_DIR "${FALCOSECURITY_LIBS_CMAKE_WORKING_DIR}/falcosecurity-libs-prefix/src/falcosecurity-libs")
endif()

set(PROBE_VERSION "${FALCOSECURITY_LIBS_VERSION}")
set(DRIVER_VERSION "${FALCOSECURITY_LIBS_VERSION}")

if(NOT LIBSCAP_DIR)
set(LIBSCAP_DIR "${FALCOSECURITY_LIBS_SOURCE_DIR}")
Expand Down
20 changes: 10 additions & 10 deletions probe-builder/builder-entrypoint-coreos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# KERNELDIR
# KERNEL_RELEASE
# OUTPUT
# PROBE_DEVICE_NAME
# PROBE_NAME
# PROBE_VERSION
# DRIVER_DEVICE_NAME
# DRIVER_NAME
# DRIVER_VERSION

set -euo pipefail

Expand All @@ -21,21 +21,21 @@ fi

(cd $KERNELDIR && make modules_prepare)

echo Building $PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
echo Building $DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko

mkdir -p /build/sysdig
cd /build/sysdig

cmake -DCMAKE_BUILD_TYPE=Release -DPROBE_NAME=$PROBE_NAME -DPROBE_VERSION=$PROBE_VERSION -DPROBE_DEVICE_NAME=$PROBE_DEVICE_NAME -DCREATE_TEST_TARGETS=OFF /build/probe/sysdig
cmake -DCMAKE_BUILD_TYPE=Release -DDRIVER_NAME=$DRIVER_NAME -DDRIVER_VERSION=$DRIVER_VERSION -DDRIVER_DEVICE_NAME=$DRIVER_DEVICE_NAME -DCREATE_TEST_TARGETS=OFF /build/probe/sysdig
make driver
strip -g driver/$PROBE_NAME.ko
strip -g driver/$DRIVER_NAME.ko

KO_VERSION=$(/sbin/modinfo driver/$PROBE_NAME.ko | grep vermagic | tr -s " " | cut -d " " -f 2)
KO_VERSION=$(/sbin/modinfo driver/$DRIVER_NAME.ko | grep vermagic | tr -s " " | cut -d " " -f 2)
if [ "$KO_VERSION" != "$KERNEL_RELEASE" ]; then
echo "Corrupted probe, KO_VERSION " $KO_VERSION ", KERNEL_RELEASE " $KERNEL_RELEASE
echo "Corrupted driver, KO_VERSION " $KO_VERSION ", KERNEL_RELEASE " $KERNEL_RELEASE
exit 1
fi

cp driver/$PROBE_NAME.ko $OUTPUT/$PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
cp driver/$PROBE_NAME.ko $OUTPUT/$PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH_ORIG.ko
cp driver/$DRIVER_NAME.ko $OUTPUT/$DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
cp driver/$DRIVER_NAME.ko $OUTPUT/$DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH_ORIG.ko

20 changes: 10 additions & 10 deletions probe-builder/builder-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# KERNELDIR
# KERNEL_RELEASE
# OUTPUT
# PROBE_DEVICE_NAME
# PROBE_NAME
# PROBE_VERSION
# DRIVER_DEVICE_NAME
# DRIVER_NAME
# DRIVER_VERSION

set -euo pipefail

Expand All @@ -19,20 +19,20 @@ if [[ -f "${KERNELDIR}/scripts/gcc-plugins/stackleak_plugin.so" ]]; then
(cd "${KERNELDIR}" && make gcc-plugins)
fi

echo Building $PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
echo Building $DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko

mkdir -p /build/sysdig
cd /build/sysdig

cmake -DCMAKE_BUILD_TYPE=Release -DPROBE_NAME=$PROBE_NAME -DPROBE_VERSION=$PROBE_VERSION -DPROBE_DEVICE_NAME=$PROBE_DEVICE_NAME -DCREATE_TEST_TARGETS=OFF /build/probe/sysdig
cmake -DCMAKE_BUILD_TYPE=Release -DDRIVER_NAME=$DRIVER_NAME -DDRIVER_VERSION=$DRIVER_VERSION -DDRIVER_DEVICE_NAME=$DRIVER_DEVICE_NAME -DCREATE_TEST_TARGETS=OFF /build/probe/sysdig
make driver
strip -g driver/$PROBE_NAME.ko
strip -g driver/$DRIVER_NAME.ko

KO_VERSION=$(/sbin/modinfo driver/$PROBE_NAME.ko | grep vermagic | tr -s " " | cut -d " " -f 2)
KO_VERSION=$(/sbin/modinfo driver/$DRIVER_NAME.ko | grep vermagic | tr -s " " | cut -d " " -f 2)
if [ "$KO_VERSION" != "$KERNEL_RELEASE" ]; then
echo "Corrupted probe, KO_VERSION " $KO_VERSION ", KERNEL_RELEASE " $KERNEL_RELEASE
echo "Corrupted driver, KO_VERSION " $KO_VERSION ", KERNEL_RELEASE " $KERNEL_RELEASE
exit 1
fi

cp driver/$PROBE_NAME.ko $OUTPUT/$PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
cp driver/$PROBE_NAME.ko $OUTPUT/$PROBE_NAME-$PROBE_VERSION-$ARCH-$KERNEL_RELEASE-$HASH_ORIG.ko
cp driver/$DRIVER_NAME.ko $OUTPUT/$DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH.ko
cp driver/$DRIVER_NAME.ko $OUTPUT/$DRIVER_NAME-$DRIVER_VERSION-$ARCH-$KERNEL_RELEASE-$HASH_ORIG.ko
2 changes: 1 addition & 1 deletion scripts/debian/postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set -e

DKMS_PACKAGE_NAME="@DRIVER_PACKAGE_NAME@"
DKMS_VERSION="@PROBE_VERSION@"
DKMS_VERSION="@DRIVER_VERSION@"

postinst_found=0

Expand Down
2 changes: 1 addition & 1 deletion scripts/debian/prerm.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
set -e

DKMS_PACKAGE_NAME="@DRIVER_PACKAGE_NAME@"
DKMS_VERSION="@PROBE_VERSION@"
DKMS_VERSION="@DRIVER_VERSION@"

case "$1" in
remove|upgrade|deconfigure)
Expand Down
2 changes: 1 addition & 1 deletion scripts/rpm/postinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

mod_version="@PROBE_VERSION@"
mod_version="@DRIVER_VERSION@"
mod_name="@DRIVER_PACKAGE_NAME@"

dkms add -m $mod_name -v $mod_version --rpm_safe_upgrade
Expand Down
2 changes: 1 addition & 1 deletion scripts/rpm/preuninstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

mod_version="@PROBE_VERSION@"
mod_version="@DRIVER_VERSION@"
mod_name="@DRIVER_PACKAGE_NAME@"

dkms remove -m $mod_name -v $mod_version --all --rpm_safe_upgrade
4 changes: 2 additions & 2 deletions scripts/scap-driver-loader.in
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ if [[ -z "$MAX_RMMOD_WAIT" ]]; then
MAX_RMMOD_WAIT=60
fi

DRIVER_VERSION="@PROBE_VERSION@"
DRIVER_NAME=${DRIVER_NAME:-"@PROBE_NAME@"}
DRIVER_VERSION="@DRIVER_VERSION@"
DRIVER_NAME=${DRIVER_NAME:-"@DRIVER_NAME@"}

DRIVER="module"
if [ -v FALCO_BPF_PROBE ]; then
Expand Down
2 changes: 1 addition & 1 deletion userspace/sysdig/csysdig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ sysdig_init_res csysdig_init(int argc, char **argv)
}
else
{
if(system("modprobe " PROBE_NAME " > /dev/null 2> /dev/null"))
if(system("modprobe " DRIVER_NAME " > /dev/null 2> /dev/null"))
{
fprintf(stderr, "Unable to load the driver\n");
}
Expand Down
2 changes: 1 addition & 1 deletion userspace/sysdig/sysdig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ sysdig_init_res sysdig_init(int argc, char **argv)
}
else
{
if(system("modprobe " PROBE_NAME " > /dev/null 2> /dev/null"))
if(system("modprobe " DRIVER_NAME " > /dev/null 2> /dev/null"))
{
fprintf(stderr, "Unable to load the driver\n");
}
Expand Down