logging: Fix runtime filtering when frontend and userspace is used
When userspace is used and frontend was used for logging then runtime filtering was failing because in user context filtering data was accessed and filtering data is in the kernel space. Fixing that and adding runtime filtering to the pre frontend function which is already executed in the kernel space and filter data can be accessed. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
8ed29a625a
commit
347eeababf
@ -251,7 +251,7 @@ static inline char z_log_minimal_level_to_char(int level)
|
||||
} \
|
||||
\
|
||||
bool is_user_context = k_is_user_context(); \
|
||||
if (!IS_ENABLED(CONFIG_LOG_FRONTEND) && IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \
|
||||
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \
|
||||
!is_user_context && _level > Z_LOG_RUNTIME_FILTER((_dsource)->filters)) { \
|
||||
break; \
|
||||
} \
|
||||
@ -335,7 +335,7 @@ static inline char z_log_minimal_level_to_char(int level)
|
||||
(const char *)(_data), (_len));\
|
||||
break; \
|
||||
} \
|
||||
if (!IS_ENABLED(CONFIG_LOG_FRONTEND) && IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \
|
||||
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \
|
||||
!is_user_context && (_level) > Z_LOG_RUNTIME_FILTER(filters)) { \
|
||||
break; \
|
||||
} \
|
||||
|
||||
@ -57,8 +57,10 @@ static bool frontend_runtime_filtering(const void *source, uint32_t level)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If only frontend is used and log got here it means that it was accepted. */
|
||||
if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {
|
||||
/* If only frontend is used and log got here it means that it was accepted
|
||||
* unless userspace is enabled then runtime filtering is done here.
|
||||
*/
|
||||
if (!IS_ENABLED(CONFIG_USERSPACE) && IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user