Mateusz Majewski [Fri, 1 Sep 2023 12:54:40 +0000 (14:54 +0200)]
zlogger: add bitmap ioctl
This allows the client to get the bitmap of "hot" blocks, or the ones
that might have new logs in them. This way the client needn't loop
though the memory that is guaranteed to not have any logs.
Change-Id: I22cd987aed5f95423f89ceb981d29cc9c35a671f
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Marek Szyprowski [Thu, 7 Sep 2023 09:06:57 +0000 (11:06 +0200)]
zlogger: rework locking to fix potential AB-BA deadlock
Resolve potential AB-BA deadlock between g_block_mutex and mmap semaphore
by always taking mmap semaphore first. Also ensure that all operations on
internal structures are performed at least under the the g_block_mutex to
keep system state consistent.
Change-Id: Ib5b0bc2cbfc2b4d443cbee6f5460e8414c34090f
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Mon, 11 Sep 2023 15:42:13 +0000 (17:42 +0200)]
zlogger: asorted code cleanup
Simplify code a bit by reusing common part.
Change-Id: I95f0c5f89b3d89fde2961e6cd7aa5c31aa2e61f4
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Mateusz Majewski [Mon, 28 Aug 2023 06:39:42 +0000 (08:39 +0200)]
zlogger: drop old kernel support
The oldest kernel this is currently built against is 5.15.
Change-Id: I4b02abcd5785fe75c79eb05f30aa68ce1d555b71
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Fri, 25 Aug 2023 10:13:39 +0000 (12:13 +0200)]
zlogger: remove outdated comment
The comment isn't outright false, as the userspace might really be using
the block. However,
3a489d20b218eec5073f18e5b248ced6c6a843d8 handles
exactly that case, so it is completely normal and correct to unmap the
block that is in use.
Change-Id: Icc4bec0268a3cba23990e35fb36448851ca4fb1f
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Fri, 25 Aug 2023 10:11:10 +0000 (12:11 +0200)]
zlogger: improve zlog_task
Currently, there is some attempt at handling completion, but it does not
work correctly; unloading the module results in an immediate kernel
oops. Additionally, the module attempts to track whether the task is
running, but this is not necessary due to how modules work in Linux. We
rewrite these part to use standard kernel APIs in a more direct way.
Change-Id: I92b815660e81d47e056a436a1d73bdfdde60bce2
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Marek Szyprowski [Wed, 19 Apr 2023 16:21:28 +0000 (18:21 +0200)]
logger: fix corner case in stdout mode
Writing large messages via stdout API might trigger the following kernel
BUG:
usercopy: Kernel memory overwrite attempt detected to SLUB object 'kmalloc-4k' (offset 161, size 4062)!
------------[ cut here ]------------
kernel BUG at mm/usercopy.c:103!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in: r8168(O) pgdrv(O) machine_dlkm(O) wcd938x_slave_dlkm(O) wcd938x_dlkm(O) wcd9xxx_dlkm(O) tx_ma)
Process ros2 (pid: 10140, stack limit = 0xffffff80103e0000)
CPU: 7 PID: 10140 Comm: ros2 Tainted: G S O 4.19.157-arm64-rb5 #1
Hardware name: Qualcomm Technologies, Inc. qrb5165 IOT RB5 (DT)
pstate:
40400005 (nZcv daif +PAN -UAO)
pc : usercopy_abort+0xac/0xb0
lr : usercopy_abort+0xac/0xb0
..
Call trace:
usercopy_abort+0xac/0xb0
__check_heap_object+0x14c/0x168
__check_object_size.part.0+0x22c/0x410
__check_object_size+0x48/0x58
logger_write_iter+0x26c/0x5b8 [logger]
__vfs_write+0x124/0x178
vfs_write+0xb8/0x1d0
ksys_write+0x74/0xe8
__arm64_sys_write+0x24/0x30
el0_svc_common.constprop.0+0x78/0x170
el0_svc_handler+0x70/0x90
el0_svc+0x8/0xc
Code:
aa1403e3 9000e3a0 910c2000 97fa0b2f (
d4210000)
---[ end trace
7bfe613c5072c5df ]---
Fix this by properly adjusting the size of the data-to-be-copied for the
next loop iteration.
Change-Id: I33cf8b37f4c18c943af9d1df27a19a3ba169ad03
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Mateusz Majewski [Fri, 20 Jan 2023 10:08:10 +0000 (11:08 +0100)]
zlogger: add a missing mutex unlock
Change-Id: I1bfc06aed2d17218ecdbbaf6e8d09b87220160cb
Marek Szyprowski [Mon, 12 Dec 2022 13:30:40 +0000 (14:30 +0100)]
zlogger: fix potential NULL pointer dereference
Change-Id: I32ddd832bb9ece441fbe93e88b8d363b79e82487
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Karol Lewandowski [Fri, 28 Oct 2022 11:39:52 +0000 (13:39 +0200)]
Release 7.5.0
This release brings zlogger rewrite for security and adjusts kdbus to v5.15 linux kernel.
Change-Id: Ibb75aeba2d4914078afaff111920f21184d2567e
Karol Lewandowski [Fri, 28 Oct 2022 11:38:41 +0000 (11:38 +0000)]
Merge "zlogger: free unused thread hashtable entries" into tizen
Karol Lewandowski [Fri, 28 Oct 2022 11:38:30 +0000 (11:38 +0000)]
Merge "zlogger: map only the actively used buffer to the userspace" into tizen
Karol Lewandowski [Fri, 28 Oct 2022 11:38:17 +0000 (11:38 +0000)]
Merge "zlogger: remove all, legacy crappy /sys interface" into tizen
Karol Lewandowski [Fri, 28 Oct 2022 11:32:30 +0000 (11:32 +0000)]
Merge "zlogger: rewrite cleanup task to use hash_for_each_safe()" into tizen
Karol Lewandowski [Fri, 28 Oct 2022 11:32:22 +0000 (11:32 +0000)]
Merge "zlogger: drop unused field" into tizen
Karol Lewandowski [Fri, 28 Oct 2022 11:32:09 +0000 (11:32 +0000)]
Merge changes from topic "minor-zlogger-fixes-10-2022" into tizen
* changes:
zlogger: propagate written data length correctly
zlogger: remove redundant checks
zlogger: ensure the written data ends with a \0
zlogger: ensure the timestamp always increases
Marek Szyprowski [Wed, 26 Oct 2022 11:38:16 +0000 (13:38 +0200)]
kdbus: adapt to Linux v5.15 release
Change-Id: I272a0e64cd2a849366803505a291eb2d31548b7b
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Wed, 26 Oct 2022 11:37:30 +0000 (13:37 +0200)]
kdbus: remove set_fs() calls
The iov_iter based calls seems to already handle the kernel memory as
source or destination, when iov_iter is created from iov_iter_kvec(),
so there is no need to use the set_fs()-based API to let the called
functions access userspace. Those set_fs() calls were there from the
beginning of the merged kdbus code. They might be an artifact left from
kdbus v2 (where they seems to be really needed) to v3 (which use the
iov_iter and kvec API) update:
https://lore.kernel.org/all/
1421435777-25306-5-git-send-email-gregkh@linuxfoundation.org/
https://lore.kernel.org/all/
1416546149-24799-5-git-send-email-gregkh@linuxfoundation.org/
Change-Id: I25fe3066f073677a00f719af13e9c2ced5b89a47
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Thu, 20 Oct 2022 19:57:49 +0000 (21:57 +0200)]
zlogger: free unused thread hashtable entries
Change-Id: Ifcc729d4a0b8286df5cf2697d93aa5819deb0c5c
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Thu, 15 Sep 2022 11:30:03 +0000 (13:30 +0200)]
zlogger: map only the actively used buffer to the userspace
Each zlogger client maps only a single 4KB buffer and writes to it. Once
it is filled, it calls ALLOC ioctl (like before) and kernel remaps a new
buffer in place of the old buffer.
If kernel needs to free a buffer, the userspace mapping is cleared and
will cause a page fault on the next access, which in turn will cause
allocation of the new buffer just like the ALLOC ioctl does.
Change-Id: I2d6fe8406e201ef20b6378a7ba37ed5df7790406
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Tue, 20 Sep 2022 10:33:47 +0000 (12:33 +0200)]
zlogger: remove all, legacy crappy /sys interface
/sys based interface is no longer used, so remove it completely.
Change-Id: I4565169ad4b7e04f7aca9c73e13a928c85a69f1e
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski [Tue, 20 Sep 2022 11:14:46 +0000 (13:14 +0200)]
zlogger: rewrite cleanup task to use hash_for_each_safe()
Avoid trying all possible tids combination, instead simply iterate over
the hashtable. Also drop some dead code here and there.
Change-Id: If4d4f1dcd742091c0d367db0294f0ddd9401b89f
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Mateusz Majewski [Wed, 12 Oct 2022 12:32:24 +0000 (14:32 +0200)]
zlogger: drop unused field
Change-Id: I27b5b1186a249e4675673648d155334fd1e73709
Mateusz Majewski [Wed, 12 Oct 2022 12:21:04 +0000 (14:21 +0200)]
zlogger: propagate written data length correctly
Change-Id: Ib033ac57d6dd327a76d3a56bf4d41ceddee3ac2d
Michal Bloch [Thu, 13 Oct 2022 14:42:22 +0000 (16:42 +0200)]
zlogger: remove redundant checks
Change-Id: Ife5c039ef61cf28358ce10e3a82d41ebb1201c1e
Mateusz Majewski [Wed, 12 Oct 2022 12:18:43 +0000 (14:18 +0200)]
zlogger: ensure the written data ends with a \0
This is necessary, as the function relies on strnlen in order to
determine how many bytes to write, and at the same time it doesn't
guarantee that the whole buffer is being written (the buffer is only
enlarged, never shrunk).
Change-Id: I1a761ae61aee888f16e9243a136dec8c9b76b7ec
Mateusz Majewski [Wed, 12 Oct 2022 12:16:33 +0000 (14:16 +0200)]
zlogger: ensure the timestamp always increases
The kernel guarantees that it won't decrease, but if function is
executed in quick repetition it might happen that we get the same value
twice in a row. This is unacceptable, since the timestamp is the only
thing we rely on in order to sort the messages.
Change-Id: I64e0255acede0af44a8510705f469e55cde6ca30
Karol Lewandowski [Mon, 19 Sep 2022 11:35:15 +0000 (13:35 +0200)]
Release 7.0.10
Change-Id: Ifa8f3e61c2c8cf85c8a3ebb8e3009de7524139c7
Marek Szyprowski [Wed, 14 Sep 2022 15:24:53 +0000 (17:24 +0200)]
zlogger: correct calculation of buffer map/offset
Fix calculation of buffer map & offset for the non-2KB buffer case.
Change-Id: Icb53076c5c23493ac8489d5393a53a9d7fe01c0a
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Mateusz Majewski [Wed, 7 Sep 2022 11:17:29 +0000 (13:17 +0200)]
zlogger: add clear ioctl
Change-Id: I44590f2cb68d6cb26c13ad56b88d1c202abf2ae2
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Karol Lewandowski [Tue, 6 Sep 2022 09:33:25 +0000 (11:33 +0200)]
Release 7.0.9
Change-Id: I542d30848974f5eb8c8eb810907f3042cd435cc4
Marek Szyprowski [Wed, 17 Aug 2022 14:47:08 +0000 (16:47 +0200)]
Assorted fixes from product division
This commit brings following changes from product divisions aligning
codebases together:
- introduce dbus match cache (performance optimization),
- raise max number of possible matches,
- minor fixes.
Change-Id: I6a58e52d48b9ac8a2eb8cb333e7d20b4e821c08c
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
[ Describe in more detail what this change brings ]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Michal Bloch [Mon, 5 Sep 2022 19:16:24 +0000 (21:16 +0200)]
Fix an uninitialized var
Change-Id: I8dc8f571a2723e86308373f394b9c9ab9133f3c8
Mateusz Majewski [Wed, 31 Aug 2022 11:18:51 +0000 (13:18 +0200)]
zlogger: switch from kzalloc to __get_free_pages
Since we want to mmap the memory in userspace, it's important for the
memory to be consisting of full pages. Even though this has been true in
our tests, kzalloc does not guarantee this and there is a danger of this
changing in the future kernel releases. Instead, we can use
__get_free_pages, which explicitly returns a number of contiguous pages.
Change-Id: I4db57e37fbbcd17716718ed81ef2a6b79e4b1afc
Arkadiusz Nowak [Tue, 30 Aug 2022 12:14:30 +0000 (14:14 +0200)]
Zlogger module ioctl rework
Changed ioctl command type.
Added compat zlogger_compat_ioctl.
Switch based selector against if in ioctl.
Removed unnecessary __init, __exit attributes.
Test program zlog_stdout should show error if ioctl and write call failed.
Change-Id: I5994899de42c09997cced28a7a159e1b4a55bf38
Signed-off-by: Arkadiusz Nowak <a.nowak3@samsung.com>
Mateusz Majewski [Tue, 30 Aug 2022 12:00:33 +0000 (14:00 +0200)]
zlogger: add __user to read and write operations
Change-Id: I93dbf060a7d107a5e71f2ed02403a1356c69751f
Mateusz Majewski [Tue, 30 Aug 2022 09:55:00 +0000 (11:55 +0200)]
zlogger: improve initialization
The original code used an incorrect order of initialization. It's
important to first initialize the module variables, and only afterwards
initialize the device. Otherwise, userspace might access the device
before it is ready.
Additionally, some missing failure handling is added.
Change-Id: I8c907b92c5c45568e44fdbb0e645e0b593fb898c
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Tue, 30 Aug 2022 07:48:55 +0000 (09:48 +0200)]
zlogger: fix various style issues
Change-Id: I42f514cac7555ecd6a4a190e9e25d2aa9e008378
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Mon, 29 Aug 2022 12:36:06 +0000 (14:36 +0200)]
zlogger: move userspace-shared definitions to UAPI
This commit also changes types to the UAPI-friendly ones, and names not
to litter the global namespace too much. Additionally, pid_t occurrences
are changed into __s32, as we don't want to have pid_t in kernel ABI.
Change-Id: I7658f0874e07bfb63384a401efe8f3427c7d0af3
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Arkadiusz Nowak [Tue, 21 Jun 2022 11:14:50 +0000 (13:14 +0200)]
Include zero-copy logging kernel module
This is basically borrowed from the Tizen TV, where the kernel module
was called vlog. Hence the attribution in the MODULE_AUTHOR field. In
our version, the module is called zlogger instead. There is also a
number of changes from the original:
- we support direct writing to the module (similar to the stdout
redirection support in the logger module), which includes the write
operation, various ioctl commands and the test vlog_stdout program,
- the thread block table (g_threads) works slightly differently. It is
no longer a table, but a hashtable. This also removes a limitation on
the max TID (previously such a limitation has been needed, as the
table was indexed using the TID),
- the thread block table is no longer mmapable. Instead, the userspace
is supposed to cache the received block number using thread-local
storage, and check if it still has the block by verifying the TID
field in the block header, which is reset when the block is lost.
Change-Id: Ia04f1add0a4904bfd92b156022c704bc62495931
Karol Lewandowski [Wed, 6 Jul 2022 18:28:28 +0000 (20:28 +0200)]
kdbus: message: fix parameters passed to kdbus_pool_slice_copy_kvec()
Change-Id: Ia3a0af72110fc837e6c62c421c4de6f6d7c30c90
Łukasz Stelmach [Thu, 27 Jan 2022 20:01:36 +0000 (21:01 +0100)]
tests: refactor logger tests
Move testing scenarios to separate functions and enable looped operation
for detection of deadlocks, race conditions and other rearly observable
phenomena.
Change-Id: I213e5d10d9f541411c9301d147132ed9fd4af57d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Hyotaek Shim [Thu, 10 Feb 2022 08:35:02 +0000 (17:35 +0900)]
Fix build errors
-Wno-error=unused-result is applied to tests/logger since it's a test module.
[ 160s] logger.c: In function 'dump_logger':
[ 160s] logger.c:33:27: error: initialization of 'struct logger_entry *'
from incompatible pointer type 'char *' [-Werror=incompatible-pointer-types]
[ 160s] 33 | struct logger_entry *e = buf;
...
[ 160s] logger.c: In function 'tstart':
[ 160s] logger.c:24:2: error: ignoring return value of 'write', declared with
attribute warn_unused_result [-Werror=unused-result]
[ 160s] 24 | write(*fd, "child thread msg #1\nchild thread msg #2", 39);
[ 160s] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
Change-Id: I1496c7591031e3c61c3b3646712d641bdbdbdfe9
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Karol Lewandowski [Tue, 8 Feb 2022 10:30:42 +0000 (11:30 +0100)]
kdbus: Add KDBUS_SUPER_MAGIC define
The define has been originally provided by kernel's uapi headers, allowing
userspace programs to detect kdbus file system type being in use.
This commit moves the define to this repository as in Tizen it is the source
of all kdbus interfaces and APIs.
Change-Id: I058b72a76e5a8a49160095f1e8b132d07b2ab921
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Hyotaek Shim [Tue, 8 Feb 2022 05:40:17 +0000 (14:40 +0900)]
Add -Wno-error=shadow build option for kdbus tests
In some different build environment (e.g., product divisions),
several strict compilation options can be added like -Werror=shadow.
Shadowing is intentional and not a bug in tests so that we avoid this build error
by adding -Wno-error=shadow
[ 105s] kdbus-test.h:42:20: error: declaration of '_ASSERT_RETURN_VAL_val0_' shadows
a previous local [-Werror=shadow]
[ 105s] 42 | __auto_type const _ASSERT_RETURN_VAL_val0_ = (val0);\
Change-Id: Ia4f8a746dce0b39c896daf2e4cd1c87f62a8dadd
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Michal Bloch [Thu, 3 Feb 2022 18:49:55 +0000 (19:49 +0100)]
"Fix" var shadowing warnings in macros
Introduce some horrible spaghetti code to "fix" var shadowing
in recursive macros which accept code referencing vars declared
inside the macro as arguments.
Change-Id: I426f060630010a0f8a5f1eaa642e2eef6100a26c
Michal Bloch [Wed, 2 Feb 2022 17:55:53 +0000 (18:55 +0100)]
Fix shadowing in recursive ASSERT macros
Change-Id: I509e0e481ba147fa5a29a0e1e83e6458dea41d5e
Michal Bloch [Wed, 2 Feb 2022 17:55:23 +0000 (18:55 +0100)]
Fix some variable shadowing.
Change-Id: I1a6c0f0b51be5a7aa69455afe98ebdb21f5e0b3e
Michal Bloch [Wed, 2 Feb 2022 18:03:04 +0000 (19:03 +0100)]
Fix further var shadowing
This macro is just used in one place so doesn't need counters.
Change-Id: I19991d02a9fa4915c87dc4803b0695778d9dad9e
Michal Bloch [Wed, 2 Feb 2022 18:57:42 +0000 (19:57 +0100)]
Cast signed to unsigned explicitly
Change-Id: I9500955d04398bc59206558d50f2917af44f783a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Wed, 2 Feb 2022 18:29:22 +0000 (19:29 +0100)]
Fix disabling kdbus policy resulting in dead code
Change-Id: Ifb6357b7d4a4a35e9663df2c19ba25361485de14
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Hyotaek Shim [Thu, 27 Jan 2022 08:25:22 +0000 (17:25 +0900)]
Remove unnecessary local variable in kdbus tests
[ 230s] kdbus-test.c: In function 'main':
[ 230s] kdbus-test.c:972:31: error: declaration of 't' shadows a previous local [-Werror=shadow]
[ 230s] 972 | const struct kdbus_test *t = &tests[i];
[ 230s] | ^
[ 230s] kdbus-test.c:892:6: note: shadowed declaration is here
[ 230s] 892 | int t, ret = 0;
[ 230s] | ^
[ 230s] cc1: all warnings being treated as errors
Change-Id: I688feaa00630509363718f2d871adec3c2b951c7
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Michal Bloch [Wed, 26 Jan 2022 16:01:55 +0000 (17:01 +0100)]
Use memcpy for unknown destination buffer size
Since we're using the source length instead
of destination size, use memcpy instead.
This is because the compiler realizes that this
should've been implemented via strcpy (without N)
and issues a warning, but then Tizen tools for
static analysis complain about regular strcpy.
Change-Id: I51b0b1e52bc221a972ac8863d3f82ac15f199dac
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Wed, 26 Jan 2022 14:38:00 +0000 (15:38 +0100)]
Fix a type signedness mismatch
For size < 4, `char` was still cast to `unsigned` because of the earlier
operands, which also involved int promotion (so behaved the same as size == 4).
Change-Id: I7b9332bb20dd9d0035fc4607cb29a68cb82d0612
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Wed, 26 Jan 2022 14:29:23 +0000 (15:29 +0100)]
Fix a useless shadowing var
Change-Id: Ief090ae6d4cdfba20281f285a1c62770e4433aa4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Łukasz Stelmach [Mon, 24 Jan 2022 13:53:39 +0000 (14:53 +0100)]
logger: fix log->mutex + misc_mtx ab-ba deadlock
When a forked process reopens a file for stdio logging during the first write(2)
after a fork(2), it holds log->mutex when it calls filp_open() which
in turn calls misc_open(). misc_open() takes misc_mtx.
If at the same time (after acquiring log->mutex and before misc_open()
is called) another process (e.g. dlogutil) opens the same logger
device for reading (open(2) -> misc_open() -> logger_open() ->
mutex_lock(log->mutex)), a race condition and a AB-BA deadlock occurs. To
avoid it log->mutex is released before calling make_new_file() and
reaquired after. It is safe to do so, because the log structure isn't
accessed.
Change-Id: Ibaab2947638997dca82c0e47146f77ce0f1bee57
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Fri, 21 Jan 2022 15:30:01 +0000 (16:30 +0100)]
logger: fix type mismatch on arm64
Change-Id: Iba4d8d53ed2c9244e6b4f2c87e626d001f42c629
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Fri, 21 Jan 2022 14:42:32 +0000 (15:42 +0100)]
Release 7.0.6
Change-Id: Ie6042c435d4414f11a796abb69392dbb7146efed
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Fri, 21 Jan 2022 14:25:54 +0000 (15:25 +0100)]
packaging: move logger-test out of unnececssary directory
Change-Id: Ib194ab911aa111f1c0f224c17df911d982aa9974
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 19 Jan 2022 19:02:16 +0000 (20:02 +0100)]
tests: kdbus: fix memory leak
Change-Id: I90606b1364825ed163f63d7597444aa6e7a8a6cd
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 19 Jan 2022 17:07:48 +0000 (18:07 +0100)]
tests: kdbus: fix memory leak
Change-Id: I7c061c3a55b661db3a31dd2fd4ded60e4b37df06
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Tue, 18 Jan 2022 19:45:12 +0000 (20:45 +0100)]
kdbus: Replace strcpy() with strncpy()
Change-Id: Ie59bae03c5573e6a640998a6ae39f0753a98be95
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Tue, 18 Jan 2022 14:25:31 +0000 (15:25 +0100)]
kdbus: Replace strcat() with strncat()
Change-Id: Ie8c68c7a48bcb359a2c8e649a96f7d538ed26ad8
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Fri, 21 Jan 2022 13:02:56 +0000 (14:02 +0100)]
logger: make variable names match
Change-Id: Ibe70c2c0cba0a722259bae4cbe40dd865ac63448
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Thu, 20 Jan 2022 14:43:55 +0000 (15:43 +0100)]
logger: configure log buffer sizes
Add module parameters main_buffer_size, events_buffer_size,
radio_buffer_size and system_buffer_size to configure respective buffer
sizes. If a parameter is set to zero respective buffer is not created
whatsoever.
Change-Id: Ibaf5fe152837ded0f31f924e81ea112d9d03b63e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 19 Jan 2022 13:39:20 +0000 (14:39 +0100)]
logger: configure buffer size separately
Add separate configuration for each buffer size.
Change-Id: If7134868996a20a8fd81a6bbfbe101bad6d21824
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Mon, 17 Jan 2022 20:58:58 +0000 (21:58 +0100)]
logger: make buffer size configurable during compilation
Change-Id: I5c50b4281cb1790248a39821c76f3ee874c76851
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Mateusz Majewski [Tue, 18 Jan 2022 10:45:59 +0000 (11:45 +0100)]
logger: fix RPi4 timestamp issue
Change-Id: Iaceffde5c5fb566a1481c2c8b48776e60057d811
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Łukasz Stelmach [Mon, 10 Jan 2022 21:15:35 +0000 (22:15 +0100)]
Import and build logger test
Change-Id: Ibe00dad3ebd319875748c682a614fd517ebc8a4c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Tue, 4 Jan 2022 18:27:38 +0000 (19:27 +0100)]
Build and package kdbus tests
Change-Id: I797e79acf31e4e2e88f71430d7d570069850e819
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Mateusz Majewski [Mon, 6 Dec 2021 10:27:27 +0000 (11:27 +0100)]
Import kdbus test
Change-Id: I02d685dbb73055daebd5bed9640937ac05e33e35
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 12 Jan 2022 20:42:41 +0000 (21:42 +0100)]
Rename the headers package
Rename the output rpm containing logger.h and kdbus.h from
linux-tizen-modules-source-headers to linux-tizen-modules-headers since
the output rpm contains only headers and no other source code.
Change-Id: I9d471a074e48bdaaa382c06e935e0c4551516511
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 5 Jan 2022 14:39:32 +0000 (15:39 +0100)]
Move and export uapi headers
Move logger.h and kdbus.h uapi headers to a separate directory
and export them to /usr/include/linux and
/usr/src/linux-tizen-modules-source.
Change-Id: Ie3fd39f44baf33552cc742f0c13228b1e87b9333
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Karol Lewandowski [Wed, 5 Jan 2022 13:18:10 +0000 (14:18 +0100)]
Release 7.0.4
This release adjusts logger.ko to be able to work with older (<3.18)
kernels.
Change-Id: I8230de61a67096b0dcadbe12fc5d34f68112b93e
Łukasz Stelmach [Thu, 16 Dec 2021 19:03:53 +0000 (20:03 +0100)]
Replace copy_from_iter() with copy_from_user()
iov_iter structure and associated function have been introduced in
v3.18. Logger needs use copy_from_user() and iterate over IO vectores
manualy.
Change-Id: Ifa46c67da65195611adc50b1dc6f0be66daac517
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 15 Dec 2021 23:32:13 +0000 (00:32 +0100)]
Import stdio handling code to logger_aio_write()
Copy the stdio handling code from logger_write_iter()
Change-Id: I94be88c5db2e7482106ddd537d763726a89aad5a
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 15 Dec 2021 23:28:34 +0000 (00:28 +0100)]
Discard data from stdio
Accept and discard unstructured data coming from stdio.
This commit is mainly to make the later changes more readable.
Change-Id: I0428eef0b3f9517e14b8de282003436e5296b66d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 15 Dec 2021 23:16:00 +0000 (00:16 +0100)]
Import old logger_aio_write()
Copy logger_aio_write() and two other functions from Android logger
driver in v3.10.65. Use them when compiling against old kernels.
Change-Id: I1e2cb304106e48ffad80f03dc7c9ae899cd228f4
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Karol Lewandowski [Tue, 4 Jan 2022 10:29:09 +0000 (11:29 +0100)]
kdbus: domain: drop overwritten assignment
Change-Id: Idf43dadcbee8156b1099f30dfd8ebc40c7c5bb45
Mateusz Majewski [Fri, 31 Dec 2021 09:19:43 +0000 (10:19 +0100)]
packaging: generate headers package
Change-Id: Icfd89649aeb8d723a7f70499cad16d361b83ee68
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Thu, 30 Dec 2021 09:43:47 +0000 (10:43 +0100)]
kdbus: use kdbus.h header from this repository
… as opposed to the header from the kernel headers package.
Change-Id: I25c86328cc16aba1099214802acb661291e31258
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Karol Lewandowski [Fri, 3 Dec 2021 17:55:17 +0000 (18:55 +0100)]
Bump version due to kdbus inclusion
Other packages wanting kdbus might depend on particular version.
Change-Id: Iab701418f25314b5035d8ece0bfd95159b5daba6
Mateusz Majewski [Tue, 30 Nov 2021 07:35:51 +0000 (08:35 +0100)]
Import kdbus
For the record, these files come from the
git://git.tizen.org/platform/kernel/linux-rpi.git repository, from the
be5781a07d48f8fd62633310fea57963aea1595d commit.
Change-Id: Ia3be026cf4a97fce32bbc98dc4151d75d670b186
Co-authored-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Karol Lewandowski [Fri, 26 Nov 2021 09:35:56 +0000 (10:35 +0100)]
Keep only source package
This commit drops all public-tizen customizations and keep only source
package generation.
Public Tizen linux-tizen-modules will use this package to build code
and will add its specific configuration.
Change-Id: I633f869530d6b0a34c27ff4d0d137bc7eaac262f
Karol Lewandowski [Thu, 25 Nov 2021 11:35:51 +0000 (12:35 +0100)]
Add ability to not build all modules
This is going to be used by clients of -source package.
Change-Id: Ieb7be8aa0a169951356b554947a9ab978346346e
Karol Lewandowski [Wed, 24 Nov 2021 15:15:36 +0000 (16:15 +0100)]
Add separate spec to build source package
Change-Id: I1e7850b6b7d959f9b36a85fceca11d5f0825971f
Łukasz Stelmach [Fri, 10 Sep 2021 18:02:53 +0000 (20:02 +0200)]
logger: handle error values from filp_open()
filp_open() may return -errno, so check for that instead of checking
for NULL.
Change-Id: I5a694555bcd082506330e08f48ed4b7043c4e120
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Łukasz Stelmach [Wed, 15 Sep 2021 12:54:18 +0000 (14:54 +0200)]
logger: flush data from stdio writers under mutex
Operations during flushing logs delivered via stdio need to be performed
with the mutex held.
Change-Id: I4655b0af75172f8f22b797c0caadd28cb4619cf0
Suggested-by: Mateusz Majewski <m.majewski2@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Mateusz Majewski [Tue, 13 Jul 2021 09:47:15 +0000 (11:47 +0200)]
logger: flush remaining data from stdio writers on file release
Unlike logs from regular writers, logs from stdio writers are not
contained in a single write_iter call: if the last character written in
the call is not a newline, some of the input remains in the buffer for
the next write_iter call. This means that some data might remain in the
buffer during release, and such data has to be flushed; otherwise, it
would be lost.
Change-Id: I13c9dc020967fe8ef3fbcd52d45f85b8725d3c2c
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Mateusz Majewski [Tue, 13 Jul 2021 09:47:04 +0000 (11:47 +0200)]
logger: handle '\0's correctly in stdout writers
This commit takes care of cases when input received from stdout writers
contains '\0' characters. They should be treated like newlines. We
achieve this by simply replacing them by '\n's while searching for the
last '\n' in the input.
Change-Id: I51c23457f96bd6f0465d60da06157316756cc951
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
INSUN PYO [Fri, 9 Jul 2021 03:24:14 +0000 (12:24 +0900)]
Separate configuration files for each target
Change-Id: Iaed004d48d4d0fad16d396ce95b26e37edb66ffb
Karol Lewandowski [Wed, 7 Jul 2021 11:20:25 +0000 (13:20 +0200)]
Merge branch 'stability-monitor-kmod-rpi3' into tizen
This commit integrates previously standalone stability-monitor-kmod-rpi3
into this repository.
Source commit
901f4d0ec2 ("Support Linux kernel v5.10") has been downloaded by:
git fetch ssh://klewandowski@review.tizen.org:29418/platform/core/system/stability-monitor-kmod-rpi3 refs/changes/90/253890/1 && git checkout FETCH_HEAD
Change-Id: I3ee19411f8c2af86776e9796491857ff88e3baed
INSUN PYO [Fri, 25 Jun 2021 04:38:56 +0000 (13:38 +0900)]
logger: enable logger module
Change-Id: If186dc62a39a360b42b99cea0f8e4c29940c71db
INSUN PYO [Thu, 24 Jun 2021 06:47:47 +0000 (15:47 +0900)]
packaging: fix not to set kernel symbol dependency automatically
Kernel image rpm does not have kerenl symbol provides, so kernel
symbol automatically checked dependency from kernel module breaks
install dependency. Fix not to run automatical dependency check.
Change-Id: If5a6de3c97205e011dcd91d3358563e3e261560d
INSUN PYO [Fri, 18 Jun 2021 06:49:20 +0000 (15:49 +0900)]
Apply depmod postscript
To use modprobe, module name is requires on /lib/modules/version/modules.dep.
Change-Id: I4ac1e90424f2707675f9fce37544c193de6afaf4
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Hyotaek Shim [Wed, 23 Jun 2021 01:15:47 +0000 (10:15 +0900)]
Resolve conflict with /lib/modules when using baselibs
In tw3 images, kernel is based on 64bit while platform is on 32bit.
Thanks to baselibs, aarch64 rpms containing tw3 kernel modules can be repackaged to arm rpms.
$ rpm -ql linux-tizen-modules-tw3-aarch64-6.5.0-0.armv7l.rpm
/lib/modules
/lib/modules/4.9.59
/lib/modules/4.9.59/extra
/lib/modules/4.9.59/extra/logger.ko
Unfortunately, however, /lib/modules, which is implicitly packaged,
is conflict with filesystem package.
INFO: Next install: filesystem
WARNING: file /lib/modules conflicts between attempted installs of
linux-tizen-modules-tw3-aarch64-6.5.0-1.1.armv7l and filesystem-3.1-3.3.armv7l
ERROR: Could not run transaction.
This patch avoids generating /lib/modules in the linux-tizen-modules-tw3-aarch64.armv7l.rpm
Change-Id: I8be870f9999e1e2f626c99bae7bced3ac623d44d
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
INSUN PYO [Thu, 17 Jun 2021 08:47:21 +0000 (17:47 +0900)]
logger: exclude /lib/module directory from tw3 baselib
The baselibs adds paths recursively.
(ie. for /a/b/c, and cofiguration +/a/b/c, the baselibs will add /a, /a/b and then /a/b/c)
So, temporarily remove /lib/module until a solution is found.
=== original rpm ======================================================
linux-tizen-modules-tw3-6.5.0-0.aarch64.rpm
- /lib/modules/4.9.59/extra
- /lib/modules/4.9.59/extra/logger.ko
- /usr/share/licenses/linux-tizen-modules-tw3
- /usr/share/licenses/linux-tizen-modules-tw3/COPYING
=== baselib rpm ======================================================
linux-tizen-modules-tw3-aarch64-6.5.0-0.armv7l.rpm
- /lib/modules
- /lib/modules/4.9.59
- /lib/modules/4.9.59/extra
- /lib/modules/4.9.59/extra/logger.ko
- /usr/share/licenses
- /usr/share/licenses/linux-tizen-modules-tw3
Change-Id: I6ee6076f2b4247f335c2ca54639b6bf27907a3c1
Karol Lewandowski [Thu, 22 Apr 2021 13:58:39 +0000 (15:58 +0200)]
packaging: Support logger driver for rpi3, rpi4 and tw3 kernels
Change-Id: I41eba922c16b34efe04e7d15896e7fe9ad6012ca
Karol Lewandowski [Thu, 22 Apr 2021 13:51:37 +0000 (15:51 +0200)]
Merge branch 'logger-linux-rpi3' into tizen
This imports logger driver along with history. It's been obtained from:
ssh://review.tizen.org:29418/platform/kernel/linux-rpi3
Change-Id: If7ffcb064bd6c8279a0cceb285f1db372aa22907
Łukasz Stelmach [Wed, 14 Apr 2021 15:50:51 +0000 (17:50 +0200)]
logger: introduce struct logger_set_tag
Introduce dedicated structure for LOGGER_SET_TAG ioctl,
instead of packing and unpacking arguments by hand.
Change-Id: Ic3399ab37f55ba2b8a9a976f8c9495fc487fe7f3
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[ Pick only changes in logger.[ch] while moving code out of tree ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>