google / path-auditor

Apache License 2.0
251 stars 41 forks source link

Cannot build libpath_auditor.so #3

Open cuckoo-linux opened 4 years ago

cuckoo-linux commented 4 years ago

when I tried to build it using bazel by this command: bazel build //pathauditor/libc:libpath_auditor.so Got this error: INFO: Analyzed target //pathauditor/libc:libpath_auditor.so (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/machine/Downloads/path-auditor-master/pathauditor/BUILD:10:1: C++ compilation of rule '//pathauditor:pathauditor' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 43 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::{anonymous}::FileIsUserControlled(int, absl::string_view)': pathauditor/pathauditor.cc:160:24: error: 'CGROUP2_SUPER_MAGIC' was not declared in this scope fs_buf.f_type == CGROUP2_SUPER_MAGIC) { ^ pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::PathIsUserControlled(const pathauditor::ProcessInformation&, absl::string_view, absl::optional, unsigned int)': pathauditor/pathauditor.cc:224:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < max_iteration_count; i++) { ^ pathauditor/pathauditor.cc:293:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (link_len >= link_buf.memsize()) { ^ Target //pathauditor/libc:libpath_auditor.so failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 3.612s, Critical Path: 2.10s INFO: 1 process: 1 linux-sandbox. FAILED: Build did NOT complete successfully

sroettger commented 4 years ago

Hey, sorry for the delay. Just back at the office :). Can you try the patch above if that resolves the issue for you? Thanks!

p-g-krish commented 4 years ago

When i try this bazel build pathauditor/libc:libpath_auditor.so

=>Facing below error, my os is centos 7

INFO: Analyzed target //pathauditor/libc:libpath_auditor.so (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/oracle/rnd/path-auditor/pathauditor/BUILD:10:1: C++ compilation of rule '//pathauditor:pathauditor' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 43 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::{anonymous}::FileIsUserControlled(int, absl::string_view)': pathauditor/pathauditor.cc:160:24: error: 'CGROUP2_SUPER_MAGIC' was not declared in this scope fs_buf.f_type == CGROUP2_SUPER_MAGIC) { ^ pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::FileEventIsUserControlled(const pathauditor::ProcessInformation&, const pathauditor::FileEvent&)': pathauditor/pathauditor.cc:389:10: error: 'SYS_execveat' was not declared in this scope case SYS_execveat: { ^ Target //pathauditor/libc:libpath_auditor.so failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 3.079s, Critical Path: 1.43s INFO: 11 processes: 11 linux-sandbox. FAILED: Build did NOT complete successfully [oracle@localhost path-auditor]$ bazel build //pathauditor/libc:libpath_auditor.so INFO: Analyzed target //pathauditor/libc:libpath_auditor.so (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/oracle/rnd/path-auditor/pathauditor/BUILD:10:1: C++ compilation of rule '//pathauditor:pathauditor' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 43 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::{anonymous}::FileIsUserControlled(int, absl::string_view)': pathauditor/pathauditor.cc:160:24: error: 'CGROUP2_SUPER_MAGIC' was not declared in this scope fs_buf.f_type == CGROUP2_SUPER_MAGIC) { ^ pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::FileEventIsUserControlled(const pathauditor::ProcessInformation&, const pathauditor::FileEvent&)': pathauditor/pathauditor.cc:389:10: error: 'SYS_execveat' was not declared in this scope case SYS_execveat: { ^ Target //pathauditor/libc:libpath_auditor.so failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 1.095s, Critical Path: 0.96s INFO: 0 processes. FAILED: Build did NOT complete successfully [oracle@localhost path-auditor]$ bazel build //pathauditor/libc:libpath_auditor.so INFO: Analyzed target //pathauditor/libc:libpath_auditor.so (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/oracle/rnd/path-auditor/pathauditor/BUILD:10:1: C++ compilation of rule '//pathauditor:pathauditor' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 43 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::{anonymous}::FileIsUserControlled(int, absl::string_view)': pathauditor/pathauditor.cc:160:24: error: 'CGROUP2_SUPER_MAGIC' was not declared in this scope fs_buf.f_type == CGROUP2_SUPER_MAGIC) { ^ pathauditor/pathauditor.cc: In function 'pathauditor::StatusOr pathauditor::FileEventIsUserControlled(const pathauditor::ProcessInformation&, const pathauditor::FileEvent&)': pathauditor/pathauditor.cc:389:10: error: 'SYS_execveat' was not declared in this scope case SYS_execveat: { ^ Target //pathauditor/libc:libpath_auditor.so failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 1.054s, Critical Path: 0.90s INFO: 0 processes. FAILED: Build did NOT complete successfully

sroettger commented 4 years ago

@p-g-krish I updated the pull request #4, could you try it out if it resolves the issue for you? I.e. the changes are in the define_cgroup2_magic branch.