falcosecurity / pdig

ptrace-based event producer for udig
Apache License 2.0
67 stars 13 forks source link

pdig compilation is failing #25

Open tmukharj opened 2 years ago

tmukharj commented 2 years ago

Describe the bug

While compiling pdig on Alpine env it's failing with error

make[2]: [CMakeFiles/pdig.dir/build.make:230: CMakeFiles/pdig.dir/source/libs/driver/ppm_fillers.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/pdig.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

How to reproduce it

apk add --update \ git \ g++ \ gcc \ cmake \ make \ libtool \ elfutils-dev \ libelf-static \ linux-headers

git clone https://github.com/falcosecurity/pdig git clone https://github.com/falcosecurity/libs

cd pdig && mkdir build && cd build cmake -DMUSL_OPTIMIZED_BUILD=True .. make

Expected behaviour

You can now find the pdig binary in the source directory you created under pdig/build/pdig

Environment

OS:

NAME="Alpine Linux" ID=alpine VERSION_ID=3.12.1 PRETTY_NAME="Alpine Linux v3.12" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://bugs.alpinelinux.org/"

Installation method:
From source.

Additional context

bash-5.1# cmake -DMUSL_OPTIMIZED_BUILD=True .. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 10.3.1 -- The CXX compiler identification is GNU 10.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /source/pdig/build bash-5.1# make [ 6%] Building CXX object CMakeFiles/pdig.dir/pdig.cc.o [ 12%] Building C object CMakeFiles/pdig.dir/pdig_compat.c.o In file included from /source/pdig/pdig_compat.c:12: /usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to [-Wcpp] 1 #warning redirecting incorrect #include <sys/signal.h> to ^~~ In file included from /source/pdig/pdig_compat.c:23: /source/pdig/udig_capture.h:25: warning: "F_CANCELLK" redefined 25 #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
In file included from /source/pdig/pdig_compat.c:14: /usr/include/fcntl.h:127: note: this is the location of the previous definition 127 #define F_CANCELLK 1029
/source/pdig/pdig_compat.c: In function 'record_event': /source/pdig/pdig_compat.c:331:15: warning: pointer targets in assignment from 'uint8_t ' {aka 'unsigned char '} to 'char *' differ in signedness [-Wpointer-sign] 331 args.buffer = g_ring + head + sizeof(struct ppm_evt_hdr); ^ /source/pdig/pdig_compat.c:255:11: warning: variable 'usedspace' set but not used [-Wunused-but-set-variable] 255 uint32_t usedspace; ^~~~~ [ 18%] Building C object CMakeFiles/pdig.dir/pdig_ptrace.c.o [ 25%] Building CXX object CMakeFiles/pdig.dir/pdig_ptrace_amd64.cc.o [ 31%] Building CXX object CMakeFiles/pdig.dir/pdig_seccomp.cc.o [ 37%] Building CXX object CMakeFiles/pdig.dir/proc_tree.cc.o In file included from /source/pdig/proc_tree.cc:10: /usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to [-Wcpp] 1 #warning redirecting incorrect #include <sys/signal.h> to ^~~ [ 43%] Building C object CMakeFiles/pdig.dir/udig_procs.c.o In file included from /source/pdig/udig_procs.c:28: /source/pdig/udig_capture.h:25: warning: "F_CANCELLK" redefined 25 #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
In file included from /source/pdig/udig_procs.c:14: /usr/include/fcntl.h:127: note: this is the location of the previous definition 127 #define F_CANCELLK 1029
/source/pdig/udig_procs.c: In function 'udig_proc_startupdate': /source/pdig/udig_procs.c:496:40: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 252 [-Wformat-truncation=] 496 snprintf(filename, sizeof(filename), "%sexe", dir_name); ^~ ~~~~ /source/pdig/udig_procs.c:496:2: note: 'snprintf' output between 4 and 259 bytes into a destination of size 252 496 snprintf(filename, sizeof(filename), "%sexe", dir_name); ^~~~~~~~~~~~~~~ /source/pdig/udig_procs.c:529:40: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 252 [-Wformat-truncation=] 529 snprintf(filename, sizeof(filename), "%sstatus", dir_name); ^~ ~~~~ /source/pdig/udig_procs.c:529:2: note: 'snprintf' output between 7 and 262 bytes into a destination of size 252 529 snprintf(filename, sizeof(filename), "%sstatus", dir_name); ^~~~~~~~~~~~~~ /source/pdig/udig_procs.c:556:40: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 252 [-Wformat-truncation=] 556 snprintf(filename, sizeof(filename), "%scmdline", dir_name); ^~ ~~~~ /source/pdig/udig_procs.c:556:2: note: 'snprintf' output between 8 and 263 bytes into a destination of size 252 556 snprintf(filename, sizeof(filename), "%scmdline", dir_name); ^~~~~~~~~~~~~~~ /source/pdig/udig_procs.c:579:46: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 1024 [-Wformat-truncation=] 579 snprintf(tinfo->exe, SCAP_MAX_PATH_SIZE, "%s", line); ^~ ~~~~ /source/pdig/udig_procs.c:579:4: note: 'snprintf' output between 1 and 4096 bytes into a destination of size 1024 579 snprintf(tinfo->exe, SCAP_MAX_PATH_SIZE, "%s", line); ^~~~~~~~~~~~ /source/pdig/udig_procs.c:603:40: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 252 [-Wformat-truncation=] 603 snprintf(filename, sizeof(filename), "%senviron", dir_name); ^~ ~~~~ /source/pdig/udig_procs.c:603:2: note: 'snprintf' output between 8 and 263 bytes into a destination of size 252 603 snprintf(filename, sizeof(filename), "%senviron", dir_name); ^~~~~~~~~~~~~~~ [ 50%] Building C object CMakeFiles/pdig.dir/source/libs/driver/dynamic_params_table.c.o [ 56%] Building C object CMakeFiles/pdig.dir/source/libs/driver/event_table.c.o [ 62%] Building C object CMakeFiles/pdig.dir/source/libs/driver/flags_table.c.o [ 68%] Building C object CMakeFiles/pdig.dir/source/libs/driver/ppm_events.c.o In file included from /source/libs/driver/ppm_events.c:77: /source/pdig/udig_capture.h:25: warning: "F_CANCELLK" redefined 25 #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
In file included from /source/libs/driver/ppm_events.c:50: /usr/include/fcntl.h:127: note: this is the location of the previous definition 127 #define F_CANCELLK 1029
/source/libs/driver/ppm_events.c: In function 'parse_readv_writev_bufs': /source/libs/driver/ppm_events.c:1366:15: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized] 1366 args->fd = (int)val; ^~~~ [ 75%] Building C object CMakeFiles/pdig.dir/source/libs/driver/ppm_fillers.c.o In file included from /source/libs/driver/ppm_fillers.c:78: /source/pdig/udig_capture.h:25: warning: "F_CANCELLK" redefined 25 #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
In file included from /source/libs/driver/ppm_fillers.c:54: /usr/include/fcntl.h:127: note: this is the location of the previous definition 127 #define F_CANCELLK 1029

