| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In dlt_buffer_read_block() and dlt_buffer_write_block(), read/write position
should be updated in case these positions are equal to the size of ringbuffer.
Adding boundary check in gtest_dlt_common.cpp
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
|
|
|
|
| |
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
|
|
|
|
|
|
|
|
|
| |
This commit fixes to increment read and write point only if memcpy()
succeeded in dlt_buffer_read_block() and dlt_buffer_write_block().
Related issues: https://github.com/GENIVI/dlt-daemon/issues/305
Signed-off-by: Sugiura, Saya <ssugiura@jp.adit-jv.com>
|
|
|
|
|
|
|
| |
json-c dependency was removed from libdlt ('dlt_common') and shifted into 'dlt-control-common'. By this only the command line tools have a dependency on json-c.
dlt-control-common is now built as a static library, so that it can be linked against json-c. Command line tools that included only the .c file of dlt-control-common before, are now linked against this static libarary (see console/CMakeLists.txt).
Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
|
|
|
|
|
|
|
|
| |
dlt_common.c:
-Check if filter file fits into read buffer
-Cast 'filename' into non-const to make it json-c API conform
Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-Added '-j' flag to dlt-receive for reading a json filter file
-Added more attributes to DltFilter (LogLevel, MaxPayload, MinPayload) for extended message filtering, when using old filters these values are set to default. Same behaviour, when they are not defined in json filter file.
-extended dlt_common.c to support json filter files and new DltFilter attributes
+add dlt_json_filter_load to parse a json filter file into a DltFilter
+add dlt_json_filter_save to print a DltFilter into a json file
-Two new libraries are used to parse the json filter files: json-c for Linux based systems and the QNX internal libjson for QNX systems
-gtest_dlt_common was modified to test the new function 'dlt_json_filter_load'
+add testfile_extended.dlt that contains a bigger varity of messages (different context/app IDs, lengths and log levels)
+add testfilter.json which is a valid json filter file
-New dependency on library was added to related CMakeLists and is described in README.md
Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is to revert the following commits:
- de4a4234
- fb9ff078
- db9917b3
- e4467f0e
- a567e01d
Those commits are from improvement but they seem to
break the dlt message header in some cases.
Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The configuration of memory buffer size must be carefully
parsed and validated to avoid segmentation fault
Any misleading information in configuration file must be
considered as major error and dlt-daemon should stop
and raise error message to stderr
This commit also corrects error handling of
dlt_buffer_init_dynamic().
Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the bytes of a RAWD argument were be printed onto the console
as space-separated hex values, making it difficult or impossible to see
where the RAWD argument ends and the next argument starts. For instance,
with code like this:
dlt_user_log_write_raw(&ctxData, "data", 4);
dlt_user_log_write_uint8(&ctxData, 53);
the console output is shown as:
[64 61 54 61 53]
and there is no indication that there are two arguments, one RAWD and
one UINT8.
This patch changes for console formatting of RAW data to separate by
apostrophs, making the above message appear as:
[64'61'54'61 53]
This makes it immediately obvious that there is a RAWD argument, and
still keeps the separators quite unobtrusive.
Signed-off-by: Martin Willers <M.Willers@gmx.net>
|
|
|
|
|
|
| |
dlt_user_log_write_*_attr() enables to writing these types, but also support
adding "attributes" for them, i.e. a "name" and a "unit".
Signed-off-by: Martin Willers <M.Willers@gmx.net>
|
|
|
|
|
|
|
| |
CVE: CVE-2020-29394
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
Co-authored-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
|
|
|
|
| |
- Checking size of buffer and size of message before using memcpy().
- Adding configuration file for testfilter in /tests/CMakeLists.txt.
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
| |
- Converting datatype to the correct one.
- As macro do not perform type-checking before, so these functions used
it with different datatype could create a lot of conversion warnings.
For this reason, these warnings could be consider as normal
information and will not be fixed.
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Change the data type of variable 'size' in DltContextData struct
(dlt_user.h.in). Variable 'size' was used repeated with function
'sizeof()' many time, so change type to 'size_t' can avoid a lot of
warnings.
- Adding temporary variable to calculate the datasize header (define in
dlt_common.h) in 'dlt_common.c' file.
Signed-off-by: Dinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
| |
- Data type of 'textlength' create a lot of warnings while using in
function 'snprintf()', so change data type to 'size_t' will resolve
these warnings.
- Change data type of variable 'size' to the right type 'unsigned int',
which is located in struct DltBuffer in dlt_common.h (line 832).
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
|
|
|
|
|
|
|
|
|
| |
- Correct the data type of 'headersize' and 'datasize' variables in
header 'dlt_common.h', then config those functions using this library.
- Explicit the data type.
Signed-off-by: Dinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>
|
|
|
|
|
|
|
| |
Add function dlt_execute_command() to execute system command using
execvp.
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Some functions validated file descriptor to be greater 0.
If a process is started without stdin, stdout and stderr
the first file descriptor allocated by the process will be 0.
This also will be the case if the above mentioned file descriptors
will be closed on purpose.
As 0 is a valid fd, some methods had to be changed to reflect this.
Signed-off-by: Alexander Mohr <alexander.m.mohr@daimler.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For more information about VSOCK, see "man vsock"
( https://man7.org/linux/man-pages/man7/vsock.7.html ).
Makes it possible for processes in a virtual machine to log directly in
DLT running on host without setting up a network connection between
guest and host. It is also probably more efficient. Have not done any
performance measurements (not main reason for patch), but no forwarding
is required as when running DLT in a multi-node setup.
When building dlt-daemon for host, WITH_DLT_DAEMON_VSOCK_IPC should be
enabled for daemon to listen on incoming VSOCK requests. Local
communication method between applications and daemon is still determined
with DLT_IPC. When building for guest, WITH_DLT_LIB_VSOCK_IPC should be
enabled and DLT_IPC will be ignored, which will make libdlt open a VSOCK
socket to the deamon for logging messages.
VSOCK can be tested without a virtual machine. Since VMADDR_CID_HOST is
used by libdlt when connecting, see vsock man page, clients can be run
on host to test VSOCK communication.
Some modifications has been done to be able to handle logging through
FIFO pipe and socket in the same build of dlt-daemon:
- dlt_receiver_init/free_unix_socket() is renamed to
dlt_receiver_init/free_global_buffer() and used for FIFO as well.
Also fixes memory leak since dlt_receiver_free_unix_socket() was used
regardless of whether DLT_USE_UNIX_SOCKET was defined or not.
- Pass type to dlt_receiver_init() instead of dlt_receiver_receive().
And remove preprocessor conditionals for handling
DLT_CONNECTION_APP_MSG in dlt_daemon_process_user_messages(). Also
fixes wrong enum type being passed to dlt_receiver_receive() in
dlt_client.c (DltClient::mode was used as a DltReceiverType enum but
it is a DltClientMode enum).
- Add a flag to DltDaemonApplication to indicate whether file descriptor
is "owned" by the DltDaemonApplication or not. When
dlt_daemon_application_add() is called due to message received on a
socket, fd is passed as an argument (app does not own fd). For FIFO,
a per application FIFO is opened (app owns the fd). Also fixes so that
user handle is reset for both application and all its contexts when
resetting any. Prevents fd from being used by accident after it has
been closed.
dlt_mkdir_recursive() is moved to src/daemon since it is only used in
the daemon. Minimizes use of DLT_USE_UNIX_SOCKET_IPC.
Other bugfixes:
- Call DLT_SEM_FREE() if setting socket to O_NONBLOCK fails in
src/lib/dlt_user.c:dlt_initialize_socket_connection().
- Close socket if dlt_receiver_init() fails in
src/lib/dlt_user.c:dlt_initialize_socket_connection().
Signed-off-by: Martin Ejdestig <martin.ejdestig@volvocars.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no check if "data" fits into the ring buffer buffer.
This causes a write heap buffer overflow.
If data is too big for the ringbuffer nothing is written to the
ringbuffer and a error is logged
If the buffers are bigger than the free space in the ringbuffer, the
ringbuffer is increased by a step size set at initialization.
But there is no check if this increase was sufficient.
Fix this by using a while loop that increases the ring buffer size until
it is big enough or the buffer can not be further increased.
Signed-off-by: Jan Schrewe <schrewe@uni-bonn.de>
|
|
|
|
|
|
|
| |
A buffer overflow in the dlt_filter_load function in dlt_common.c in dlt-daemon allows arbitrary code execution via an unsafe usage of fscanf, because it does not limit the number of characters to be read in a format argument.
Fixed: #274
Signed-off-by: GwanYeong Kim <gy741.kim@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a 4-chars CTXID, i.e. one that does not include a null character,
the strlen() calls were happily accessing memory until they eventually
encountered a null character somewhere in memory.
This was detected by valgrind, which reported a memory error when
using a CTXID such as "INTM":
==21924== Conditional jump or move depends on uninitialised value(s)
==21924== at 0x4C30F78: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21924== by 0x4E4B5A0: dlt_print_id (dlt_common.c:303)
==21924== by 0x4E4CF47: dlt_message_header_flags (dlt_common.c:687)
==21924== by 0x4E51434: dlt_message_print_ascii (dlt_common.c:3169)
==21924== by 0x4E4247A: dlt_user_print_msg (dlt_user.c:4108)
==21924== by 0x4E46D92: dlt_user_log_send_log (dlt_user.c:3670)
==21924== by 0x4E46F14: dlt_user_log_write_finish (dlt_user.c:1611)
Sanitize some code
Using memset() and memcpy() is always preferable to hand-rolled loops,
because compilers have built-in support for them.
Signed-off-by: Martin Willers <M.Willers@gmx.net>
|
|
|
| |
Signed-off-by: Moritz Warning <moritzwarning@web.de>
|
|
|
|
|
|
|
|
|
| |
* Add UDP multicast support on client side
UDP multicast support is already present on server side. This
patch add seemless support for UDP multicast on client side
in dlt-receive.
Signed-off-by: Joao Sousa <joao.sa.sousa@ctw.bmwgroup.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dlt_common
- Add preprocessor DLT_USE_UNIX_SOCKET_IPC for dlt_log_set_fifo_basedir() and
dltFifoBaseDir variable
- Rename input parameter of dlt_log_set_fifo_basedir()
dlt-daemon
- Replace setting dltFifoBaseDir by dlt_log_set_fifo_basedir() and add preproc
DLT_USE_UNIX_SOCKET_IPC
- Update -h opt and flags.loggingFilename based on IPC type
Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
|
|
|
|
|
|
|
| |
Relocate the setting of dltFifoBaseDir variable from dlt_init() to
dlt_check_envvar()
Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
|
|
|
|
|
|
| |
Introduce new API to support quick parsing a DLT file.
Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
- daemon: New feature for LoggingMode at /etc/dlt.conf to be able to
set value at 3 in order to redirect all stdout messages to stderr.
- libdlt: New feature for DLT_LOG_MODE environment variable to be able
to set value at 3 in order to redirect all stdout messages to stderr.
- unit test: Add test cases for DLT_LOG_TO_STDERR
Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the current implementation, we believe in user to treat
General section as Mandatory. Hence system could be reset
due to memory of connections incorrectly.
At the moment, General could be handled as Optional with default value
of interval. It means General could be absent from config file.
Improvement is to raise WARNING to user, set default value and
update the number of connections properly.
Signed-off-by: Bui Nguyen Quoc Thanh <Thanh.BuiNguyenQuoc@vn.bosch.com>
|
|
|
|
|
|
|
|
|
| |
- Introduce "General" section for dlt_gateway.conf
- In new section, the interval is used for gateway timer.
This entry is optional. By default, it is set to 1 second
as the existing hardcoded value.
Signed-off-by: Bui Nguyen Quoc Thanh <Thanh.BuiNguyenQuoc@vn.bosch.com>
|
|
|
|
|
|
|
|
|
| |
Many stringop-truncation and stringop-overflow warnings are still
there (so many).
https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
|
| |
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
|
| |
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
|
|
|
|
|
| |
Current dlt_file_read_header() function which is used for e.g.
dlt-convert, dlt-sortbytimestamp, etc. stops finding DLT header if it's
not available in the next file position. It is improved to read the
header in a loop until it's found.
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
|
|
|
|
|
| |
Signed-off-by: Felix Herrmann <external.Felix.Herrmann3@de.bosch.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
|
|
|
|
| |
This reverts commit e420ee62d89d5efab6ad7275910cb3eec8497da6.
|
|
|
|
|
|
| |
The log message was printed as a signed value for uint64 type. This
commit fixes to print as an unsigned value.
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
|
|
|
|
|
|
| |
A DLT lib user can create a message large enough that
dlt_user.resend_buffer is not large enough, and thus it will overflow
Signed-off-by: Ricardo Leite <rleite@dcc.fc.up.pt>
|
|
|
|
|
|
|
| |
Check for file == null before accessing the pointer
for a debug message
Signed-off-by: Sebastian Kloska <sebastian.kloska@snafu.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Symptome: If access to the trace directory is not
granted by AppArmor access(...) still reports otherwise.
dlt_offline_trace_get_total_size(...)
tries to open the dir via opendir(...) and tries a
readdir without any further check, which results in an
SEGFAULT
* Solution: (1) Make dlt_offline_trace_get_total_size return
ssize_t instead of unsigned long, which gives us a
chance to return an error state (2) Check the return value
from opendir(...) and bail out on error. Use this to return
DLT_RETURN_ERROR in dlt_offline_trace_check_size.
* ToDo: (1) Error state is not yet checked and reported
back. On Error we just don't generate any offline
log files without any further complain. (2) Find a replacement
for access(...) which reports properly under AppArmor.
(3) Report the confusing behaviour of access(...) to the
AppArmor team.
Signed-off-by: Sebastian Kloska <seebastian.kloska@snafu.de>
|
|
|
| |
Signed-off-by: Sebastian Lipponer <mail@sebastianlipponer.de>
|
|
|
|
|
|
|
|
|
| |
The use of this macro in a if condition is actually non-standard C++
code. GCC issues a warning that ISO C++ forbids braced-groups within
expressions when compiled with -Wpedantic. Other compilers fail with an
error. Change the macro to an internal function in order to improve the
portability to other platforms (i.e. MSVC, proprietary embedded).
Signed-off-by: Sebastian Lipponer <mail@sebastianlipponer.de>
|
|
|
|
|
|
|
|
| |
Fix the issue that DLT offline trace creating mutiple files
even after reaching MaxTrace size when filename is index based.
Related to: https://github.com/GENIVI/dlt-daemon/pull/174
Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
|
|
|
|
|
|
|
|
|
| |
* Avoided Seg fault in dlt_message_payload (#179)
Avoided Seg fault by adding boundary check before buffer access.
Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com>
Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
|
|
|
|
|
|
|
| |
The function dlt_offline_trace_file_name() use sizeof the
pointer as the maximum file name size, so it cannot create
the file name as expected.
Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
|
|
|
|
|
|
|
| |
This commit is fixed the memory leak in case the dlt application do
reattach to the daemon.
Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
|
|
|
|
|
|
| |
Since localtime() was calling tzset() internally, it should be used
before localtime_r(). Refer to man page of localtime_r() for detail.
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
|
|
|
|
|
|
| |
This commit includes improvement of related code.
Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
|
|
|
|
| |
Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
|
|
|
|
|
|
|
|
|
|
| |
With this commit, following DLT user service IDs are now free to use:
- 0xF0A
- 0xF0F to 0xFFE
Also the cases in dlt_daemon_client_process_control() is reordered so
that it matches the order of dlt_user_services enum.
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
|