Re: [PATCH 0/1] Use a log identity always valid while logging
Denis Kenzior <[email protected]>
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <[email protected]> |
Hi Christian, On 2/22/24 17:23, Christian Meusel wrote: > I encountered garbled and changing log identifiers from connmand 1.42 > running on Yocto Kirkstone. > > Feb 09 02:40:18 foo time[590]: Connection Manager version 1.42 > Feb 09 02:40:18 foo time[590]: ../connman-1.42/src/dbus.c:__connman_dbus_init() > Feb 09 02:40:18 foo time[590]: ../connman-1.42/src/main.c:parse_config() parsing main.conf > Feb 09 02:40:18 foo time[590]: Online check disabled by main config. > Feb 09 02:40:19 foo U[590]: ../connman-1.42/src/inotify.c:__connman_inotify_init() > Feb 09 02:40:19 foo U[590]: ../connman-1.42/src/technology.c:__connman_technology_init() > > This variant is slightly patched (see > https://git.yoctoproject.org/poky/tree/meta/recipes-connectivity/connman/connman/0001-src-log.c-Include-libgen.h-for-basename-API.patch) Ugh. I think the Yocto folks didn't read the basename manpage carefully enough :) See [1] for an explanation. > which creates a use-after-free situation. But nevertheless there is no > lifetime requirement communicated for the 'program' argument passed to > '__connman_log_init' and on the other hand 'basename' might as well > return a pointer to an internal buffer. > > In either case, a locally allocated log identity string will prevent > potential issues. argv[0] is being passed in as 'program'. So getting rid of basename use and running strrchr should be sufficient. Regards, -Denis [1] https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=ba5a6df2d170fce96354f0c9ba281fe049d2f0a3