Systemd/src/libsystemd/libsystemd.sym

685 lines
19 KiB
Plaintext
Raw Normal View History

/***
SPDX-License-Identifier: LGPL-2.1+
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
***/
LIBSYSTEMD_209 {
global:
/* sd-journal */
sd_journal_print;
sd_journal_printv;
sd_journal_send;
sd_journal_sendv;
sd_journal_stream_fd;
sd_journal_open;
sd_journal_close;
sd_journal_previous;
sd_journal_next;
sd_journal_previous_skip;
sd_journal_next_skip;
sd_journal_get_realtime_usec;
sd_journal_get_monotonic_usec;
sd_journal_get_data;
sd_journal_enumerate_data;
sd_journal_restart_data;
sd_journal_add_match;
sd_journal_flush_matches;
sd_journal_seek_head;
sd_journal_seek_tail;
sd_journal_seek_monotonic_usec;
sd_journal_seek_realtime_usec;
sd_journal_seek_cursor;
sd_journal_get_cursor;
sd_journal_get_fd;
sd_journal_process;
sd_journal_print_with_location;
sd_journal_printv_with_location;
sd_journal_send_with_location;
sd_journal_sendv_with_location;
sd_journal_get_cutoff_realtime_usec;
sd_journal_get_cutoff_monotonic_usec;
sd_journal_wait;
sd_journal_open_directory;
sd_journal_add_disjunction;
sd_journal_perror;
sd_journal_perror_with_location;
sd_journal_get_usage;
sd_journal_test_cursor;
sd_journal_query_unique;
sd_journal_enumerate_unique;
sd_journal_restart_unique;
sd_journal_get_catalog;
sd_journal_get_catalog_for_message_id;
sd_journal_set_data_threshold;
sd_journal_get_data_threshold;
sd_journal_reliable_fd;
sd_journal_get_events;
sd_journal_get_timeout;
sd_journal_add_conjunction;
sd_journal_open_files;
sd_journal_open_container;
/* sd-daemon */
sd_booted;
sd_is_fifo;
sd_is_mq;
sd_is_socket;
sd_is_socket_inet;
sd_is_socket_unix;
sd_is_special;
sd_listen_fds;
sd_notify;
sd_notifyf;
sd_watchdog_enabled;
/* sd-id128 */
sd_id128_to_string;
sd_id128_from_string;
sd_id128_randomize;
sd_id128_get_machine;
sd_id128_get_boot;
/* sd-login */
sd_get_seats;
sd_get_sessions;
sd_get_uids;
sd_login_monitor_flush;
sd_login_monitor_get_fd;
sd_login_monitor_new;
sd_login_monitor_unref;
sd_pid_get_owner_uid;
sd_pid_get_session;
sd_seat_can_multi_session;
sd_seat_get_active;
sd_seat_get_sessions;
sd_session_get_seat;
sd_session_get_uid;
sd_session_is_active;
sd_uid_get_seats;
sd_uid_get_sessions;
sd_uid_get_state;
sd_uid_is_on_seat;
sd_pid_get_unit;
sd_session_get_service;
sd_session_get_type;
sd_session_get_class;
sd_session_get_display;
sd_session_get_state;
sd_seat_can_tty;
sd_seat_can_graphical;
sd_session_get_tty;
sd_login_monitor_get_events;
sd_login_monitor_get_timeout;
sd_pid_get_user_unit;
sd_pid_get_machine_name;
sd_get_machine_names;
sd_pid_get_slice;
sd_session_get_vt;
sd_session_is_remote;
sd_session_get_remote_user;
sd_session_get_remote_host;
local:
*;
};
LIBSYSTEMD_211 {
global:
sd_machine_get_class;
sd_peer_get_session;
sd_peer_get_owner_uid;
sd_peer_get_unit;
sd_peer_get_user_unit;
sd_peer_get_machine_name;
sd_peer_get_slice;
} LIBSYSTEMD_209;
LIBSYSTEMD_213 {
global:
sd_uid_get_display;
2014-06-11 15:30:28 +02:00
} LIBSYSTEMD_211;
LIBSYSTEMD_214 {
global:
sd_pid_notify;
sd_pid_notifyf;
} LIBSYSTEMD_213;
LIBSYSTEMD_216 {
global:
sd_machine_get_ifindices;
} LIBSYSTEMD_214;
LIBSYSTEMD_217 {
global:
sd_session_get_desktop;
} LIBSYSTEMD_216;
LIBSYSTEMD_219 {
global:
sd_pid_notify_with_fds;
} LIBSYSTEMD_217;
LIBSYSTEMD_220 {
global:
sd_pid_get_user_slice;
sd_peer_get_user_slice;
} LIBSYSTEMD_219;
LIBSYSTEMD_221 {
2014-06-11 15:30:28 +02:00
global:
/* sd-bus */
sd_bus_default;
sd_bus_default_user;
sd_bus_default_system;
sd_bus_open;
sd_bus_open_user;
sd_bus_open_system;
sd_bus_open_system_remote;
sd_bus_open_system_machine;
sd_bus_new;
sd_bus_set_address;
sd_bus_set_fd;
sd_bus_set_exec;
sd_bus_get_address;
sd_bus_set_bus_client;
sd_bus_is_bus_client;
sd_bus_set_server;
sd_bus_is_server;
sd_bus_set_anonymous;
sd_bus_is_anonymous;
2013-12-10 17:41:39 +01:00
sd_bus_set_trusted;
sd_bus_is_trusted;
2014-03-19 04:17:00 +01:00
sd_bus_set_monitor;
sd_bus_is_monitor;
sd_bus_set_description;
sd_bus_get_description;
sd_bus_negotiate_creds;
sd_bus_negotiate_timestamp;
sd_bus_negotiate_fds;
sd_bus_can_send;
sd_bus_get_creds_mask;
sd_bus_set_allow_interactive_authorization;
sd_bus_get_allow_interactive_authorization;
sd_bus_start;
sd_bus_close;
sd_bus_try_close;
sd_bus_ref;
sd_bus_unref;
sd_bus_is_open;
sd_bus_get_bus_id;
sd_bus_get_scope;
sd_bus_get_tid;
sd_bus_get_owner_creds;
sd_bus_send;
2013-11-19 01:23:08 +01:00
sd_bus_send_to;
sd_bus_call;
sd_bus_call_async;
sd_bus_get_fd;
sd_bus_get_events;
sd_bus_get_timeout;
sd_bus_process;
sd_bus_process_priority;
sd_bus_wait;
sd_bus_flush;
sd_bus_get_current_slot;
sd_bus_get_current_message;
sd_bus_get_current_handler;
sd_bus_get_current_userdata;
sd_bus_attach_event;
sd_bus_detach_event;
sd_bus_get_event;
sd_bus_add_filter;
sd_bus_add_match;
sd_bus_add_object;
sd_bus_add_fallback;
sd_bus_add_object_vtable;
sd_bus_add_fallback_vtable;
sd_bus_add_node_enumerator;
sd_bus_add_object_manager;
sd_bus_slot_ref;
sd_bus_slot_unref;
sd_bus_slot_get_bus;
sd_bus_slot_get_userdata;
sd_bus_slot_set_userdata;
sd_bus_slot_get_description;
sd_bus_slot_set_description;
sd_bus_slot_get_current_message;
sd_bus_slot_get_current_handler;
sd_bus_slot_get_current_userdata;
sd_bus_message_new_signal;
sd_bus_message_new_method_call;
sd_bus_message_new_method_return;
sd_bus_message_new_method_error;
sd_bus_message_new_method_errorf;
sd_bus_message_new_method_errno;
sd_bus_message_new_method_errnof;
sd_bus_message_ref;
sd_bus_message_unref;
sd_bus_message_get_type;
sd_bus_message_get_cookie;
sd_bus_message_get_reply_cookie;
sd_bus_message_get_priority;
sd_bus_message_get_expect_reply;
sd_bus_message_get_auto_start;
sd_bus_message_get_allow_interactive_authorization;
sd_bus_message_get_signature;
sd_bus_message_get_path;
sd_bus_message_get_interface;
sd_bus_message_get_member;
sd_bus_message_get_destination;
sd_bus_message_get_sender;
sd_bus_message_get_error;
sd_bus_message_get_errno;
sd_bus_message_get_monotonic_usec;
sd_bus_message_get_realtime_usec;
sd_bus_message_get_seqnum;
sd_bus_message_get_bus;
sd_bus_message_get_creds;
sd_bus_message_is_signal;
sd_bus_message_is_method_call;
sd_bus_message_is_method_error;
sd_bus_message_is_empty;
sd_bus_message_has_signature;
sd_bus_message_set_expect_reply;
sd_bus_message_set_auto_start;
sd_bus_message_set_allow_interactive_authorization;
sd_bus_message_set_destination;
sd_bus_message_set_priority;
sd_bus_message_append;
sd_bus_message_append_basic;
sd_bus_message_append_array;
sd_bus_message_append_array_space;
sd_bus_message_append_array_iovec;
sd_bus_message_append_array_memfd;
sd_bus_message_append_string_space;
sd_bus_message_append_string_iovec;
sd_bus_message_append_string_memfd;
sd_bus_message_append_strv;
sd_bus_message_open_container;
sd_bus_message_close_container;
sd_bus_message_copy;
sd_bus_message_read;
sd_bus_message_read_basic;
sd_bus_message_read_array;
sd_bus_message_read_strv;
sd_bus_message_skip;
sd_bus_message_enter_container;
sd_bus_message_exit_container;
sd_bus_message_peek_type;
sd_bus_message_verify_type;
sd_bus_message_at_end;
sd_bus_message_rewind;
sd_bus_get_unique_name;
sd_bus_request_name;
sd_bus_release_name;
sd_bus_list_names;
sd_bus_get_name_creds;
sd_bus_get_name_machine_id;
sd_bus_call_method;
sd_bus_call_method_async;
sd_bus_get_property;
sd_bus_get_property_trivial;
sd_bus_get_property_string;
sd_bus_get_property_strv;
sd_bus_set_property;
sd_bus_reply_method_return;
sd_bus_reply_method_error;
sd_bus_reply_method_errorf;
sd_bus_reply_method_errno;
sd_bus_reply_method_errnof;
sd_bus_emit_signal;
sd_bus_emit_properties_changed_strv;
sd_bus_emit_properties_changed;
sd_bus_emit_interfaces_added_strv;
sd_bus_emit_interfaces_added;
sd_bus_emit_interfaces_removed_strv;
sd_bus_emit_interfaces_removed;
sd_bus_query_sender_creds;
sd_bus_query_sender_privilege;
sd_bus_creds_new_from_pid;
sd_bus_creds_ref;
sd_bus_creds_unref;
sd_bus_creds_get_mask;
sd_bus_creds_get_augmented_mask;
sd_bus_creds_get_pid;
sd_bus_creds_get_ppid;
sd_bus_creds_get_tid;
sd_bus_creds_get_uid;
sd_bus_creds_get_euid;
sd_bus_creds_get_suid;
sd_bus_creds_get_fsuid;
sd_bus_creds_get_gid;
sd_bus_creds_get_egid;
sd_bus_creds_get_sgid;
sd_bus_creds_get_fsgid;
sd_bus_creds_get_supplementary_gids;
sd_bus_creds_get_comm;
sd_bus_creds_get_tid_comm;
sd_bus_creds_get_exe;
sd_bus_creds_get_cmdline;
sd_bus_creds_get_cgroup;
sd_bus_creds_get_unit;
sd_bus_creds_get_slice;
sd_bus_creds_get_user_unit;
sd_bus_creds_get_user_slice;
sd_bus_creds_get_session;
sd_bus_creds_get_owner_uid;
sd_bus_creds_has_effective_cap;
sd_bus_creds_has_permitted_cap;
sd_bus_creds_has_inheritable_cap;
sd_bus_creds_has_bounding_cap;
sd_bus_creds_get_selinux_context;
sd_bus_creds_get_audit_session_id;
sd_bus_creds_get_audit_login_uid;
sd_bus_creds_get_tty;
sd_bus_creds_get_unique_name;
sd_bus_creds_get_well_known_names;
sd_bus_creds_get_description;
sd_bus_error_free;
sd_bus_error_set;
sd_bus_error_setf;
sd_bus_error_set_const;
sd_bus_error_set_errno;
sd_bus_error_set_errnof;
sd_bus_error_set_errnofv;
sd_bus_error_get_errno;
sd_bus_error_copy;
sd_bus_error_is_set;
sd_bus_error_has_name;
sd_bus_error_add_map;
sd_bus_path_encode;
sd_bus_path_decode;
sd_bus_track_new;
sd_bus_track_ref;
sd_bus_track_unref;
sd_bus_track_get_bus;
sd_bus_track_get_userdata;
sd_bus_track_set_userdata;
sd_bus_track_add_sender;
sd_bus_track_remove_sender;
sd_bus_track_add_name;
sd_bus_track_remove_name;
sd_bus_track_count;
sd_bus_track_contains;
sd_bus_track_first;
sd_bus_track_next;
/* sd-event */
sd_event_default;
sd_event_new;
sd_event_ref;
sd_event_unref;
sd_event_add_io;
sd_event_add_time;
sd_event_add_signal;
sd_event_add_child;
sd_event_add_defer;
sd_event_add_post;
sd_event_add_exit;
sd_event_prepare;
sd_event_wait;
sd_event_dispatch;
sd_event_run;
sd_event_loop;
sd_event_exit;
sd_event_now;
sd_event_get_fd;
sd_event_get_state;
sd_event_get_tid;
sd_event_get_exit_code;
sd_event_set_watchdog;
sd_event_get_watchdog;
sd_event_source_ref;
sd_event_source_unref;
sd_event_source_get_event;
sd_event_source_get_userdata;
sd_event_source_set_userdata;
sd_event_source_set_description;
sd_event_source_get_description;
sd_event_source_set_prepare;
sd_event_source_get_pending;
sd_event_source_get_priority;
sd_event_source_set_priority;
sd_event_source_get_enabled;
sd_event_source_set_enabled;
sd_event_source_get_io_fd;
sd_event_source_set_io_fd;
sd_event_source_get_io_events;
sd_event_source_set_io_events;
sd_event_source_get_io_revents;
sd_event_source_get_time;
sd_event_source_set_time;
sd_event_source_set_time_accuracy;
sd_event_source_get_time_accuracy;
sd_event_source_get_time_clock;
sd_event_source_get_signal;
sd_event_source_get_child_pid;
} LIBSYSTEMD_220;
LIBSYSTEMD_222 {
global:
/* sd-bus */
sd_bus_emit_object_added;
sd_bus_emit_object_removed;
sd_bus_flush_close_unref;
} LIBSYSTEMD_221;
LIBSYSTEMD_226 {
global:
sd_pid_get_cgroup;
sd_peer_get_cgroup;
} LIBSYSTEMD_222;
LIBSYSTEMD_227 {
global:
sd_bus_default_flush_close;
sd_bus_path_decode_many;
sd_bus_path_encode_many;
sd_listen_fds_with_names;
} LIBSYSTEMD_226;
LIBSYSTEMD_229 {
global:
sd_journal_has_runtime_files;
sd_journal_has_persistent_files;
sd_journal_enumerate_fields;
sd_journal_restart_fields;
} LIBSYSTEMD_227;
LIBSYSTEMD_230 {
global:
sd_journal_open_directory_fd;
sd_journal_open_files_fd;
} LIBSYSTEMD_229;
LIBSYSTEMD_231 {
global:
sd_event_get_iteration;
} LIBSYSTEMD_230;
LIBSYSTEMD_232 {
global:
sd_bus_track_set_recursive;
sd_bus_track_get_recursive;
sd_bus_track_count_name;
sd_bus_track_count_sender;
sd_bus_set_exit_on_disconnect;
sd_bus_get_exit_on_disconnect;
core: add "invocation ID" concept to service manager This adds a new invocation ID concept to the service manager. The invocation ID identifies each runtime cycle of a unit uniquely. A new randomized 128bit ID is generated each time a unit moves from and inactive to an activating or active state. The primary usecase for this concept is to connect the runtime data PID 1 maintains about a service with the offline data the journal stores about it. Previously we'd use the unit name plus start/stop times, which however is highly racy since the journal will generally process log data after the service already ended. The "invocation ID" kinda matches the "boot ID" concept of the Linux kernel, except that it applies to an individual unit instead of the whole system. The invocation ID is passed to the activated processes as environment variable. It is additionally stored as extended attribute on the cgroup of the unit. The latter is used by journald to automatically retrieve it for each log logged message and attach it to the log entry. The environment variable is very easily accessible, even for unprivileged services. OTOH the extended attribute is only accessible to privileged processes (this is because cgroupfs only supports the "trusted." xattr namespace, not "user."). The environment variable may be altered by services, the extended attribute may not be, hence is the better choice for the journal. Note that reading the invocation ID off the extended attribute from journald is racy, similar to the way reading the unit name for a logging process is. This patch adds APIs to read the invocation ID to sd-id128: sd_id128_get_invocation() may be used in a similar fashion to sd_id128_get_boot(). PID1's own logging is updated to always include the invocation ID when it logs information about a unit. A new bus call GetUnitByInvocationID() is added that allows retrieving a bus path to a unit by its invocation ID. The bus path is built using the invocation ID, thus providing a path for referring to a unit that is valid only for the current runtime cycleof it. Outlook for the future: should the kernel eventually allow passing of cgroup information along AF_UNIX/SOCK_DGRAM messages via a unique cgroup id, then we can alter the invocation ID to be generated as hash from that rather than entirely randomly. This way we can derive the invocation race-freely from the messages.
2016-08-30 23:18:46 +02:00
sd_id128_get_invocation;
} LIBSYSTEMD_231;
LIBSYSTEMD_233 {
global:
sd_id128_get_machine_app_specific;
sd_is_socket_sockaddr;
} LIBSYSTEMD_232;
LIBSYSTEMD_234 {
global:
sd_bus_message_appendv;
} LIBSYSTEMD_233;
LIBSYSTEMD_236 {
global:
sd_bus_message_new;
sd_bus_message_seal;
} LIBSYSTEMD_234;
LIBSYSTEMD_237 {
global:
sd_bus_set_watch_bind;
sd_bus_get_watch_bind;
sd_bus_request_name_async;
sd_bus_release_name_async;
sd_bus_add_match_async;
sd_bus_match_signal;
sd_bus_match_signal_async;
sd_bus_is_ready;
sd_bus_set_connected_signal;
sd_bus_get_connected_signal;
sd_bus_set_sender;
sd_bus_get_sender;
sd_bus_message_set_sender;
sd_event_source_get_io_fd_own;
sd_event_source_set_io_fd_own;
} LIBSYSTEMD_236;
LIBSYSTEMD_238 {
global:
sd_bus_get_n_queued_read;
sd_bus_get_n_queued_write;
} LIBSYSTEMD_237;
LIBSYSTEMD_239 {
global:
sd_bus_open_with_description;
sd_bus_open_user_with_description;
sd_bus_open_system_with_description;
sd_bus_slot_get_floating;
sd_bus_slot_set_floating;
sd_bus_slot_get_destroy_callback;
sd_bus_slot_set_destroy_callback;
sd_bus_track_get_destroy_callback;
sd_bus_track_set_destroy_callback;
sd-event: add new API for subscribing to inotify events This adds a new call sd_event_add_inotify() which allows watching for inotify events on specified paths. sd-event will try to minimize the number of inotify fds allocated, and will try to add file watches to the same inotify fd objects as far as that's possible. Doing this kind of inotify object should optimize behaviour in programs that watch a limited set of mostly independent files as in most cases a single inotify object will suffice for watching all files. Traditionally, this kind of coalescing logic (i.e. that multiple event sources are implemented on top of a single inotify object) was very hard to do, as the inotify API had serious limitations: it only allowed adding watches by path, and would implicitly merge watches installed on the same node via different path, without letting the caller know about whether such merging took place or not. With the advent of O_PATH this issue can be dealt with to some point: instead of adding a path to watch to an inotify object with inotify_add_watch() right away, we can open the path with O_PATH first, call fstat() on the fd, and check the .st_dev/.st_ino fields of that against a list of watches we already have in place. If we find one we know that the inotify_add_watch() will update the watch mask of the existing watch, otherwise it will create a new watch. To make this race-free we use inotify_add_watch() on the /proc/self/fd/ path of the O_PATH fd, instead of the original path, so that we do the checking and watch updating with guaranteed the same inode. This approach let's us deal safely with inodes that may appear under various different paths (due to symlinks, hardlinks, bind mounts, fs namespaces). However it's not a perfect solution: currently the kernel has no API for changing the watch mask of an existing watch -- unless you have a path or fd to the original inode. This means we can "merge" the watches of the same inode of multiple event sources correctly, but we cannot "unmerge" it again correctly in many cases, as access to the original inode might have been lost, due to renames, mount/unmount, or deletions. We could in theory always keep open an O_PATH fd of the inode to watch so that we can change the mask anytime we want, but this is highly problematics, as it would consume too many fds (and in fact the scarcity of fds is the reason why watch descriptors are a separate concepts from fds) and would keep the backing mounts busy (wds do not keep mounts busy, fds do). The current implemented approach to all this: filter in userspace and accept that the watch mask on some inode might be higher than necessary due to earlier installed event sources that might have ceased to exist. This approach while ugly shouldn't be too bad for most cases as the same inodes are probably wacthed for the same masks in most implementations. In order to implement priorities correctly a seperate inotify object is allocated for each priority that is used. This way we get separate per-priority event queues, of which we never dequeue more than a few events at a time. Fixes: #3982
2018-05-28 16:26:50 +02:00
sd_event_add_inotify;
sd_event_source_get_inotify_mask;
sd_event_source_set_destroy_callback;
sd_event_source_get_destroy_callback;
} LIBSYSTEMD_238;
LIBSYSTEMD_240 {
global:
sd_bus_message_readv;
sd_bus_set_method_call_timeout;
sd_bus_get_method_call_timeout;
sd_bus_error_move;
sd_bus_set_close_on_exit;
sd_bus_get_close_on_exit;
sd_device_ref;
sd_device_unref;
sd_device_new_from_syspath;
sd_device_new_from_devnum;
sd_device_new_from_subsystem_sysname;
sd_device_new_from_device_id;
sd_device_get_parent;
sd_device_get_parent_with_subsystem_devtype;
sd_device_get_syspath;
sd_device_get_subsystem;
sd_device_get_devtype;
sd_device_get_devnum;
sd_device_get_ifindex;
sd_device_get_driver;
sd_device_get_devpath;
sd_device_get_devname;
sd_device_get_sysname;
sd_device_get_sysnum;
sd_device_get_is_initialized;
sd_device_get_usec_since_initialized;
sd_device_get_tag_first;
sd_device_get_tag_next;
sd_device_get_devlink_first;
sd_device_get_devlink_next;
sd_device_get_property_first;
sd_device_get_property_next;
sd_device_get_sysattr_first;
sd_device_get_sysattr_next;
sd_device_has_tag;
sd_device_get_property_value;
sd_device_get_sysattr_value;
sd_device_set_sysattr_value;
sd_device_enumerator_new;
sd_device_enumerator_ref;
sd_device_enumerator_unref;
sd_device_enumerator_get_device_first;
sd_device_enumerator_get_device_next;
sd_device_enumerator_get_subsystem_first;
sd_device_enumerator_get_subsystem_next;
sd_device_enumerator_add_match_subsystem;
sd_device_enumerator_add_match_sysattr;
sd_device_enumerator_add_match_property;
sd_device_enumerator_add_match_sysname;
sd_device_enumerator_add_match_tag;
sd_device_enumerator_add_match_parent;
sd_device_enumerator_allow_uninitialized;
sd_hwdb_ref;
sd_hwdb_unref;
sd_hwdb_new;
sd_hwdb_get;
sd_hwdb_seek;
sd_hwdb_enumerate;
sd_id128_get_boot_app_specific;
2018-10-08 15:45:52 +02:00
sd_device_monitor_new;
sd_device_monitor_ref;
sd_device_monitor_unref;
sd_device_monitor_set_receive_buffer_size;
sd_device_monitor_attach_event;
sd_device_monitor_detach_event;
sd_device_monitor_get_event;
sd_device_monitor_get_event_source;
2018-10-08 15:45:52 +02:00
sd_device_monitor_start;
sd_device_monitor_stop;
sd_device_monitor_filter_add_match_subsystem_devtype;
sd_device_monitor_filter_add_match_tag;
sd_device_monitor_filter_update;
sd_device_monitor_filter_remove;
sd_event_source_get_floating;
sd_event_source_set_floating;
} LIBSYSTEMD_239;
LIBSYSTEMD_241 {
global:
sd_bus_close_unref;
} LIBSYSTEMD_240;
sd-bus: add symbol to tell linker that new vtable functions are used In 856ad2a86bd9b3e264a090fcf4b0d05bfaa91030 sd_bus_add_object_vtable() and sd_bus_add_fallback_vtable() were changed to take an updated sd_bus_vtable[] array with additional 'features' and 'names' fields in the union. The commit tried to check whether the old or the new table format is used, by looking at the vtable[0].x.start.element_size field, on the assumption that the added fields caused the structure size to grow. Unfortunately, this assumption was false, and on arm32 (at least), the structure size is unchanged. In libsystemd we use symbol versioning and a major.minor.patch semantic versioning of the library name (major equals the number in the so-name). When systemd-242 was released, the minor number was (correctly) bumped, but this is not enough, because no new symbols were added or symbol versions changed. This means that programs compiled with the new systemd headers and library could be successfully linked to older versions of the library. For example rpm only looks at the so-name and the list of versioned symbols, completely ignoring the major.minor numbers in the library name. But the older library does not understand the new vtable format, and would return -EINVAL after failing the size check (on those architectures where the structure size did change, i.e. all 64 bit architectures). To force new libsystemd (with the functions that take the updated sd_bus_vtable[] format) to be used, let's pull in a dummy symbol from the table definition. This is a bit wasteful, because a dummy pointer has to be stored, but the effect is negligible. In particular, the pointer doesn't even change the size of the structure because if fits in an unused area in the union. The number stored in the new unsigned integer is not checked anywhere. If the symbol exists, we already know we have the new version of the library, so an additional check would not tell us anything. An alternative would be to make sd_bus_add_{object,fallback}_vtable() versioned symbols, using .symver linker annotations. We would provide sd_bus_add_{object,fallback}_vtable@LIBSYSTEMD_221 (for backwards compatibility) and e.g. sd_bus_add_{object,fallback}_vtable@@LIBSYSTEMD_242 (the default) with the new implementation. This would work too, but is more work. We would have to version at least those two functions. And it turns out that the .symver linker instructions have to located in the same compilation unit as the function being annotated. We first compile libsystemd.a, and then link it into libsystemd.so and various other targets, including libsystemd-shared.so, and the nss modules. If the .symver annotations were placed next to the function definitions (in bus-object.c), they would influence all targets that link libsystemd.a, and cause problems, because those functions should not be exported there. To export them only in libsystemd.so, compilation would have to be rearranged, so that the functions exported in libsystemd.so would not be present in libsystemd.a, but a separate compilation unit containg them and the .symver annotations would be linked solely into libsystemd.so. This is certainly possible, but more work than the approach in this patch. 856ad2a86bd9b3e264a090fcf4b0d05bfaa91030 has one more issue: it relies on the undefined fields in sd_bus_vtable[] array to be zeros. But the structure contains a union, and fields of the union do not have to be zero-initalized by the compiler. This means that potentially, we could have garbarge values there, for example when reading the old vtable format definition from the new function implementation. In practice this should not be an issue at all, because vtable definitions are static data and are placed in the ro-data section, which is fully initalized, so we know that those undefined areas will be zero. Things would be different if somebody defined the vtable array on the heap or on the stack. Let's just document that they should zero-intialize the unused areas in this case. The symbol checking code had to be updated because otherwise gcc warns about a cast from unsigned to a pointer.
2019-04-18 13:06:41 +02:00
LIBSYSTEMD_243 {
global:
sd_bus_object_vtable_format;
sd_event_source_disable_unref;
sd-bus: add symbol to tell linker that new vtable functions are used In 856ad2a86bd9b3e264a090fcf4b0d05bfaa91030 sd_bus_add_object_vtable() and sd_bus_add_fallback_vtable() were changed to take an updated sd_bus_vtable[] array with additional 'features' and 'names' fields in the union. The commit tried to check whether the old or the new table format is used, by looking at the vtable[0].x.start.element_size field, on the assumption that the added fields caused the structure size to grow. Unfortunately, this assumption was false, and on arm32 (at least), the structure size is unchanged. In libsystemd we use symbol versioning and a major.minor.patch semantic versioning of the library name (major equals the number in the so-name). When systemd-242 was released, the minor number was (correctly) bumped, but this is not enough, because no new symbols were added or symbol versions changed. This means that programs compiled with the new systemd headers and library could be successfully linked to older versions of the library. For example rpm only looks at the so-name and the list of versioned symbols, completely ignoring the major.minor numbers in the library name. But the older library does not understand the new vtable format, and would return -EINVAL after failing the size check (on those architectures where the structure size did change, i.e. all 64 bit architectures). To force new libsystemd (with the functions that take the updated sd_bus_vtable[] format) to be used, let's pull in a dummy symbol from the table definition. This is a bit wasteful, because a dummy pointer has to be stored, but the effect is negligible. In particular, the pointer doesn't even change the size of the structure because if fits in an unused area in the union. The number stored in the new unsigned integer is not checked anywhere. If the symbol exists, we already know we have the new version of the library, so an additional check would not tell us anything. An alternative would be to make sd_bus_add_{object,fallback}_vtable() versioned symbols, using .symver linker annotations. We would provide sd_bus_add_{object,fallback}_vtable@LIBSYSTEMD_221 (for backwards compatibility) and e.g. sd_bus_add_{object,fallback}_vtable@@LIBSYSTEMD_242 (the default) with the new implementation. This would work too, but is more work. We would have to version at least those two functions. And it turns out that the .symver linker instructions have to located in the same compilation unit as the function being annotated. We first compile libsystemd.a, and then link it into libsystemd.so and various other targets, including libsystemd-shared.so, and the nss modules. If the .symver annotations were placed next to the function definitions (in bus-object.c), they would influence all targets that link libsystemd.a, and cause problems, because those functions should not be exported there. To export them only in libsystemd.so, compilation would have to be rearranged, so that the functions exported in libsystemd.so would not be present in libsystemd.a, but a separate compilation unit containg them and the .symver annotations would be linked solely into libsystemd.so. This is certainly possible, but more work than the approach in this patch. 856ad2a86bd9b3e264a090fcf4b0d05bfaa91030 has one more issue: it relies on the undefined fields in sd_bus_vtable[] array to be zeros. But the structure contains a union, and fields of the union do not have to be zero-initalized by the compiler. This means that potentially, we could have garbarge values there, for example when reading the old vtable format definition from the new function implementation. In practice this should not be an issue at all, because vtable definitions are static data and are placed in the ro-data section, which is fully initalized, so we know that those undefined areas will be zero. Things would be different if somebody defined the vtable array on the heap or on the stack. Let's just document that they should zero-intialize the unused areas in this case. The symbol checking code had to be updated because otherwise gcc warns about a cast from unsigned to a pointer.
2019-04-18 13:06:41 +02:00
} LIBSYSTEMD_241;