This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f3a3ec2ab48e961a39d20f9adb3f137973aebe1f Author: Bowen Wang <[email protected]> AuthorDate: Tue May 26 22:35:35 2026 +0800 drivers/syslog/syslog_rpmsg: invalidate the dcache before a dump syslog_rpmsg_dump() may read a buffer written by another core. Without invalidating the dcache it can print stale cached data. Invalidate the header and the buffer first, and drop the hex dump that duplicated the text output. Signed-off-by: Bowen Wang <[email protected]> --- include/nuttx/syslog/syslog_rpmsg.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/nuttx/syslog/syslog_rpmsg.h b/include/nuttx/syslog/syslog_rpmsg.h index 90f90f40fc5..7cd1863781f 100644 --- a/include/nuttx/syslog/syslog_rpmsg.h +++ b/include/nuttx/syslog/syslog_rpmsg.h @@ -98,13 +98,22 @@ static inline_function void syslog_rpmsg_dump(FAR const void *buffer) { FAR const struct syslog_rpmsg_buffer_header_s *header = (FAR const struct syslog_rpmsg_buffer_header_s *)buffer; - uint32_t head = header->head; - uint32_t tail = header->tail; - uint32_t size = header->size; + uint32_t head; + uint32_t tail; + uint32_t size; + + up_invalidate_dcache((uintptr_t)header, + (uintptr_t)header + sizeof(*header)); + head = header->head; + tail = header->tail; + size = header->size; _alert("Dump syslog rpmsg header:%p head:%" PRIu32 " tail:%" PRIu32 " size:%" PRIu32 "\n", header, head, tail, size); + up_invalidate_dcache((uintptr_t)header->buffer, + (uintptr_t)header->buffer + header->size); + if (head > tail) { _alert("%.*s\n", (int)(head - tail), &header->buffer[tail]);
