From 781802da9307e710877bb1f39c9af5f633dfd406 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Wed, 8 Nov 2017 14:49:25 +0000 Subject: [PATCH] mkstublib: Explain why it is not OK for _capsule_init to use capsule_meta Signed-off-by: Simon McVittie <smcv@collabora.com> --- data/capsule-mkstublib | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/data/capsule-mkstublib b/data/capsule-mkstublib index 3c1e485b2..3d3e8e67e 100755 --- a/data/capsule-mkstublib +++ b/data/capsule-mkstublib @@ -390,8 +390,13 @@ static void __attribute__ ((constructor)) _capsule_init (void) { NULL } }; - // Don't use capsule_meta.soname here - use a static value. - // Trust me when I say you don't want to know why. + // Don't use capsule_meta.soname here, because if we did, it would be + // a relocatable, interposable reference to capsule_meta (assuming the + // shim library wasn't linked with -Bsymbolic). At runtime, we'd get + // an arbitrarily chosen one of the capsule_meta symbols defined by + // the other shim libraries sharing our global symbol namespace, + // and in particular not necessarily our own, with predictably bad + // results. cap = capsule_init( soname ); dso = capsule_load( cap, wrappers, &capsule_errno, &capsule_error ); -- GitLab