Skip to contentSkip to conversation

libselinux's __attribute__((constructor)) versus nVidia libGL.so

DISCUSSION Colin Walters 3 participants 4 messages Aug 27, 2013 – Aug 29, 2013 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

Can someone from the libselinux side comment on this bug?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 3 lines · Colin Walters

This bug:

https://bugzilla.gnome.org/show_bug.cgi?id=706836

FWIW, you can define "priority" values on the constructor attributes, to sort out ordering between libraries, but this sucks as a general purpose solution as it requires co-ordination of priorities between different a projects. eg you might fix the selinux vs nvidia problem now, but it can recur with any other library using constructors in the future. IMHO it would be better to use pthread_once to do any one time initialization of library code

Daniel

Signature · 9 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 5 lines · Daniel P. Berrange
Quoted 3 lines · Colin Walters

This bug:

https://bugzilla.gnome.org/show_bug.cgi?id=706836

Quoted 7 lines

FWIW, you can define "priority" values on the constructor attributes, to sort out ordering between libraries, but this sucks as a general purpose solution as it requires co-ordination of priorities between different a projects. eg you might fix the selinux vs nvidia problem now, but it can recur with any other library using constructors in the future. IMHO it would be better to use pthread_once to do any one time initialization of library code

I think we considered switching that constructor over to using pthread_once (as we already do for many other forms of initialization via the selinux_once macro), but it would require inserting such calls into many/most of the libselinux functions prior to any use of selinux_mnt or selinux_page_size. Certainly doable (and willing to accept such a patch), but I guess the question is whether it is worth it or if nvidia should just fix their library.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.