Commit Graph

122 Commits

Author SHA1 Message Date
Mike Myers
3fc12a2a20
Reduce the compilation units from libarchive (#6886) 2021-01-11 09:26:44 -08:00
Stefano Bonicatti
8cc6d99c66
Fix a leak in libdpkg when querying the deb_packages table (#6892)
libdpkg is leaking memory on every initialization.
Initialization happens everytime deb_packages gets queried.

The memory leaked is allocated for the "triggersdir"
global variable by "dpkg_db_get_path" called in "trigdef_update_start".
"trigdef_update_start" is called by "trig_incorporate" just after
the memory for "triggersdir" has been allocated.
In some occasions "trigdef_update_start" is also called two times in a
row. In all these cases the memory do not get deallocated in between calls,
so the old memory is lost.

Since the result of "dpkg_db_get_path" depends on the database dir that
has been set, and in the "trigdef_update_start" function it's not possible
to know if it has changed from the previous allocation or not,
it's necessary to always deallocate vs just avoid to call "dpkg_db_get_path".

Fix also a couple of other leaks on error.
2021-01-10 16:43:25 -05:00
Teddy Reed
7a24b00f18
Add patch for apache/thrift#2083 (#6846) 2020-12-28 20:46:34 -05:00
Stefano Bonicatti
1dd51f288d
Remove the last usage of sqlite3 from sleuthkit (#6858)
To completely remove sqlite3 as a dependency of sleuthkit,
case_db.cpp and auto_db.cpp should not be compiled,
because both depend on the header tsk_case_db.h,
which in turn include tsk_db_sqlite.h
which then depends on the sqlite3.h header.
2020-12-28 16:29:53 -05:00
Stefano Bonicatti
7455824c43
CMake: Do not attempt to dllimport Thrift symbols (#6856)
The THRIFT_STATIC_DEFINE define should be publicly used,
because it's used in a header that will be included by osquery.
2020-12-27 19:39:33 -05:00
Teddy Reed
253ac2c893
Update thrift to version 0.13.0 (#6822)
Code generation with:

$ thrift --gen cpp:moveable_types ./osquery.thrift
$ make format
2020-12-22 15:41:22 -05:00
Stefano Bonicatti
e14be45801
CMake: Add Valgrind support (#6834)
Add OSQUERY_ENABLE_VALGRIND_SUPPORT so that it's possible
to run osquery under Valgrind.
This is specifically required by the boost library
that needs to be compiled with a special define
and it also requires the valgrind.h header.

Also move the defines for the ASAN usage to the boost
library CMakeLists.txt instead of being in flags.cmake.
This way we reduce the unnecessary recompilation of code that
doesn't depend on boost, when switching options.
2020-12-22 09:04:51 -05:00
Teddy Reed
99b9857d92
Use make jobserver for OpenSSL on Linux and macOS (#6821) 2020-12-21 21:48:49 -05:00
Stefano Bonicatti
1e3e4bc653
Update openssl to version 1.1.1i (#6820) 2020-12-19 19:00:26 -05:00
Alessandro Gario
32cc8ff54f
libs: Update sqlite to version 3.34.0 (#6804) 2020-12-12 18:40:09 -05:00
Alessandro Gario
719cb9b986
libs: Update bzip2 to version 1.0.8 (#6786) 2020-12-03 11:56:45 +01:00
Stefano Bonicatti
4dd97ea6a0
Update cmake_minum_required to 3.17.5 and pin version in CI (#6770) 2020-11-30 15:02:19 +01:00
Alessandro Gario
6ab99467cd
libs: Update BPF libraries to support LLVM 11 (#6775) 2020-11-29 14:38:27 +01:00
Alessandro Gario
fc2bf46c9c
libs: Port the RocksDB Win7 compat patch to MSBuild (#6765) 2020-11-26 13:40:40 +01:00
Alessandro Gario
76c7733a75
Port the extended_attributes table to Linux, add support for Linux capabilities (#6195) 2020-11-24 13:36:56 -08:00
Alessandro Gario
37f2be6143
CMake: Disable BPF support if the LLVM libs are not compatible (#6746) 2020-11-24 13:50:18 -05:00
Alessandro Gario
bf46e53995
libs: Update ebpfpub to latest version (#6757)
This imports an upstream commit that fixes an assert on single core machines
2020-11-22 22:40:10 -08:00
Rachel Cipkins
82908870a1
startup_items: Add systemd support on Linux (#6562)
Co-authored-by: Alessandro Gario <alessandro.gario@gmail.com>
2020-11-22 22:37:55 -08:00
Alessandro Gario
dab1a20582
libs: Update RocksDB to version 6.14.5 (#6759) 2020-11-21 17:41:16 +01:00
Sharvil Shah
e2b3598bac
libs: update aws-sdk to 1.7.230 (#6749) 2020-11-18 10:06:10 -08:00
Alessandro Gario
5daeed98c0
BPF: Implement additional syscalls to track fd usage (#6723)
Add support for mknod, mknodat, name_to_handle_at,
open_by_handle_at
2020-11-11 11:28:32 +01:00
Alessandro Gario
8753dbfd84
BPF: Add container support to fork/vfork/clone (#6721)
Update the tracing logic for the fork/vfork/clone system calls, allowing osquery to retrieve PIDs in the host namespace even when using containers
2020-10-27 20:04:31 -04:00
Sharvil Shah
ceeadb5c9a
build: Fix windows build on newer MSVC (#6732)
Correct how cmake passes the include for `random_shuffle`
2020-10-27 20:00:52 -04:00
Alessandro Gario
5c1bf4ff0c
Initial implementations for BPF-based socket and process events tables (#6571)
* deb_packages: Fix include order issue

* bpf_socket_events, bpf_process_events: Initial implementation

* BPF: Add process tracking to process events, remove sockets_event

* CMake: Upgrade the C++ standard to C++17

* BPF: Improve initial system state snapshot and event collection

* BPF: Add tests for SystemStateTracker

* BPF: Add tests for BPFEventPublisher

* BPF: Refactor, add tests for ProcessContextFactory

* Refactor: Improve initial scan/event handling, fix openat

* BPF: Improve event ordering

* BPF: Fix test issue in BPFEventPublisher::processOpenAt

* BPF: Mark WIP functions as deprecated

* BPF: Improve tests

* BPF: Add back bpf_socket_events and connect() support

* BPF: Add Netlink addr support, add bind()

* BPF: Add accept/accept4 support

* BPF: Add tests for BPFEventPublisher::processOpenat2Event

* BPF: Add remaining tests for BPFEventPublisher

* BPF: Add configuration flags for memory management

* BPF: Add cmdline support to ProcessContextFactory

* BPF: Add additional tests

* BPF: Add unit test for SystemStateTracker::accept

* BPF: Update cwd handling

* BPF: Add tests for bpf_socket_events

* BPF: Add tests for bpf_process_events

* BPF: Add json_cmdline hidden column to bpf_process_events

* BPF: Update all copyright headers

* BPF: Add syscall duration in socket_events/process_events

* BPF: Code review changes

* BPF: Update ebpfpub to the latest version

* BPF: Removed unused functions

* BPF: Code review changes

Add whitespace around namespaces

* BPF: Revert header changes in rot13.cpp

* BPF: Code review changes

Rename the bpf_ntime column in bpf_socket_events/bpf_process_events
to ntime and make it the last visible column

* BPF: Code review changes

Update the dependencies for the BPF tests

* BPF: Code review changes

Update the dependencies for the BPF table tests

* BPF: Code review changes

Update how characters are appended to strings in the
system state tracker class

* BPF: Code review changes

Update the string -> integer conversion utilities in the
process context factory class.

* BPF: Hide failed exec syscalls from bpf_process_events results

* BPF: Do not log an error for invalid sockaddr structures

* BPF: Code review changes

Remove clang-format ignore block

* BPF: Code review changes

Update log messages in the BPFEventPublisher class

* BPF: Code review changes

Remove clang-format ignore block around the function tracer
descriptors

* BPF: Code review changes

Document the IFilesystem interface

* BPF: Code review changes

Document the IProcessContextFactory interface

* BPF: Code review changes

Document the ISystemStateTracker interface
2020-10-16 01:14:00 -07:00
Teddy Reed
ad2c5c0c6e
libraries: Build x86_64 configurations on Ubuntu 14.04 (#6687) 2020-10-13 10:20:23 -04:00
Teddy Reed
70d05a4b95
Add a README.md to source-based libraries (#6686) 2020-10-07 10:23:37 -04:00
Teddy Reed
4f9ab34581
libs: Set glog and gflags includes as SYSTEM (#6635) 2020-09-08 16:15:44 -04:00
Artemis Tosini
ea70cde29d libs/smartmontools: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
7eabe51bae libs/lzma: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Co-Authored-By: Alessandro Gario <alessandro.gario@gmail.com>
2020-09-05 16:50:28 -04:00
Artemis Tosini
4ea5db73a6 libs/lldpd: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
41f58c1e3d libs/librdkafka: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Co-Authored-By: Alessandro Gario <alessandro.gario@gmail.com>
2020-09-05 16:50:28 -04:00
Artemis Tosini
028810ed05 libs/libgpg-error: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
96000c74a0 libs/libgcrypt: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
79eed8b059 libs/libdpkg: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
89ca3f9b09 libs/libaudit: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
5b84482b6f libs/boost: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
a417b0845f libs/berkeley-db: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
48926e1d07 libs/aws-sdk-cpp: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Artemis Tosini
51a123fa2f libs/openssl: Add aarch64 support
Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Breakwell
6d57dc8066
Windows 32 bit Support (#6543) 2020-09-01 23:29:26 -04:00
Teddy Reed
37fd74c2f4
bug: Fix buildup of RocksDB SST files (#6606) 2020-08-28 16:19:42 -04:00
seph
29f4694df2
Update copyright notices (#6589)
Bulk update copyright notices from Facebook to "The osquery authors"
2020-08-11 16:46:54 -04:00
AE1020
7a148eea0b
CMake detect MAJOR_IN_SYSMACROS/MKDEV for librpm (#6554)
Starting in glibc 2.25, the macros `major` and `minor` were moved
from `<sys/types.h>` to `<sys/sysmacros.h>`, to stop leaking these
common words into the global namespace of those including <stdlib.h>

https://sourceware.org/bugzilla/show_bug.cgi?format=multiple&id=19239

The macros MAJOR_IN_MKDEV and MAJOR_IN_SYSMACROS would be defined if
necessary by autoconfig, and put in `config.h`. But osquery build
uses CMake instead of autotools, with a git-committed `config.h`.
This generally is all right across Ubuntu variations, as an automake
for one will likely make a config.h that works on others. However
the glibc change makes a "one-size-fits-all-Ubuntu" config impossible.

This mirrors detection done by autoconf/headers.m4 as CMake code.
It is a relatively simple patch, which unblocks building of librpm
on (K)ubuntu 20 while still working on Ubuntu 18.
2020-08-02 12:00:33 -04:00
kumarak
2aa313db40
Enable yara table on windows (#6564) 2020-07-23 21:16:10 -04:00
kumarak
e915047bc4
Update YARA library to 4.0.2 (#6559) 2020-07-20 21:50:16 -04:00
Teddy Reed
c250dac2e7
build: Support ASAN for boost coroutine2 using ucontext (#6531) 2020-07-01 15:45:57 -04:00
Stefano Bonicatti
c691ac64cd
Actually use the patched libelfin version (#6480)
This is a followup of PR osquery/osquery#6472,
while the code was patched we were still using the unpatched version.
This should finally fix ossfuzz build failure.
2020-06-04 21:16:28 -04:00
herbmaster
ef65c779b1
Link librdkafka on windows (#6454) 2020-06-01 15:53:01 -04:00
Stefano Bonicatti
7f21ccfe67
Drop the facebook and source_migration layers (#6473)
We have ported all platforms to use the source layer.
The facebook layer is not needed anymore since we build everything from source now,
the same is for the transitional source_migration layer.

Minor cleanups about the recently removed python modules.
2020-06-01 09:58:56 -04:00
Stefano Bonicatti
ada1692417
Fix libelfin build on ossfuzz and LLVM/Clang 10 (#6472)
The set_binding function is incorrectly marked as const,
since it actually modifies one of the struct members.
This was somehow not caught by older compilers,
but is failing on LLVM/Clang 10, so we create a patch to fix this.
2020-06-01 09:57:55 -04:00