[PATCH dpdk] log: fix double free on cleanup
Stephen Hemminger
stephen at networkplumber.org
Fri Nov 29 18:00:56 CET 2024
On Fri, 29 Nov 2024 17:10:14 +0100
Robin Jarry <rjarry at redhat.com> wrote:
> Fix the following crash when closing a log file after rte_eal_cleanup():
>
> double free or corruption (!prev)
>
> Thread 1 "grout" received signal SIGABRT, Aborted.
> __pthread_kill_implementation (threadid=<optimized out>,
> signo=signo at entry=6, no_tid=no_tid at entry=0) at pthread_kill.c:44
> ...
> #10 _IO_new_fclose (fp=0xb63090) at iofclose.c:74
> #11 0x000000000049c04e in dpdk_fini () at ../main/dpdk.c:204
> #12 0x0000000000402ab8 in main (...) at ../main/main.c:217
> (gdb) up 11
> #11 0x000000000049c04e in dpdk_fini () at ../main/dpdk.c:204
> 202 rte_eal_cleanup();
> 203 if (log_stream != NULL)
> 204 fclose(log_stream);
>
> When the application has passed a custom file via rte_openlog_stream()
> DPDK should not call fclose() on it.
>
> Add an internal is_internal_file field to track whether the file has
> been allocated by DPDK (syslog or journald) to determine if it should be
> closed or not.
>
> Fixes: 985130369be3 ("log: rework syslog handling")
> Signed-off-by: Robin Jarry <rjarry at redhat.com>
Looks good, will look into adding more test cases for this in later release.
Reviewed-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list