summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@users.noreply.github.com>2017-08-28 13:49:03 -0300
committerLennart Poettering <lennart@poettering.net>2017-08-28 18:49:03 +0200
commit4f5993c3f48d6f5454f72aeb10b4642fde758076 (patch)
tree0ef40b05aba7530001dc66b1e20f8b4ed6496f76 /src
parent6c24adfd46aac12ec23fd17f6b5a3113546902d0 (diff)
downloadsystemd-4f5993c3f48d6f5454f72aeb10b4642fde758076.tar.gz
shared: Add a linker script so that all functions are tagget @SD_SHARED instead of @Base (#6669)
This helps prevent symbol collisions with other programs and libraries. In particular, because PAM modules are loaded into the process that is creating the session, and systemd creates PAM sessions, the potential for collisions is high. Disambiguate all systemd calls by tagging a 'version' SD_SHARED. Fixes #6624
Diffstat (limited to 'src')
-rw-r--r--src/shared/libshared.sym3
-rw-r--r--src/shared/meson.build5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/shared/libshared.sym b/src/shared/libshared.sym
new file mode 100644
index 0000000000..e4ae17eede
--- /dev/null
+++ b/src/shared/libshared.sym
@@ -0,0 +1,3 @@
+SD_SHARED {
+ global: *;
+};
diff --git a/src/shared/meson.build b/src/shared/meson.build
index 2eaef11a2d..ce84d007d1 100644
--- a/src/shared/meson.build
+++ b/src/shared/meson.build
@@ -136,6 +136,8 @@ libshared_deps = [threads,
liblz4,
libblkid]
+libshared_sym_path = '@0@/libshared.sym'.format(meson.current_source_dir())
+
libshared = shared_library(
libshared_name,
shared_sources,
@@ -144,7 +146,8 @@ libshared = shared_library(
libsystemd_internal_sources,
libudev_sources,
include_directories : includes,
- link_args : ['-shared'],
+ link_args : ['-shared',
+ '-Wl,--version-script=' + libshared_sym_path],
c_args : ['-fvisibility=default'],
dependencies : libshared_deps,
install : true,