/source/libs/driver/ppm_fillers.c: In function 'f_sys_socketpair_x': /source/libs/driver/ppm_fillers.c:1595:15: warning: unused variable 'speer' [-Wunused-variable] 1595 | struct sock speer; | ^~~~~ /source/libs/driver/ppm_fillers.c:1594:20: warning: unused variable 'us' [-Wunused-variable] 1594 | struct unix_sock us; | ^~ /source/libs/driver/ppm_fillers.c:1593:17: warning: unused variable 'sock' [-Wunused-variable] 1593 | struct socket sock; | ^~~~ /source/libs/driver/ppm_fillers.c:1592:6: warning: unused variable 'err' [-Wunused-variable] 1592 | int err; | ^~~ /source/libs/driver/ppm_fillers.c:1591:6: warning: unused variable 'fds' [-Wunused-variable] 1591 | int fds[2]; | ^~~ /source/libs/driver/ppm_fillers.c:1590:16: warning: unused variable 'val' [-Wunused-variable] 1590 | unsigned long val; | ^~~ /source/libs/driver/ppm_fillers.c: In function 'f_sys_accept_x': /source/libs/driver/ppm_fillers.c:1973:17: warning: unused variable 'sock' [-Wunused-variable] 1973 | struct socket sock; | ^~~~ /source/libs/driver/ppm_fillers.c:1972:6: warning: unused variable 'err' [-Wunused-variable] 1972 | int err = 0; | ^~~ /source/libs/driver/ppm_fillers.c: In function 'f_sys_pipe_x': /source/libs/driver/ppm_fillers.c:2814:15: warning: unused variable 'file' [-Wunused-variable] 2814 | struct file file; | ^~~~ /source/libs/driver/ppm_fillers.c: In function 'f_sys_openat2_e': /source/libs/driver/ppm_fillers.c:4616:18: error: storage size of 'how' isn't known 4616 | struct open_how how; | ^~~ /source/libs/driver/ppm_fillers.c:4650:53: error: invalid application of 'sizeof' to incomplete type 'struct open_how' 4650 | res = ppm_copy_from_user(&how, (void )val, sizeof(struct open_how)); | ^~ /source/libs/driver/ppm_fillers.c:4616:18: warning: unused variable 'how' [-Wunused-variable] 4616 | struct open_how how; | ^~~ /source/libs/driver/ppm_fillers.c: In function 'f_sys_openat2_x': /source/libs/driver/ppm_fillers.c:4698:18: error: storage size of 'how' isn't known 4698 | struct open_how how; | ^~~ /source/libs/driver/ppm_fillers.c:4732:53: error: invalid application of 'sizeof' to incomplete type 'struct open_how' 4732 | res = ppm_copy_from_user(&how, (void *)val, sizeof(struct open_how)); | ^~ /source/libs/driver/ppm_fillers.c:4698:18: warning: unused variable 'how' [-Wunused-variable] 4698 | struct open_how how; | ^~~ make[2]: [CMakeFiles/pdig.dir/build.make:230: CMakeFiles/pdig.dir/source/libs/driver/ppm_fillers.c.o] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/pdig.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

poiana commented 2 years ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana commented 2 years ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh with /remove-lifecycle rotten.

Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle rotten