NetworkManager/src/libnm-glib-aux
Thomas Haller 5f7a027f59
glib-aux: fix atomic pattern in nm_ref_string_unref()
It's simply not valid to read the ref-count without an atomic.
The compiler might optimize out the assignment to "r" and read the
_ref_count field multiple times. Thereby, we might at first appear
to be larger than > 1, and later pass 1 to compare-and-exchange.

We need an atomic get here.

Fixes: 19d4027824 ('refstr: inline nm_ref_string_{ref,unref}()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1847
2024-01-30 12:07:29 +01:00
..
tests glib-aux: add nm_g_variant_cmp() 2024-01-04 09:59:59 +01:00
meson.build glib-aux: add NMPrioq priority queue (heap) 2022-10-25 10:58:56 +02:00
nm-c-list.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-dbus-aux.c doc: replace all (allow-none) annotations by (optional) and/or (nullable) 2023-03-27 11:49:43 +02:00
nm-dbus-aux.h doc: replace all (allow-none) annotations by (optional) and/or (nullable) 2023-03-27 11:49:43 +02:00
nm-dedup-multi.c doc: use "Returns:" annotation instead of deprecated aliases 2023-03-29 11:46:48 +02:00
nm-dedup-multi.h all: use NM_MIN_CONST()/NM_MAX_CONST() instead of MIN()/MAX() 2023-11-15 09:32:19 +01:00
nm-default-glib-i18n-lib.h build: move "shared/nm-{glib-aux,log-null,log-core}" to "src/libnm-{glib-aux,log-null,log-core}" 2021-02-24 12:48:20 +01:00
nm-default-glib-i18n-prog.h build: move "shared/nm-{glib-aux,log-null,log-core}" to "src/libnm-{glib-aux,log-null,log-core}" 2021-02-24 12:48:20 +01:00
nm-default-glib.h glib-aux: move inet related helpers to "nm-inet-utils.h" 2022-08-25 19:05:51 +02:00
nm-enum-utils.c all: use nm_g_array_index() instead of g_array_index() 2023-10-30 17:15:06 +01:00
nm-enum-utils.h man nm-settings-nmcli: add "Valid values" field 2023-09-21 15:57:35 +02:00
nm-errno.c std-aux: extract and add _nm_strerror_r() helper 2023-09-12 12:39:43 +00:00
nm-errno.h platform/netlink: add nlmsg_parse_error() helper 2022-08-09 08:02:40 +02:00
nm-gassert-patch.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-glib.h glib: drop compat code for glib < 2.42 from "nm-glib.h" 2023-12-11 12:45:20 +01:00
nm-hash-utils.c all: fix various "-Wcast-align=strict" warnings 2022-12-09 09:15:56 +01:00
nm-hash-utils.h core: generate fixed fallback timestamp in _host_id_read_timestamp() 2023-11-14 14:15:42 +01:00
nm-inet-utils.c glib-aux: use GModule instead of dlopen() in _inet_aton() 2023-05-10 18:58:49 +02:00
nm-inet-utils.h glib-aux: avoid using inet_aton() 2023-05-08 15:44:49 +02:00
nm-io-utils.c glib-aux: add nm_io_fcntl_setfl_update_nonblock() helper 2023-04-04 08:43:20 +02:00
nm-io-utils.h glib-aux: add nm_io_fcntl_setfl_update_nonblock() helper 2023-04-04 08:43:20 +02:00
nm-jansson.h clang-format: use "IndentPPDirectives:None" instead of "BeforeHash" 2021-07-09 08:49:06 +02:00
nm-json-aux.c format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-json-aux.h libnm: add direct strv type for NMSetting and use it for "match.interface-name" 2022-02-10 22:30:27 +01:00
nm-keyfile-aux.c glib-aux/trivial: fix typo in code comment 2022-09-09 16:21:53 +02:00
nm-keyfile-aux.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-logging-base.c format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-logging-base.h glib-aux,cloud-setup: add _nm_logging_enabled*() helper API 2021-07-23 16:43:37 +02:00
nm-logging-fwd.h glib-aux: make _LOGT_ENABLED()/_LOGD_ENABLED() as G_UNLIKELY() 2023-03-08 15:34:47 +01:00
nm-logging-syslog.h shared: split and move "nm-vpn-plugin-macros.h" 2021-02-24 12:48:56 +01:00
nm-macros-internal.h glib-aux: rename and change order of arguments for _nm_gobject_notify_together_impl##suffix() 2023-12-18 18:54:09 +01:00
nm-obj.h build: move "shared/nm-{glib-aux,log-null,log-core}" to "src/libnm-{glib-aux,log-null,log-core}" 2021-02-24 12:48:20 +01:00
nm-prioq.c glib-aux/prioq: remove unused includes 2023-03-21 17:29:46 +01:00
nm-prioq.h glib-aux/prioq: rename NM_PRIOQ_FOREACH_ITEM() to nm_prioq_for_each() 2023-03-21 15:58:39 +01:00
nm-random-utils.c doc: replace all (allow-none) annotations by (optional) and/or (nullable) 2023-03-27 11:49:43 +02:00
nm-random-utils.h glib-aux: add nm_random_u64_range() helper 2023-01-30 10:48:53 +01:00
nm-ref-string.c glib-aux,core: use nm_memdup_nul() and nm_memcpy() 2022-10-24 08:48:11 +02:00
nm-ref-string.h glib-aux: fix atomic pattern in nm_ref_string_unref() 2024-01-30 12:07:29 +01:00
nm-secret-utils.c glib-aux: drop usage of malloc_usable_size() in nm_free_secret() 2023-02-08 15:15:45 +01:00
nm-secret-utils.h crypto: move nm_crypto_read_file() to "libnm-glib-aux" 2022-03-29 11:56:04 +02:00
nm-shared-utils.c glib-aux: add nm_g_variant_cmp() 2024-01-04 09:59:59 +01:00
nm-shared-utils.h glib-aux: add nm_g_variant_cmp() 2024-01-04 09:59:59 +01:00
nm-str-buf.h doc: replace all (allow-none) annotations by (optional) and/or (nullable) 2023-03-27 11:49:43 +02:00
nm-test-utils.h glib-aux: convert nmtst_assert_setting_verifies() to a macro 2024-01-23 09:43:25 +01:00
nm-time-utils.c glib-aux: add nm_time_map_clock() helper 2022-10-25 10:59:00 +02:00
nm-time-utils.h glib-aux: add nm_time_map_clock() helper 2022-10-25 10:59:00 +02:00
nm-uuid.c doc: replace all (allow-none) annotations by (optional) and/or (nullable) 2023-03-27 11:49:43 +02:00
nm-uuid.h all: fix generating UUIDs for string 2022-11-03 09:23:52 +01:00
nm-value-type.h libnm: add direct strv type for NMSetting and use it for "match.interface-name" 2022-02-10 22:30:27 +01:00
README.md all: add some README.md files describing the purpose of our sources 2021-08-19 17:51:11 +02:00

libnm-glib-aux

A static helper library with general purpose helpers on top of glib.

This is similar to libnm-std-aux (on which this library depends). The difference is that libnm-std-aux only requires standard C (C11), while this has a dependency on glib.

As this has no additional dependencies, we should have all our glib code use this internal helper library. It contains helpers that should be available (and used) in all our C/glib applications/libraries.

Parts of this library are usually already included via the nm-default*.h headers.