[genivi-dlt] [patch] Bugfixes and improvements

Vacek, Stefan stefan.vacek at intel.com
Fri Jun 3 08:46:11 EDT 2016

Hi Alex, list,

Please find attached patches to fix bugs and internal improvements.

The patches are:

0001: Rework of initialization and cleanup of the dlt-user-library. We introduced a state-machine in dlt_init()to keep track of what has been initialized and to allow proper cleanup in case an error occurs while initializing the library. Furthermore, we replaced the Booleans dlt_user_initialised and dlt_user_freeing with an enum value representing the current state of the library. The access to this state value is done using atomic builtins to ensure thread-safety. Lastly, the indentation of dlt_user.c was converted from tabs to four spaces per tab.

0002: There was a buffer overflow in DLT_MSG_READ macro which led to out-of-bound writes of the provided buffer.

0003: Fixes usage of DltContext that was not registered before. That required extend the api with an additional function dlt_user_check_context_registered() and to modify the macros DLT_LOG, DLT_LOG_ID, DLT_TRACE_NETWORK and DLT_TRACE_NETWORK_TRUNCATED

0004: In dlt_user_trace_network_truncated() if payload==NULL and length==0, do not throw an error

0005: Fix priority inversion problem on the internally used mutex. Use pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT)

0006: Fix buffer overflows when writing string that exceed the size of the message. The tests are also adapted. One is a fix of the script to test the environment variable that controls the initial log-level (src/tests/dlt-test-change-ll-through-env.sh). Another one is an additional unit-test in tests/gtest_dlt_user.cpp to test if the environment variable was correctly used to determine the initial log-level. And since I got confused how the log-level of a context is derived I added some description (currently part of gtest_dlt_user.cpp) to summarize how the log-level of a context is changed/adapted.

Any feedback is very appreciated.

Best regards,

   Best regards / Mit freundlichem Gruß

   Dr.-Ing. Stefan Vacek
   Transportation Solution Division TSD
   Automotive Innovation & Product Development Center
   Intel Corp. | Emmy-Noether-Str. 9 | Technologiepark | 76131 Karlsruhe | Germany
   Tel: +49 (0)721 6269 5258 | Email: mailto:Stefan.Vacek at intel.com

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Rework-of-initialization-cleanup-of-user-library.patch
Type: application/octet-stream
Size: 124450 bytes
Desc: 0001-Rework-of-initialization-cleanup-of-user-library.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-buffer-overflow-in-dlt_message_payload.patch
Type: application/octet-stream
Size: 9262 bytes
Desc: 0002-Fix-buffer-overflow-in-dlt_message_payload.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Fix-segfault-when-calling-DLT_LOG-on-an-uninitialize.patch
Type: application/octet-stream
Size: 11080 bytes
Desc: 0003-Fix-segfault-when-calling-DLT_LOG-on-an-uninitialize.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Header-and-payload-logging-fixed.patch
Type: application/octet-stream
Size: 3741 bytes
Desc: 0004-Header-and-payload-logging-fixed.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Enabled-mutex-priority-inheritance.patch
Type: application/octet-stream
Size: 1737 bytes
Desc: 0005-Enabled-mutex-priority-inheritance.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Fix-SEGFAULT-in-write_-utf8_-string.patch
Type: application/octet-stream
Size: 26236 bytes
Desc: 0006-Fix-SEGFAULT-in-write_-utf8_-string.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160603/ad50133b/attachment-0005.patch>

More information about the genivi-diagnostic-log-and-trace mailing list