Commit graph

7 commits

Author SHA1 Message Date
Felix Fietkau
c1be505732 udebug: fix crash in udebug_entry_vprintf with longer strings
The passed va_list ap cannot be used more than once. In order to deal with
vsprintf retry, it needs to be copied first. Fixes a procd crash observed
on several platforms.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-01-26 21:00:17 +01:00
Felix Fietkau
ca3f6d0cdb udebug: fix file descriptor initialization for __udebug_buf_map
Pass the fd to __udebug_buf_map, set buf->fd only if mapping worked

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-12-04 14:37:33 +01:00
Felix Fietkau
df5b7147f4 udebug: add mips specific quirk
On some MIPS systems, mmap addresses need to be aligned to multiple pages, in
order to avoid issues with data cache aliases. Add an arch specific quirk to
allocate memory in 32 KiB chunks and align addresses returned by mmap.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-12-04 13:26:08 +01:00
Felix Fietkau
d27acfe416 udebug: add more checks for uninitialized buffers
Simplifies and fixes error handling

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-12-04 13:24:50 +01:00
Felix Fietkau
40acbe3463 udebug: wait for response after buffer add/remove
Fixes a race condition where freeing a buffer and immediately re-allocating and
adding it would fail to pass the file descriptor to udebugd

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-11-30 12:29:40 +01:00
Felix Fietkau
325fea5c57 udebug: add functions for manipulating entry length
Can be used to reserve worst case length using udebug_entry_append,
then setting the final length using udebug_entry_set_length

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-11-29 21:59:23 +01:00
Felix Fietkau
d4c3066e7c udebug: add udebug library code
Copied and adapted from udebug.git

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-11-27 18:30:01 +01:00